Compare commits

...

2 commits

Author SHA1 Message Date
48df7d2533
fix cyclic dependencies in sysd 2024-10-27 13:57:57 +01:00
ec80dc24fb
fix race condition (i hope) 2024-10-25 18:13:30 +02:00

View file

@ -1,17 +1,33 @@
{ config, lib, pkgs, ... }: let {
inherit (lib) getExe; config,
aa-alias-manager = pkgs.callPackage ./aa-alias-manager-package.nix {}; lib,
pkgs,
...
}:
let
inherit (lib) getExe mkIf;
aa-alias-manager = pkgs.callPackage ./aa-alias-manager-package.nix { };
alias_dir = "/run/aliases.d"; alias_dir = "/run/aliases.d";
in { in
config = { {
config = mkIf config.security.apparmor.enable {
security.apparmor.includes."tunables/alias.d/store" = '' security.apparmor.includes."tunables/alias.d/store" = ''
include if exists "${alias_dir}" include if exists "${alias_dir}"
''; '';
systemd.services.aa-alias-setup = { systemd.services.aa-alias-setup = {
wantedBy = [ "apparmor.service" ]; after = [ "local-fs.target" ];
before = [ "apparmor.service" ];
requiredBy = [ "apparmor.service" ];
path = [ config.nix.package ]; # respect the users choice to use alternative nix implementations path = [ config.nix.package ]; # respect the users choice to use alternative nix implementations
unitConfig = {
Description = "Initialize alias rules required for AppArmor policies";
DefaultDependencies = "no";
ConditionSecurity = "apparmor";
};
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${getExe aa-alias-manager} -o ${alias_dir} -p ${./aa-alias-patterns.json}"; ExecStart = "${getExe aa-alias-manager} -o ${alias_dir} -p ${./aa-alias-patterns.json}";