Include the name in the configuration

This commit is contained in:
Manuel Thalmann 2024-05-01 16:53:40 +02:00
parent 3693994200
commit a2810cb314
2 changed files with 37 additions and 39 deletions

View file

@ -19,10 +19,10 @@
nixosConfigurations = builtins.listToAttrs nixosConfigurations = builtins.listToAttrs
( (
builtins.map ( builtins.map (
{ name, config ? {} }: { name, ... }@config:
{ {
inherit name; inherit name;
value = system name config; value = system config;
}) })
systems); systems);
}; };

View file

@ -1,42 +1,40 @@
{ nixpkgs }: { nixpkgs }:
name : { name, dualBoot ? false } :
{ dualBoot ? false } : let
let lib = nixpkgs.lib;
lib = nixpkgs.lib; configPath = ./machines/${name}.nix;
configPath = ./machines/${name}.nix; machineConfig =
machineConfig = if builtins.pathExists configPath then
if builtins.pathExists configPath then configPath
configPath else
else ./hardware/base.nix;
./hardware/base.nix; in lib.nixosSystem {
in system = "x86_64-linux";
lib.nixosSystem { modules = [
system = "x86_64-linux"; (
modules = [ { config, pkgs, lib, ... }: {
( imports = [
{ config, pkgs, lib, ... }: { machineConfig
imports = [ ./modules/custom-build-vm.nix
machineConfig ];
./modules/custom-build-vm.nix
];
system.stateVersion = "23.11"; system.stateVersion = "23.11";
virtualisation = virtualisation =
let let
vmConfig = { vmConfig = {
virtualisation = { virtualisation = {
sharedHostKeys = true; sharedHostKeys = true;
virt-viewer = true; virt-viewer = true;
};
};
in {
vmVariant = vmConfig;
vmVariantWithBootLoader = vmConfig;
}; };
};
in {
vmVariant = vmConfig;
vmVariantWithBootLoader = vmConfig;
};
# Networking # Networking
networking.hostName = name; networking.hostName = name;
}) })
]; ];
} }