about summary refs log tree commit diff
path: root/overlays/patches/nixpkgs-wayland/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'overlays/patches/nixpkgs-wayland/flake.nix')
-rw-r--r--overlays/patches/nixpkgs-wayland/flake.nix89
1 files changed, 89 insertions, 0 deletions
diff --git a/overlays/patches/nixpkgs-wayland/flake.nix b/overlays/patches/nixpkgs-wayland/flake.nix
new file mode 100644
index 000000000000..3311d30d8b81
--- /dev/null
+++ b/overlays/patches/nixpkgs-wayland/flake.nix
@@ -0,0 +1,89 @@
+

+{

+  # TODO: rename git repo to 'flake-wayland-apps'

+  description = "wayland-apps";

+

+  inputs = {

+    master = { url = "github:nixos/nixpkgs/master"; };

+    #nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; };

+    nixpkgs = { url = "github:colemickens/nixpkgs/cmpkgs"; }; # TODO: revert soon

+    cachixpkgs = { url = "github:nixos/nixpkgs/nixos-20.03"; };

+    flake-utils = { url = "github:numtide/flake-utils"; }; # TODO: adopt this

+  };

+

+  outputs = inputs:

+    let

+      metadata = builtins.fromJSON (builtins.readFile ./latest.json);

+

+      nameValuePair = name: value: { inherit name value; };

+      genAttrs = names: f: builtins.listToAttrs (map (n: nameValuePair n (f n)) names);

+      forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" ];

+

+      pkgsFor = pkgs: system: includeOverlay:

+        import pkgs {

+          inherit system;

+          config.allowUnfree = true;

+          overlays = if includeOverlay then [

+            (import ./default.nix)            

+          ] else [];

+        };

+    in

+    rec {

+      devShell = forAllSystems (system:

+        let

+          master_ = (pkgsFor inputs.master system false);

+          nixpkgs_ = (pkgsFor inputs.nixpkgs system false);

+          cachixpkgs_ = (pkgsFor inputs.cachixpkgs system false);

+        in

+          nixpkgs_.mkShell {

+            nativeBuildInputs = with nixpkgs_; [

+              bash cacert

+              curl git jq mercurial

+              openssh ripgrep

+

+              cachixpkgs_.cachix

+              master_.nixFlakes

+              master_.nix-build-uncached

+              nixpkgs_.nix-prefetch

+            ];

+          }

+      );

+

+      overlay = final: prev:

+        (import ./default.nix final prev);

+

+      # flakes-util candidate:

+      # make it even more auto to determine sys from the attr name

+      # I think it just needs a genAttrs actually

+      packages = let

+        pkgs = sys:

+          let

+            nixpkgs_ = (pkgsFor inputs.nixpkgs sys true);

+            packagePlatforms = pkg: pkg.meta.hydraPlatforms or pkg.meta.platforms or [ "x86_64-linux" ];

+            pred = n: v: builtins.elem sys (packagePlatforms v);

+          in

+            nixpkgs_.lib.filterAttrs pred nixpkgs_.waylandPkgs;

+      in {

+          x86_64-linux = pkgs "x86_64-linux";

+          aarch64-linux = pkgs "aarch64-linux";

+        };

+

+      # TODO flake-util: join all `inputs.self.packages`

+      # TODO: recursive dependencies aren't checked

+      defaultPackage = forAllSystems (system:

+        let

+          nixpkgs_ = (pkgsFor inputs.nixpkgs system true);

+          attrValues = inputs.nixpkgs.lib.attrValues;

+          out = packages."${system}";

+        in

+          nixpkgs_.symlinkJoin {

+            name = "nixpkgs-wayland";

+            paths = attrValues out;

+          }

+      );

+

+      hydraJobs = {

+        packages = inputs.self.packages;

+      };

+    };

+}