diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2021-02-20 21:11:28 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2021-02-20 21:11:28 -0500 |
commit | e51ac807843d1130c9d50b8f121d5d52fc4c87c2 (patch) | |
tree | 1793dba4ae1f61de039e705791265c8efca9f131 | |
parent | 62953c4e27aa70dff4e00096ed0e21001f1a3bb2 (diff) |
Refactor flake
-rw-r--r-- | flake.nix | 59 |
1 files changed, 30 insertions, 29 deletions
@@ -2,35 +2,36 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09"; inputs.nixpkgs_unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; - outputs = { self, nixpkgs, nixpkgs_unstable }: { + outputs = { self, nixpkgs, nixpkgs_unstable }: + { + nixosConfigurations = let + mkConfig = { hostName + , module ? (./. + "/machines/${hostName}.nix") + , system ? "x86_64-linux" }: { + name = hostName; + value = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + [ + module + ({config, pkgs, ...}: { + # Let 'nixos-version --json' know about the Git revision + # of this flake. + system.configurationRevision = + if self ? rev then self.rev else "DIRTY"; - nixosConfigurations = let - mkConfig = { hostName, module ? (./. + "/machines/${hostName}.nix") }: { - name = hostName; - value = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = - [ - module - ({config, pkgs, ...}: { - # Let 'nixos-version --json' know about the Git revision - # of this flake. - system.configurationRevision = - if self ? rev then self.rev else "DIRTY"; - - # Add unstable packages. - nixpkgs.overlays = [ - (final: prev: { unstable = nixpkgs_unstable.legacyPackages."x86_64-linux"; }) - ]; - }) - ]; + # Add unstable packages. + nixpkgs.overlays = [ + (final: prev: { unstable = nixpkgs_unstable.legacyPackages."x86_64-linux"; }) + ]; + }) + ]; + }; }; - }; - myMachines = [ - { hostName = "pincer"; module = ./machines/x1-pincer.nix; } - { hostName = "dragon"; } - ]; - in builtins.listToAttrs (map mkConfig myMachines); - - }; + myMachines = [ + { hostName = "pincer"; module = ./machines/x1-pincer.nix; } + { hostName = "dragon"; } + ]; + in builtins.listToAttrs (map mkConfig myMachines); + }; } |