Open khlopkov opened 10 months ago
@baloo from the linked issue's thread suggested adding this activation script into home-manager's configuration:
home.activation.linkSystemd = let
inherit (lib) hm;
in hm.dag.entryBefore [ "reloadSystemd" ] (''
find $HOME/.config/systemd/user/ \
-type l \
-exec bash -c "readlink {} | grep -q $HOME/.nix-profile/share/systemd/user/" \; \
-delete
find $HOME/.nix-profile/share/systemd/user/ \
-type f -o -type l \
-exec ln -s {} $HOME/.config/systemd/user/ \;
'');
Is it possible to merge something similar to the home-manager master branch?
The decision above, LGTM, because it should replace only those files controlled by Home Manager. But it will also replace custom services declared by user via home-manager. Also, this script should fail in case when user manually (not by Home Manager) added a .service
file into $HOME/.config/systemd/user/
and it is also declared in $HOME/.nix-profile/share/systemd/user/
. So I am not sure this specific script can be merged into a master branch.
I probably would like to contribute this change into Home Manager, but I think it needs some discussion before
Probably that's out of scope of the issue, but I think there are also some other files that should be linked into user's home: .application
files of packages, dbus interfaces and services
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Why does home-manager create some unit file links in ~/.config/systemd/user
, and some in ~/.nix-profile/share/systemd/user
?
Maybe it would be simpler to make it create everything in ~/.nix-profile/share/systemd/user
, then on non-NixOS, ~/.config/systemd/user
could be symlinked to it?
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Description
I use Home Manager on a non-NixOS (Debian in my case). Home Manager installed few systemd services with a packages into
~/.nix-profile/share/systemd/user/
from nixpkgs. Those services can not be found, for example this command:gives the following output:
I was able to fix this by adding a symlink from the
`~/.nix-profile/share/systemd
to the~/.config/systemd
:But there are few issues with this workaround:
It can be fixed by linking specific services into :
But in this case I have to symlink each required service
There is a similar issue: https://github.com/nix-community/home-manager/issues/4922, but I started a new one, because this thread is about more wide problem rather just a problem with a
xdg.portal.enable
option. Will it be possible to control over systemd.user services installed from nixpkgs on non NixOS environments?