Which variable(s) could I use to distinguish between notebook vs desktop pc in the configuration of nixos
- e.g. analog to variables/checks like
lib.optional (system != "x86_64-linux")
- which are derived from the device itself
Which variable(s) could I use to distinguish between notebook vs desktop pc in the configuration of nixos
lib.optional (system != "x86_64-linux")
- which are derived from the device itselfUse distinct entry points for each system, then you can configure them independently, with shared config where necessary.
One alternative is to define your own NixOS option and use that throughout your other modules / configuration.nix.
imports = [
./hardware-configuration.nix
{
options.local.machineType = lib.mkOption {
type = lib.types.enum [ "desktop" "notebook" ];
default = "desktop";
};
}
];
local.machineType = "notebook";
networking.hostName = "my-" + config.local.machineType;
Then you can use config.local.machineType
as the “variable” in configuration.nix or other local nixos modules.