2024-04-11 20:15:47 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
machineInfos,
|
|
|
|
modulesPath,
|
|
|
|
...
|
|
|
|
}:
|
2023-10-22 17:12:42 +02:00
|
|
|
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 {
|
2024-04-11 20:15:47 +02:00
|
|
|
type = types.enum [
|
|
|
|
"workstation"
|
|
|
|
"server"
|
|
|
|
];
|
2023-10-22 17:12:42 +02:00
|
|
|
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.
|
2024-04-11 20:15:47 +02:00
|
|
|
programs.fish.enable = builtins.any (user: user.shell == pkgs.fish) (
|
|
|
|
builtins.attrValues config.machineUsers
|
|
|
|
);
|
2023-10-22 17:12:42 +02:00
|
|
|
|
|
|
|
# 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";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|