flake: set hostname in mkSystem

This commit is contained in:
Charlie Root 2024-09-22 19:21:27 +02:00
commit da4319add1
3 changed files with 8 additions and 4 deletions

View file

@ -28,12 +28,16 @@ in {
temperance = mkSystem { temperance = mkSystem {
inherit withSystem; inherit withSystem;
system = "x86_64-linux"; system = "x86_64-linux";
hostname = "temperance";
modules = mkModulesFor "temperance"; modules = mkModulesFor "temperance";
}; };
hermit = mkSystem { hermit = mkSystem {
inherit withSystem; inherit withSystem;
system = "x86_64-linux"; system = "x86_64-linux";
hostname = "hermit";
modules = mkModulesFor "hermit"; modules = mkModulesFor "hermit";
}; };
}; };

View file

@ -1,11 +1,10 @@
{config, ...}: let {config, ...}: let
inherit (config.modules.other.system) hostname username; inherit (config.modules.other.system) username;
in { in {
imports = [ imports = [
./networkmanager.nix ./networkmanager.nix
]; ];
networking = { networking = {
hostName = hostname;
enableIPv6 = true; enableIPv6 = true;
nameservers = [ nameservers = [
# quad9 DNS # quad9 DNS

View file

@ -10,6 +10,7 @@
mkSystem = { mkSystem = {
withSystem, withSystem,
system, system,
hostname,
... ...
} @ args: } @ args:
withSystem system ( withSystem system (
@ -30,9 +31,9 @@
(args.specialArgs or {}); (args.specialArgs or {});
modules = concatLists [ modules = concatLists [
# This is used to pre-emptively set the hostPlatform for nixpkgs. # This is used to pre-emptively set the hostPlatform for nixpkgs.
# We need a singleton here since we concatenate lists, and a singleton # Also, we set the system hostname here.
# generates a list with a single element.
(singleton { (singleton {
networking.hostName = args.hostname;
nixpkgs.hostPlatform = mkDefault args.system; nixpkgs.hostPlatform = mkDefault args.system;
}) })