user services + wm in hjr, some qs workaround

This commit is contained in:
atagen 2025-10-29 12:27:35 +11:00
parent 9e3aa574eb
commit cb44e16d76
19 changed files with 393 additions and 361 deletions

View file

@ -2,60 +2,57 @@
config,
lib,
mainUser,
scope,
...
}:
{
options = {
quick = {
services =
with lib;
mkOption {
type = with types; attrsOf str;
default = { };
};
oneShots =
with lib;
mkOption {
type = with types; attrsOf str;
default = { };
};
scope "options.quick" {
services =
with lib;
mkOption {
type = with types; attrsOf str;
default = { };
};
oneShots =
with lib;
mkOption {
type = with types; attrsOf str;
default = { };
};
};
config = {
systemd.user.services =
builtins.mapAttrs (name: cmd: {
environment.PATH = lib.mkForce "/run/current-system/sw/bin:/run/current-system/sw/sbin:/etc/profiles/per-user/${mainUser}/bin:/etc/profiles/per-user/${mainUser}/sbin";
unitConfig = {
Description = "${name}";
Requires = [
"graphical-session.target"
];
After = [
"graphical-session.target"
"niri.target"
];
PartOf = [ "graphical-session.target" ];
};
serviceConfig = {
ExecStart = cmd;
};
wantedBy = [ "graphical-session.target" ];
}) config.quick.services
// builtins.mapAttrs (name: cmd: {
unitConfig = {
Description = "${name}";
Requires = [ "graphical-session.target" ];
After = [
"graphical-session.target"
"niri.target"
];
};
serviceConfig = {
ExecStart = cmd;
Type = "oneshot";
};
wantedBy = [ "graphical-session.target" ];
}) config.quick.oneShots;
};
}
// scope "config.user.systemd" {
enable = true;
services =
builtins.mapAttrs (name: cmd: {
environment.PATH = lib.mkForce "/run/current-system/sw/bin:/run/current-system/sw/sbin:/etc/profiles/per-user/${mainUser}/bin:/etc/profiles/per-user/${mainUser}/sbin";
unitConfig = {
Description = "${name}";
Requires = [
"graphical-session.target"
];
After = [
"graphical-session.target"
"niri.target"
];
PartOf = [ "graphical-session.target" ];
};
serviceConfig = {
ExecStart = cmd;
};
wantedBy = [ "graphical-session.target" ];
}) config.quick.services
// builtins.mapAttrs (name: cmd: {
unitConfig = {
Description = "${name}";
Requires = [ "graphical-session.target" ];
After = [
"graphical-session.target"
"niri.target"
];
};
serviceConfig = {
ExecStart = cmd;
Type = "oneshot";
};
wantedBy = [ "graphical-session.target" ];
}) config.quick.oneShots;
}