nixos/profiles/hardened: replace 'with' using inherit and add disable option

This commit is contained in:
Nico Felbinger 2025-01-19 17:45:14 +01:00
parent 81f97de458
commit 958d1fb821
No known key found for this signature in database
GPG key ID: 6E4C8C7087EFEEAE

View file

@ -12,10 +12,21 @@
pkgs, pkgs,
... ...
}: }:
let
with lib; inherit (lib)
mkDefault
mkOverride
mkEnableOption
mkIf
maintainers
;
in
{ {
options.profiles.hardened = mkEnableOption "hardened" // {
default = true;
example = false;
};
config = mkIf config.profiles.hardened {
meta = { meta = {
maintainers = [ maintainers = [
maintainers.joachifm maintainers.joachifm
@ -122,4 +133,5 @@ with lib;
# Ignore outgoing ICMP redirects (this is ipv4 only) # Ignore outgoing ICMP redirects (this is ipv4 only)
boot.kernel.sysctl."net.ipv4.conf.all.send_redirects" = mkDefault false; boot.kernel.sysctl."net.ipv4.conf.all.send_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.default.send_redirects" = mkDefault false; boot.kernel.sysctl."net.ipv4.conf.default.send_redirects" = mkDefault false;
};
} }