programs: ensure things which depend on sound or wayland are ordered after it
This commit is contained in:
parent
3b73773169
commit
0c456d11d8
|
@ -34,7 +34,7 @@ in
|
|||
|
||||
services.dconf = {
|
||||
description = "dconf configuration database/server";
|
||||
partOf = [ "graphical-session" ];
|
||||
partOf = [ "default" ];
|
||||
command = "${lib.getLib cfg.package}/libexec/dconf-service";
|
||||
};
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ in
|
|||
|
||||
services.sway = {
|
||||
description = "sway: tiling wayland desktop environment";
|
||||
dependencyOf = [ "graphical-session" ];
|
||||
dependencyOf = [ "graphical-session" ]; #< TODO: should be safe to remove this now
|
||||
command = pkgs.writeShellScript "sway-start" ''
|
||||
# have to create these directories before launching sway so that they're available in the sandbox
|
||||
mkdir -p "$(dirname "$SWAYSOCK")"
|
||||
|
|
|
@ -224,10 +224,19 @@ let
|
|||
see `sane.users.<user>.services` for options;
|
||||
'';
|
||||
apply = lib.mapAttrs (svcName: svcCfg:
|
||||
# make every service whose program wants a dbus session actually depend on the dbus service,
|
||||
# to ensure ordering
|
||||
svcCfg // lib.optionalAttrs (svcName != "dbus" && builtins.elem "user" config.sandbox.whitelistDbus) {
|
||||
depends = [ "dbus" ];
|
||||
svcCfg // lib.optionalAttrs (builtins.tryEval svcCfg.description).success {
|
||||
# ensure service dependencies based on what a service's program whitelists.
|
||||
# only do this for the services which are *defined* by this program though (i.e. `scvCfg ? description`)
|
||||
# so as to avoid idioms like when sway adds `graphical-session.partOf = default`
|
||||
depends = svcCfg.depends
|
||||
++ lib.optionals (svcName != "dbus" && builtins.elem "user" config.sandbox.whitelistDbus) [
|
||||
"dbus"
|
||||
] ++ lib.optionals (svcName != "sway" && (config.sandbox.whitelistWayland || config.sandbox.whitelistX)) [
|
||||
# TODO: i shouldn't assume sway here: factor out a "partOf" like i do for "sound"
|
||||
"sway"
|
||||
] ++ lib.optionals ((!builtins.elem "sound" svcCfg.partOf) && config.sandbox.whitelistAudio) [
|
||||
"sound"
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user