diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index 1b33e663a98dbc..520101b1c21208 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -132,6 +132,9 @@ - `python3Packages.opentracing` has been removed due to being unmaintained upstream. [OpenTelemetry](https://opentelemetry.io/) is the recommended replacement. +- `security.apparmor.policies..enforce` and `security.apparmor.policies..enable` were removed. + Configuring the state of apparmor policies must now be done using `security.apparmor.policies..state` tristate option. + - the notmuch vim plugin now lives in a separate output of the `notmuch` package. Installing `notmuch` will not bring the notmuch vim package anymore, add `vimPlugins.notmuch-vim` to your (Neo)vim configuration if you want the diff --git a/nixos/modules/security/apparmor.nix b/nixos/modules/security/apparmor.nix index 87dde1ad50a9da..a4c2f9e29fc343 100644 --- a/nixos/modules/security/apparmor.nix +++ b/nixos/modules/security/apparmor.nix @@ -5,24 +5,16 @@ ... }: let - inherit (builtins) - attrNames - head - map - match - readFile - ; inherit (lib) types; inherit (config.environment) etc; cfg = config.security.apparmor; - mkDisableOption = - name: - lib.mkEnableOption name - // { - default = true; - example = false; - }; - enabledPolicies = lib.filterAttrs (n: p: p.enable) cfg.policies; + enabledPolicies = lib.filterAttrs (n: p: p.state != "disable") cfg.policies; + buildPolicyPath = n: p: lib.defaultTo (pkgs.writeText n p.profile) p.path; + + # Accessing submodule options when not defined results in an error thunk rather than a regular option object + # We can emulate the behavior of `