From 46e1d2a1552d4aaad676faf49cb0582515d62c86 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sun, 7 Mar 2021 14:17:48 -0500 Subject: Properly wrap up unstable in flake config --- flake.nix | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 2de484b..d94478d 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,26 @@ inputs.nix.inputs.nixpkgs.follows = "nixpkgs"; outputs = { self, nixpkgs, nixpkgs-unstable, nix, nixos-hardware, home-manager }: + let + system = "x86_64-linux"; + + pkgs-module = {config, ...}: + let + cfg = config.nixpkgs; + + unstable-overlay = final: prev: { + unstable = import nixpkgs-unstable { + inherit (cfg) config localSystem crossSystem; + }; + }; + in { + nixpkgs.pkgs = import nixpkgs { + inherit (cfg) config localSystem crossSystem; + overlays = cfg.overlays ++ [ unstable-overlay ]; + }; + }; + + in { nixosConfigurations = let mkConfig = { hostName @@ -18,23 +38,28 @@ , system ? "x86_64-linux" }: { name = hostName; value = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + inherit system; + modules = [ + pkgs-module module nixpkgs.nixosModules.notDetected ({config, pkgs, ...}: { # Let 'nixos-version --json' know about the Git revision # of this flake. system.configurationRevision = - if self ? rev then self.rev else "DIRTY"; + let + lastModified = final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101"); + in + "${lastModified}.${self.shortRev or "dirty"}"; nixpkgs.overlays = [ # Add unstable packages. (final: prev: { my-extras = { - inherit nixpkgs; - inherit nixpkgs-unstable; + # inherit nixpkgs; + # inherit nixpkgs-unstable; inherit nixos-hardware; }; }) -- cgit v1.2.3