user services: wrap with user PATH
notably, this alllows Fractal to open links with the preferred browser
This commit is contained in:
parent
46123719e9
commit
aa5b9e3db3
1
TODO.md
1
TODO.md
|
@ -1,6 +1,5 @@
|
||||||
## BUGS
|
## BUGS
|
||||||
- ringer (i.e. dino incoming call) doesn't prevent moby from sleeping
|
- ringer (i.e. dino incoming call) doesn't prevent moby from sleeping
|
||||||
- Fractal opens links with non-preferred web browser
|
|
||||||
- `nix` operations from lappy hang when `desko` is unreachable
|
- `nix` operations from lappy hang when `desko` is unreachable
|
||||||
- could at least direct the cache to `http://desko-hn:5001`
|
- could at least direct the cache to `http://desko-hn:5001`
|
||||||
- waybar isn't visible on moby until after `swaymsg reload`
|
- waybar isn't visible on moby until after `swaymsg reload`
|
||||||
|
|
|
@ -612,11 +612,7 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
sane.user.services = let
|
sane.user.services = let
|
||||||
sxmoPath = [
|
sxmoPath = [ package ] ++ package.runtimeDeps;
|
||||||
"/etc/profiles/per-user/colin" # so as to launch user-enabled applications (like g4music, etc)
|
|
||||||
"/run/wrappers" # for doas, and anything else suid
|
|
||||||
"/run/current-system/sw" # for things installed system-wide, especially flock
|
|
||||||
] ++ [ package ] ++ package.runtimeDeps;
|
|
||||||
sxmoEnvSetup = ''
|
sxmoEnvSetup = ''
|
||||||
# mimic my sxmo_init.sh a bit. refer to the actual sxmo_init.sh above for details.
|
# mimic my sxmo_init.sh a bit. refer to the actual sxmo_init.sh above for details.
|
||||||
# the specific ordering, and the duplicated profile sourcing, matters.
|
# the specific ordering, and the duplicated profile sourcing, matters.
|
||||||
|
|
|
@ -88,7 +88,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
# if we're the default user, inherit whatever settings were routed to the default user
|
# if we're the default user, inherit whatever settings were routed to the default user
|
||||||
(mkIf config.default {
|
(mkIf config.default {
|
||||||
inherit (sane-user-cfg) fs persist environment;
|
inherit (sane-user-cfg) fs persist environment;
|
||||||
services = lib.mapAttrs (_: lib.mkMerge) sane-user-cfg.services;
|
services = lib.mapAttrs (_: lib.mkMerge) sane-user-cfg.services;
|
||||||
|
@ -110,12 +110,20 @@ let
|
||||||
lib.concatStringsSep "\n" env;
|
lib.concatStringsSep "\n" env;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
fs = lib.mkMerge (mapAttrsToList (name: value:
|
fs = lib.mkMerge (mapAttrsToList (serviceName: value:
|
||||||
let
|
let
|
||||||
# see: <repo:nixos/nixpkgs:nixos/lib/utils.nix>
|
# see: <repo:nixos/nixpkgs:nixos/lib/utils.nix>
|
||||||
# see: <repo:nix-community/home-manager:modules/systemd.nix>
|
# see: <repo:nix-community/home-manager:modules/systemd.nix>
|
||||||
cleanName = utils.systemdUtils.lib.mkPathSafeName name;
|
cleanName = utils.systemdUtils.lib.mkPathSafeName serviceName;
|
||||||
generatedUnit = utils.systemdUtils.lib.serviceToUnit name value;
|
generatedUnit = utils.systemdUtils.lib.serviceToUnit serviceName (value // {
|
||||||
|
environment = (value.environment or {}) // {
|
||||||
|
# replicate the default NixOS user PATH (omitting dirs which don't exist)
|
||||||
|
PATH = lib.removePrefix ":" (
|
||||||
|
(value.environment.PATH or "")
|
||||||
|
+ ":/run/wrappers/bin:/etc/profiles/per-user/${name}/bin:/run/current-system/sw/bin"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
});
|
||||||
#^ generatedUnit contains keys:
|
#^ generatedUnit contains keys:
|
||||||
# - text
|
# - text
|
||||||
# - aliases (IGNORED)
|
# - aliases (IGNORED)
|
||||||
|
@ -129,13 +137,13 @@ let
|
||||||
targetName = "${cleanName}.service"; # systemd derives unit name from symlink target
|
targetName = "${cleanName}.service"; # systemd derives unit name from symlink target
|
||||||
};
|
};
|
||||||
serviceEntry = {
|
serviceEntry = {
|
||||||
".config/systemd/user/${name}.service".symlink = symlinkData;
|
".config/systemd/user/${serviceName}.service".symlink = symlinkData;
|
||||||
};
|
};
|
||||||
wants = builtins.map (wantedBy: {
|
wants = builtins.map (wantedBy: {
|
||||||
".config/systemd/user/${wantedBy}.wants/${name}.service".symlink = symlinkData;
|
".config/systemd/user/${wantedBy}.wants/${serviceName}.service".symlink = symlinkData;
|
||||||
}) generatedUnit.wantedBy;
|
}) generatedUnit.wantedBy;
|
||||||
requires = builtins.map (requiredBy: {
|
requires = builtins.map (requiredBy: {
|
||||||
".config/systemd/user/${requiredBy}.requires/${name}.service".symlink = symlinkData;
|
".config/systemd/user/${requiredBy}.requires/${serviceName}.service".symlink = symlinkData;
|
||||||
}) generatedUnit.requiredBy;
|
}) generatedUnit.requiredBy;
|
||||||
in lib.mkMerge ([ serviceEntry ] ++ wants ++ requires)
|
in lib.mkMerge ([ serviceEntry ] ++ wants ++ requires)
|
||||||
) config.services);
|
) config.services);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user