From c3d6e55a63defe7dd1715dff9b52abcffd5d247c Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Mon, 19 Dec 2022 22:42:15 +0100 Subject: [PATCH] Adding unstable to pkgs.unstable and try apply it at runtime --- base.nix | 22 +++++++++++++++------- flake.lock | 30 +++++++++++++++--------------- flake.nix | 6 ++++-- hosts/jokum/configuration.nix | 1 - overlays-compat/overlays.nix | 8 ++++++++ 5 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 overlays-compat/overlays.nix diff --git a/base.nix b/base.nix index b5f6c841..87449aba 100644 --- a/base.nix +++ b/base.nix @@ -36,16 +36,24 @@ nix.settings.experimental-features = [ "nix-command" "flakes" ]; - /* This makes commandline tools like - ** nix run nixpkgs#hello - ** and nix-shell -p hello - ** use the same channel the system - ** was built with - */ + # This makes commandline tools like nix run nixpkgs#hello + # and nix-shell -p hello use the same channel the system was built with nix.registry = { nixpkgs.flake = inputs.nixpkgs; }; - nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; + nix.nixPath = [ + "nixpkgs=${inputs.nixpkgs}" + "nixpkgs-overlays=${./overlays-compat}/" + ]; + + # Allows access to nixpkgs-unstable via pkgs.unstable + nixpkgs.overlays = let + unstable-overlay = final: prev: { + unstable = inputs.unstable.legacyPackages.${prev.system}; + }; + in [ + unstable-overlay + ]; environment.systemPackages = with pkgs; [ file diff --git a/flake.lock b/flake.lock index e8a8056e..d95aca15 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "matrix-next": { "locked": { - "lastModified": 1671009204, - "narHash": "sha256-gqA9po/KmHyh44XYqv/LfFJ1+MGufhaaD6DhDqBeaF8=", + "lastModified": 1671480255, + "narHash": "sha256-06G6xYTFPVuvmN/k2QDeBk9XIp4LDxEKWRL3aLAFFNo=", "owner": "dali99", "repo": "nixos-matrix-modules", - "rev": "43dbc17526576cb8e0980cef51c48b6598f97550", + "rev": "f42306e0a2df064f1beb6dfcc1776ea33e7ae9df", "type": "github" }, "original": { @@ -18,11 +18,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1670946965, - "narHash": "sha256-PDJfKgK/aSV3ISnD1TbKpLPW85LO/AQI73yQjbwribA=", + "lastModified": 1671445885, + "narHash": "sha256-oDCTgQiqr3y62NrU+viFCYXKln24wgUdYaf4ynXRPgI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "265caf30fa0a5148395b62777389b57eb0a537fd", + "rev": "d3cf188b498a7dc936de67254ba2fdafcf5a1368", "type": "github" }, "original": { @@ -34,11 +34,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1670146390, - "narHash": "sha256-XrEoDpuloRHHbUkbPnhF2bQ0uwHllXq3NHxtuVe/QK4=", + "lastModified": 1671459584, + "narHash": "sha256-6wRK7xmeHfClJ0ICOkax1avLZVGTDqBodQlkl/opccY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "86370507cb20c905800527539fc049a2bf09c667", + "rev": "87b58217c9a05edcf7630b9be32570f889217aef", "type": "github" }, "original": { @@ -64,11 +64,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1670149631, - "narHash": "sha256-rwmtlxx45PvOeZNP51wql/cWjY3rqzIR3Oj2Y+V7jM0=", + "lastModified": 1671472949, + "narHash": "sha256-9iHSGpljCX+RypahQssBXPwkru9onfKfceCTeVrMpH4=", "owner": "Mic92", "repo": "sops-nix", - "rev": "da98a111623101c64474a14983d83dad8f09f93d", + "rev": "32840f16ffa0856cdf9503a8658f2dd42bf70342", "type": "github" }, "original": { @@ -79,11 +79,11 @@ }, "unstable": { "locked": { - "lastModified": 1670918062, - "narHash": "sha256-iOhkyBYUU9Jfkk0lvI4ahpjyrTsLXj9uyJWwmjKg+gg=", + "lastModified": 1671442489, + "narHash": "sha256-pSCuSrG+XxWCs5IZ90eKIxDIZy4rM22YSFMRZ/fiixc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "84575b0bd882be979516f4fecfe4d7c8de8f6a92", + "rev": "ff07b107adeda2164b29f8feb4a86ed012854dfb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 75d91d2b..61aebf80 100644 --- a/flake.nix +++ b/flake.nix @@ -22,8 +22,9 @@ nixosConfigurations = { jokum = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit unstable inputs; }; + specialArgs = { inherit inputs; }; modules = [ + ./base.nix ./hosts/jokum/configuration.nix sops-nix.nixosModules.sops @@ -32,8 +33,9 @@ }; ildkule = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit unstable inputs; }; + specialArgs = { inherit inputs; }; modules = [ + ./base.nix ./hosts/ildkule/configuration.nix sops-nix.nixosModules.sops ]; diff --git a/hosts/jokum/configuration.nix b/hosts/jokum/configuration.nix index f00a0472..fd7f2e98 100644 --- a/hosts/jokum/configuration.nix +++ b/hosts/jokum/configuration.nix @@ -4,7 +4,6 @@ # Include the results of the hardware scan. ./hardware-configuration.nix - ../../base.nix # Users can just import any configuration they want even for non-user things. Improve the users/default.nix to just load some specific attributes if this isn't wanted ../../misc/rust-motd.nix diff --git a/overlays-compat/overlays.nix b/overlays-compat/overlays.nix new file mode 100644 index 00000000..8a606c5c --- /dev/null +++ b/overlays-compat/overlays.nix @@ -0,0 +1,8 @@ +self: super: +with super.lib; +let + # Load the system config and get the `nixpkgs.overlays` option + overlays = (import { }).config.nixpkgs.overlays; +in + # Apply all overlays to the input of the current "main" overlay + foldl' (flip extends) (_: super) overlays self