diff options
| author | Kjetil Orbekk <kj@orbekk.com> | 2021-03-07 14:17:48 -0500 | 
|---|---|---|
| committer | Kjetil Orbekk <kj@orbekk.com> | 2021-03-07 14:17:48 -0500 | 
| commit | 46e1d2a1552d4aaad676faf49cb0582515d62c86 (patch) | |
| tree | 7133f0b4034659685d5f33ac9c6d76959fc8ffc3 | |
| parent | 4e91f3e6cf9c13bb4b0974715cab8c252247b94b (diff) | |
Properly wrap up unstable in flake config
| -rw-r--r-- | flake.nix | 33 | 
1 files changed, 29 insertions, 4 deletions
| @@ -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;                        };                      }) | 
