mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 12:19:07 +00:00
programs/gnome-session: set session systemd user units as part of NixOS
While it is nice to have it as part of the desktop session package, we're missing features which requires reimplementing parts of the systemd-lib anyways. We can always have this later once this is upstreamed into nixpkgs where one could modify systemd-lib to split the unit generation step. Right now, not willing to do that.
This commit is contained in:
parent
7b352c9ea4
commit
929d3968ad
@ -159,6 +159,11 @@ in
|
|||||||
(_: session:
|
(_: session:
|
||||||
session.sessionPackage)
|
session.sessionPackage)
|
||||||
cfg.sessions;
|
cfg.sessions;
|
||||||
|
|
||||||
|
sessionSystemdUnits = lib.mapAttrsToList
|
||||||
|
(_: session:
|
||||||
|
session.systemdUserUnits)
|
||||||
|
cfg.sessions;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Install all of the desktop session files.
|
# Install all of the desktop session files.
|
||||||
@ -169,7 +174,8 @@ in
|
|||||||
environment.pathsToLink = [ "/share/gnome-session" ];
|
environment.pathsToLink = [ "/share/gnome-session" ];
|
||||||
|
|
||||||
# Import those systemd units from gnome-session as well.
|
# Import those systemd units from gnome-session as well.
|
||||||
systemd.packages = [ cfg.package ] ++ sessionPackages;
|
systemd.packages = [ cfg.package ];
|
||||||
|
systemd.user.units = lib.mkMerge sessionSystemdUnits;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -529,7 +529,6 @@ rec {
|
|||||||
* gnome-session `.session` file.
|
* gnome-session `.session` file.
|
||||||
* The gnome-session systemd target drop-in file.
|
* The gnome-session systemd target drop-in file.
|
||||||
* The components `.desktop` file.
|
* The components `.desktop` file.
|
||||||
* The components' systemd unit files.
|
|
||||||
'';
|
'';
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
};
|
};
|
||||||
@ -645,19 +644,6 @@ rec {
|
|||||||
displayScripts.${display})
|
displayScripts.${display})
|
||||||
config.display;
|
config.display;
|
||||||
|
|
||||||
installSystemdUserUnits = lib.mapAttrsToList
|
|
||||||
(n: v:
|
|
||||||
if (v ? overrideStrategy && v.overrideStrategy == "asDropin") then ''
|
|
||||||
(
|
|
||||||
unit="${v.unit}/${n}"
|
|
||||||
unit_filename=$(basename "$unit")
|
|
||||||
install -Dm0644 "$unit" "$out/share/systemd/user/''${unit_filename}.d/session.conf"
|
|
||||||
)
|
|
||||||
'' else ''
|
|
||||||
install -Dm0644 "${v.unit}/${n}" -t "$out/share/systemd/user"
|
|
||||||
'')
|
|
||||||
config.systemdUserUnits;
|
|
||||||
|
|
||||||
installDesktops = lib.mapAttrsToList
|
installDesktops = lib.mapAttrsToList
|
||||||
(_: p: ''
|
(_: p: ''
|
||||||
install -Dm0644 ${p.desktopPackage}/share/applications/*.desktop -t $out/share/applications
|
install -Dm0644 ${p.desktopPackage}/share/applications/*.desktop -t $out/share/applications
|
||||||
@ -684,9 +670,6 @@ rec {
|
|||||||
|
|
||||||
${lib.concatStringsSep "\n" installDesktopSessions}
|
${lib.concatStringsSep "\n" installDesktopSessions}
|
||||||
|
|
||||||
${lib.concatStringsSep "\n" installSystemdUserUnits}
|
|
||||||
mkdir -p "$out/lib/systemd" && ln -sfn "$out/share/systemd/user" "$out/lib/systemd/user"
|
|
||||||
|
|
||||||
${lib.concatStringsSep "\n" installDesktops}
|
${lib.concatStringsSep "\n" installDesktops}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user