diff --git a/checks/lib/container-test.nix b/checks/lib/container-test.nix index fc4574dde..31ba285a5 100644 --- a/checks/lib/container-test.nix +++ b/checks/lib/container-test.nix @@ -9,29 +9,38 @@ in { hostPkgs = pkgs; # speed-up evaluation - defaults = { - imports = [ - ./minify.nix - ]; - documentation.enable = lib.mkDefault false; - boot.isContainer = true; + defaults = + { config, options, ... }: + { + imports = [ + ./minify.nix + ]; + config = lib.mkMerge [ + (lib.optionalAttrs (options ? clan) { + clan.core.settings.machine.name = config.networking.hostName; + }) + { + documentation.enable = lib.mkDefault false; + boot.isContainer = true; - # needed since nixpkgs 7fb2f407c01b017737eafc26b065d7f56434a992 removed the getty unit by default - console.enable = true; + # needed since nixpkgs 7fb2f407c01b017737eafc26b065d7f56434a992 removed the getty unit by default + console.enable = true; - # undo qemu stuff - system.build.initialRamdisk = ""; - virtualisation.sharedDirectories = lib.mkForce { }; - networking.useDHCP = false; + # undo qemu stuff + system.build.initialRamdisk = ""; + virtualisation.sharedDirectories = lib.mkForce { }; + networking.useDHCP = false; - # we have not private networking so far - networking.interfaces = lib.mkForce { }; - #networking.primaryIPAddress = lib.mkForce null; - systemd.services.backdoor.enable = false; + # we have not private networking so far + networking.interfaces = lib.mkForce { }; + #networking.primaryIPAddress = lib.mkForce null; + systemd.services.backdoor.enable = false; - # we don't have permission to set cpu scheduler in our container - systemd.services.nix-daemon.serviceConfig.CPUSchedulingPolicy = lib.mkForce ""; - }; + # we don't have permission to set cpu scheduler in our container + systemd.services.nix-daemon.serviceConfig.CPUSchedulingPolicy = lib.mkForce ""; + } + ]; + }; # to accept external dependencies such as disko node.specialArgs.self = self; _module.args = { inherit self; }; diff --git a/checks/lib/test-base.nix b/checks/lib/test-base.nix index 594615e68..7c37ee51a 100644 --- a/checks/lib/test-base.nix +++ b/checks/lib/test-base.nix @@ -8,14 +8,21 @@ in hostPkgs = pkgs; # speed-up evaluation defaults = ( - { config, ... }: + { config, options, ... }: { imports = [ ./minify.nix ]; - documentation.enable = lib.mkDefault false; - nix.settings.min-free = 0; - system.stateVersion = config.system.nixos.release; + config = lib.mkMerge [ + (lib.optionalAttrs (options ? clan) { + clan.core.settings.machine.name = config.networking.hostName; + }) + { + documentation.enable = lib.mkDefault false; + nix.settings.min-free = 0; + system.stateVersion = config.system.nixos.release; + } + ]; } ); diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index e55e5ff5c..c92800197 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -94,9 +94,6 @@ let # Inherited from clan wide settings # TODO: remove these - # Machine specific settings - # clan.core.settings.machine.name = name; - networking.hostName = lib.mkDefault name; # For vars we need to override the system so we run vars diff --git a/nixosModules/clanCore/metadata.nix b/nixosModules/clanCore/metadata.nix index 748d2b076..f0278a6ee 100644 --- a/nixosModules/clanCore/metadata.nix +++ b/nixosModules/clanCore/metadata.nix @@ -117,7 +117,7 @@ in options = { name = mkOption { type = types.str; - default = "nixos"; + readOnly = true; description = '' the name of the machine '';