From 6f3ab9c4bf9e09599ba8207c5152568920bde762 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Wed, 15 Jun 2022 23:20:48 -0400 Subject: [PATCH] factor out hostnames --- hosts/cube/default.nix | 4 ---- hosts/default.nix | 25 ++++++++++++++----------- hosts/hp/default.nix | 2 -- hosts/lenny/default.nix | 2 -- hosts/nixdev/default.nix | 2 -- hosts/slate/default.nix | 2 -- 6 files changed, 14 insertions(+), 23 deletions(-) diff --git a/hosts/cube/default.nix b/hosts/cube/default.nix index 4cc4943..ab03a36 100644 --- a/hosts/cube/default.nix +++ b/hosts/cube/default.nix @@ -1,9 +1,5 @@ { config, lib, pkgs, ... }: { - networking.hostName = "cube"; - - # imports = [ ./monitors.nix ]; - virtualisation.libvirtd.enable = true; environment.systemPackages = with pkgs; [ virt-manager diff --git a/hosts/default.nix b/hosts/default.nix index 79c62fd..22678c5 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,17 +1,20 @@ nixpkgs: hardware: nixosModule: with hardware; -let - sys = system: mods: nixpkgs.lib.nixosSystem { - inherit system; - modules = [ nixosModule ] ++ mods; - }; +builtins.mapAttrs + + (name: { system, mods }: nixpkgs.lib.nixosSystem { + inherit system; + modules = mods ++ [ + nixosModule + { networking.hostName = name; } + ]; + }) -in { - cube = sys "x86_64-linux" [ physical ./cube ]; - hp = sys "x86_64-linux" [ physical ./hp ]; - lenny = sys "x86_64-linux" [ physical ./lenny ]; - nixdev = sys "x86_64-linux" [ qemu ./nixdev ]; - slate = sys "x86_64-linux" [ physical ./slate ]; + cube = { system = "x86_64-linux"; mods = [ physical ./cube ]; }; + hp = { system = "x86_64-linux"; mods = [ physical ./hp ]; }; + lenny = { system = "x86_64-linux"; mods = [ physical ./lenny ]; }; + nixdev = { system = "x86_64-linux"; mods = [ qemu ./nixdev ]; }; + slate = { system = "x86_64-linux"; mods = [ physical ./slate ]; }; } diff --git a/hosts/hp/default.nix b/hosts/hp/default.nix index 3a22a9e..dadd533 100644 --- a/hosts/hp/default.nix +++ b/hosts/hp/default.nix @@ -1,7 +1,5 @@ { config, lib, pkgs, ... }: { - networking.hostName = "hp"; - services = { openssh.enable = true; }; diff --git a/hosts/lenny/default.nix b/hosts/lenny/default.nix index 49867d4..509142c 100644 --- a/hosts/lenny/default.nix +++ b/hosts/lenny/default.nix @@ -1,7 +1,5 @@ { config, lib, pkgs, ... }: { - networking.hostName = "lenny"; - services = { openssh.enable = true; }; diff --git a/hosts/nixdev/default.nix b/hosts/nixdev/default.nix index 55d0c3a..9c79acf 100644 --- a/hosts/nixdev/default.nix +++ b/hosts/nixdev/default.nix @@ -1,7 +1,5 @@ { config, lib, pkgs, ... }: { - networking.hostName = "nixdev"; - sconfig = { gnome = true; profile = "desktop"; diff --git a/hosts/slate/default.nix b/hosts/slate/default.nix index 336b60b..63384d8 100644 --- a/hosts/slate/default.nix +++ b/hosts/slate/default.nix @@ -1,7 +1,5 @@ { pkgs, ... }: { - networking.hostName = "slate"; - sconfig = { profile = "desktop"; gnome = true;