diff --git a/servers.nix b/servers.nix index a1e7ddc..7dd2986 100644 --- a/servers.nix +++ b/servers.nix @@ -1,24 +1,10 @@ let - lib = import ; - n = url: conf: let - c = import "${url}/nixos/lib/eval-config.nix" { - modules = [ ./roles conf ]; - extraArgs.name = lib.removeSuffix ".nix" (builtins.baseNameOf conf); - extraArgs.nixpkgs = url; - }; - in c.config.system.build // c; - git = n "https://github.com/NixOS/nixpkgs/archive/master.tar.gz"; - stable = n (builtins.fetchTarball "channel:nixos-20.03"); - unstable = n (builtins.fetchTarball "channel:nixos-unstable-small"); - checkout = n ../projects/nixpkgs; - channel = n "/nix/var/nix/profiles/per-user/root/channels/nixos"; + sources = import ./nix/sources.nix; + nixpkgs = import sources.nixpkgs {}; + nixos = name: configuration: import (nixpkgs.path + "/nixos/lib/eval-config.nix") { + extraArgs = { inherit name; }; + modules = [ ({lib, ... }: { config.nixpkgs.pkgs = lib.mkDefault nixpkgs; }) ] ++ configuration; + }; + names = [ "pennyworth" "jarvis" "blackadder" "woodhouse" "frumar" "zazu" ]; in -{ - pennyworth = (unstable ./logical/pennyworth.nix).toplevel; - jarvis = (channel ./logical/jarvis.nix).toplevel; - blackadder = (channel ./logical/blackadder.nix).toplevel; - ascanius = (channel ./logical/ascanius.nix).toplevel; - woodhouse = (channel ./logical/woodhouse.nix).toplevel; # 192.168.178.39 - frumar = (channel ./logical/frumar.nix).toplevel; # frumar.local - zazu = (stable ./logical/zazu.nix).toplevel; -} +nixpkgs.lib.genAttrs names (name: (nixos name [ ./roles (./logical + "/${name}.nix") ]).config.system.build.toplevel)