Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91ab0f9902
|
||
|
|
d44463b235 |
No files matched your search
@@ -40,7 +40,6 @@ in
|
||||
model = "arc-140t";
|
||||
};
|
||||
};
|
||||
hardening.enable = true;
|
||||
keyboard.enable = true;
|
||||
localization.enable = true;
|
||||
memory = {
|
||||
|
||||
@@ -31,7 +31,10 @@ in
|
||||
firmware = "uefi";
|
||||
};
|
||||
docker.enable = true;
|
||||
hardening.enable = true;
|
||||
hardening = {
|
||||
enable = true;
|
||||
profile = "server";
|
||||
};
|
||||
secrets.enable = true;
|
||||
ssh.enable = true;
|
||||
tailscale.enable = true;
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
let
|
||||
wakeOnLan = lib.any (iface: iface.wakeOnLan.enable) (lib.attrValues config.networking.interfaces);
|
||||
randomMac = config.host.role == "laptop" && !wakeOnLan;
|
||||
desktop = {
|
||||
profiles = {
|
||||
workstation = {
|
||||
preset = [
|
||||
"compatibility"
|
||||
]
|
||||
@@ -18,16 +19,6 @@ let
|
||||
etc.harden-bluetooth = false;
|
||||
};
|
||||
};
|
||||
profiles = {
|
||||
inherit desktop;
|
||||
|
||||
laptop = lib.recursiveUpdate desktop {
|
||||
preset = [
|
||||
"compatibility"
|
||||
"performance"
|
||||
];
|
||||
settings.kernel.iommu-passthrough = false;
|
||||
};
|
||||
|
||||
server = {
|
||||
preset = [
|
||||
@@ -67,29 +58,21 @@ in
|
||||
type = lib.types.bool;
|
||||
};
|
||||
profile = lib.mkOption {
|
||||
default = if profiles ? ${config.host.role} then config.host.role else null;
|
||||
type = lib.types.nullOr (lib.types.enum (lib.attrNames profiles));
|
||||
default = "workstation";
|
||||
type = lib.types.enum [
|
||||
"workstation"
|
||||
"server"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.hardening.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.hardening.profile != null;
|
||||
message = "no 'hardening.profile' for `${config.host.role}` host role";
|
||||
}
|
||||
];
|
||||
boot.blacklistedKernelModules = [
|
||||
"dccp"
|
||||
"sctp"
|
||||
"rds"
|
||||
"tipc"
|
||||
];
|
||||
hardware.bluetooth.settings.General = lib.mkIf config.hardware.bluetooth.enable {
|
||||
PairableTimeout = 30;
|
||||
DiscoverableTimeout = 30;
|
||||
TemporaryTimeout = 0;
|
||||
};
|
||||
networking.wireless.iwd.settings.General.AddressRandomization = lib.mkIf randomMac "network";
|
||||
nix-mineral = lib.mkMerge [
|
||||
{
|
||||
@@ -116,7 +99,7 @@ in
|
||||
};
|
||||
};
|
||||
}
|
||||
(lib.optionalAttrs (config.hardening.profile != null) profiles.${config.hardening.profile})
|
||||
profiles.${config.hardening.profile}
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user