grimm-nixos-laptop/common/tooling/apparmor/aa-alias-module.nix

30 lines
693 B
Nix
Raw Normal View History

2024-10-25 18:13:30 +02:00
{
config,
lib,
pkgs,
...
}:
let
2024-10-25 13:47:17 +02:00
inherit (lib) getExe;
2024-10-25 18:13:30 +02:00
aa-alias-manager = pkgs.callPackage ./aa-alias-manager-package.nix { };
2024-10-25 13:47:17 +02:00
alias_dir = "/run/aliases.d";
2024-10-25 18:13:30 +02:00
in
{
2024-10-25 13:47:17 +02:00
config = {
security.apparmor.includes."tunables/alias.d/store" = ''
include if exists "${alias_dir}"
'';
systemd.services.aa-alias-setup = {
2024-10-25 18:13:30 +02:00
before = [ "apparmor.service" ];
requiredBy = [ "apparmor.service" ];
2024-10-25 13:47:17 +02:00
path = [ config.nix.package ]; # respect the users choice to use alternative nix implementations
2024-10-25 18:13:30 +02:00
2024-10-25 13:47:17 +02:00
serviceConfig = {
Type = "oneshot";
ExecStart = "${getExe aa-alias-manager} -o ${alias_dir} -p ${./aa-alias-patterns.json}";
};
};
};
}