75 lines
1.6 KiB
Nix
75 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
machineInfos,
|
|
modulesPath,
|
|
...
|
|
}:
|
|
with lib;
|
|
{
|
|
imports = [
|
|
./filesystem.nix
|
|
./boot.nix
|
|
./linux.nix
|
|
./nix.nix
|
|
./network.nix
|
|
./hardware.nix
|
|
./users.nix
|
|
(modulesPath + "/installer/scan/not-detected.nix")
|
|
];
|
|
|
|
options.machineType = mkOption {
|
|
type = types.enum [
|
|
"workstation"
|
|
"server"
|
|
];
|
|
default = "workstation";
|
|
example = "server";
|
|
description = ''
|
|
What is the type of this machine.
|
|
'';
|
|
};
|
|
|
|
options.isProfessional = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
example = true;
|
|
description = ''
|
|
Whether or not this machine is used for professionnal purposes.
|
|
'';
|
|
};
|
|
|
|
options.enableDocker = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
example = true;
|
|
description = ''
|
|
Whether or not to enable the docker stack.
|
|
'';
|
|
};
|
|
|
|
config = {
|
|
machineType = machineInfos.machineType;
|
|
system.stateVersion = machineInfos.stateVersion;
|
|
networking.hostName = machineInfos.hostname;
|
|
virtualisation.docker.enable = config.enableDocker;
|
|
|
|
# Only enable fish shell if there is at least one user using it.
|
|
programs.fish.enable = builtins.any (user: user.shell == pkgs.fish) (
|
|
builtins.attrValues config.machineUsers
|
|
);
|
|
|
|
# We always want to disable the X server as only workstation use windows manager
|
|
# and they always use wayland.
|
|
services.xserver.enable = false;
|
|
|
|
assertions = [
|
|
{
|
|
assertion = !(config.machineType == "server" && config.isProfessional);
|
|
message = "Only workstations can be professionnal hardware";
|
|
}
|
|
];
|
|
};
|
|
}
|