From fcf91480199cec9225e155c68dafff9980b1812a Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Mon, 18 Jan 2021 01:59:52 -0700 Subject: [PATCH 1/5] default: add default.nix using flake-compat --- default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..0aa4d8b --- /dev/null +++ b/default.nix @@ -0,0 +1,10 @@ +(import + ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; + sha256 = "sha256:0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; + } + ) + { + src = ./.; + }).defaultNix From 4248b2d1a552271777c51cb9da1ad4a25be9c6d7 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Mon, 18 Jan 2021 02:11:15 -0700 Subject: [PATCH 2/5] miningcore: remove from outputs --- pkgs/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/default.nix b/pkgs/default.nix index e1a94dd..fd75896 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -8,5 +8,4 @@ final: prev: { libinih = prev.callPackage ./development/libraries/libinih { }; steamcompmgr = prev.callPackage ./applications/window-managers/steamcompmgr { }; - miningcore = prev.callPackage ./applications/blockchains/miningcore { }; } From f8f67d2dcb2b5cceec58aec6d136e82bc4f6e58c Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Mon, 18 Jan 2021 02:23:49 -0700 Subject: [PATCH 3/5] packages: apply overlays to output packages Apply overlays to output packages so we can easily use a modified package. --- flake.nix | 32 ++++++++++++++++---------------- hosts/default.nix | 13 ++----------- lib/utils.nix | 43 ++++++++++++++++++------------------------- 3 files changed, 36 insertions(+), 52 deletions(-) diff --git a/flake.nix b/flake.nix index 9ab140f..13ea1a9 100644 --- a/flake.nix +++ b/flake.nix @@ -26,26 +26,29 @@ externOverlays = [ nur.overlay devshell.overlay ]; externModules = [ home.nixosModules.home-manager ]; + pkgs' = unstable: + let + override = import ./pkgs/override.nix; + overlays = (attrValues self.overlays) + ++ externOverlays + ++ [ self.overlay (override unstable) ]; + in + pkgImport nixos overlays; + + unstable' = pkgImport master [ ]; + osSystem = "x86_64-linux"; outputs = let system = osSystem; - pkgset = - let - overlays = - (attrValues self.overlays) - ++ externOverlays - ++ [ self.overlay ]; - in - genPkgset { - inherit master nixos overlays system; - }; + unstablePkgs = unstable' system; + osPkgs = pkgs' unstablePkgs system; in { nixosConfigurations = import ./hosts (recursiveUpdate inputs { - inherit lib pkgset utils externModules system; + inherit lib osPkgs unstablePkgs utils externModules system; }); overlay = import ./pkgs; @@ -65,11 +68,8 @@ (eachDefaultSystem (system: let - pkgs = pkgImport { - inherit system; - pkgs = nixos; - overlays = [ devshell.overlay ]; - }; + unstablePkgs = unstable' system; + pkgs = pkgs' unstablePkgs system; packages = flattenTreeSystem system (genPackages { diff --git a/hosts/default.nix b/hosts/default.nix index 725c56e..0ce9897 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -2,9 +2,10 @@ , lib , nixos , master -, pkgset +, osPkgs , self , system +, unstablePkgs , utils , externModules , ... @@ -12,7 +13,6 @@ let inherit (utils) recImport; inherit (builtins) attrValues removeAttrs; - inherit (pkgset) osPkgs unstablePkgs; unstableModules = [ ]; addToDisabledModules = [ ]; @@ -65,14 +65,6 @@ let system.configurationRevision = lib.mkIf (self ? rev) self.rev; }; - overrides = { - nixpkgs.overlays = - let - override = import ../pkgs/override.nix unstablePkgs; - in - [ override ]; - }; - local = import "${toString ./.}/${hostName}.nix"; # Everything in `./modules/list.nix`. @@ -84,7 +76,6 @@ let core global local - overrides modOverrides ] ++ externModules; diff --git a/lib/utils.nix b/lib/utils.nix index 7980636..8dc6d9e 100644 --- a/lib/utils.nix +++ b/lib/utils.nix @@ -1,8 +1,8 @@ { lib, ... }: let - inherit (builtins) attrNames isAttrs readDir listToAttrs; + inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs; - inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix + inherit (lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix recursiveUpdate genAttrs; # mapFilterAttrs :: @@ -14,8 +14,8 @@ let # Generate an attribute set by mapping a function over a list of values. genAttrs' = values: f: listToAttrs (map f values); - pkgImport = { pkgs, system, overlays }: - import pkgs { + pkgImport = nixpkgs: overlays: system: + import nixpkgs { inherit system overlays; config = { allowUnfree = true; }; }; @@ -33,20 +33,6 @@ in { inherit mapFilterAttrs genAttrs' pkgImport pathsToImportedAttrs; - genPkgset = { master, nixos, overlays, system }: - { - osPkgs = pkgImport { - inherit system overlays; - pkgs = nixos; - }; - - unstablePkgs = pkgImport { - inherit system; - overlays = []; - pkgs = master; - }; - }; - overlayPaths = let overlayDir = ../overlays; @@ -86,12 +72,19 @@ in genPackages = { self, pkgs }: let inherit (self) overlay overlays; - packages = overlay pkgs pkgs; - overlayPkgs = - genAttrs - (attrNames overlays) - (name: (overlays."${name}" pkgs pkgs)."${name}"); + packagesNames = attrNames (overlay null null) + ++ attrNames (fold + (attr: sum: recursiveUpdate sum attr) + { } + (attrValues + (mapAttrs (_: v: v null null) overlays) + ) + ); in - recursiveUpdate packages overlayPkgs; - + fold + (key: sum: recursiveUpdate sum { + ${key} = pkgs.${key}; + }) + { } + packagesNames; } From cd2ba3b9dc70ddf4ca0af2351729d3437bc5b707 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Mon, 18 Jan 2021 02:24:34 -0700 Subject: [PATCH 4/5] flake.lock: update inputs --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 8610dea..7b6d8e2 100644 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,11 @@ }, "master": { "locked": { - "lastModified": 1607981906, - "narHash": "sha256-tFuNBkK0F5km1Lq5ulLgLVm3BvOvI7t4k4Y7xTIo3QE=", + "lastModified": 1610960440, + "narHash": "sha256-0ZDzGoFhROKZwcW2Sa2CXiwYL6br09JORgEHr58w/Ew=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "dd95aa337e23a8a48fe82f0f7b1cced8bc03e379", + "rev": "3bdf95ceb5660273a01ed2e5be2676487f7e820e", "type": "github" }, "original": { @@ -67,11 +67,11 @@ }, "nixos": { "locked": { - "lastModified": 1607967859, - "narHash": "sha256-biRVmLlWfxIvB2O+mkFbObb4MmCzbYvpy5Rap4g9Mig=", + "lastModified": 1610885893, + "narHash": "sha256-VAETd1jhnWUJmq0b8Dbi9mo4qvS+AYC3d9tmVfnf2zQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7362dab2c9bd21eeef831f32608161584b388ef4", + "rev": "3888fe83e1c7b5331d032177b039e91f83bf34e1", "type": "github" }, "original": { From 55950737dc55ef0a3cc4ca09ab2f18d2644c20c6 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Mon, 18 Jan 2021 02:26:52 -0700 Subject: [PATCH 5/5] default: x86_64-linux packages --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 0aa4d8b..3c08d63 100644 --- a/default.nix +++ b/default.nix @@ -7,4 +7,4 @@ ) { src = ./.; - }).defaultNix + }).defaultNix.packages.x86_64-linux