Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home-manager services have an issue on nixpkgs/staging-next (update 2022-04-05: now on the main branch) #2846

Closed
1 task done
fabianhjr opened this issue Mar 28, 2022 · 6 comments · Fixed by #2867
Closed
1 task done
Assignees
Labels

Comments

@fabianhjr
Copy link

fabianhjr commented Mar 28, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Issue description

Under staging-next (plus gcc_11 and binutils-2.38 as stdenv, plus some not yet upstreamed changes to some unrelated applications) home-manager emacs/gpg-agent services fail to build; think it might be related to the systemd version bump on staging-next (to v250) though currently building on top of staging-next.

these 5 derivations will be built:
  /nix/store/2fhxgn903hrlv3i54mv384qi7jxf0yzw-gpg-agent.service.drv
  /nix/store/jf15hhmlgsr87c93w4944xadwddb8hz2-gpg-agent.socket.drv
  /nix/store/s5qbnd7pn0v7c318hwvcnbi8b2k2cxkz-emacs.service.drv
  /nix/store/y22vdlshg77cdn477cd02bv0bph3mvv7-home-manager-files.drv
  /nix/store/7cj8jabyvswnm43fr6blasxvzaz7p7l2-home-manager-generation.drv
building '/nix/store/s5qbnd7pn0v7c318hwvcnbi8b2k2cxkz-emacs.service.drv'...
building '/nix/store/2fhxgn903hrlv3i54mv384qi7jxf0yzw-gpg-agent.service.drv'...
building '/nix/store/jf15hhmlgsr87c93w4944xadwddb8hz2-gpg-agent.socket.drv'...
error: builder for '/nix/store/s5qbnd7pn0v7c318hwvcnbi8b2k2cxkz-emacs.service.drv' failed to produce output path for output 'out' at '/nix/store/s5qbnd7pn0v7c318hwvcnbi8b2k2cxkz-emacs.service.drv.chroot/nix/store/zcqmh2caqkdfrqvy6pkdj1q455wmjp18-emacs.service'
error: builder for '/nix/store/2fhxgn903hrlv3i54mv384qi7jxf0yzw-gpg-agent.service.drv' failed to produce output path for output 'out' at '/nix/store/2fhxgn903hrlv3i54mv384qi7jxf0yzw-gpg-agent.service.drv.chroot/nix/store/9d9384sqk059g3gyp9wy2g3yyrfv79sw-gpg-agent.service'
error: builder for '/nix/store/jf15hhmlgsr87c93w4944xadwddb8hz2-gpg-agent.socket.drv' failed to produce output path for output 'out' at '/nix/store/jf15hhmlgsr87c93w4944xadwddb8hz2-gpg-agent.socket.drv.chroot/nix/store/mamxhinqq6dcd795wvlgjrmphr8qqf2f-gpg-agent.socket'
error: 3 dependencies of derivation '/nix/store/y22vdlshg77cdn477cd02bv0bph3mvv7-home-manager-files.drv' failed to build
error: 1 dependencies of derivation '/nix/store/7cj8jabyvswnm43fr6blasxvzaz7p7l2-home-manager-generation.drv' failed to build

Inverstigating the issue, will attempt to bisect the cause.

Maintainer CC

No response

System information

- system: `"x86_64-linux"`
 - host os: `Linux 5.17.0, NixOS, 22.05 (Quokka)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.7.0`
 - channels(root): `"nixos, nixos-small"`
 - channels(fabian): `"home-manager, nixos-19.03-19.03, nixos-19.09-19.09, nixos-20.03-20.03, nixos-20.09-20.09, nixos-21.05-21.05, nixos-21.11-21.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Though, as mentioned on staging-next + gcc_11 + binutils_2_38:

cat /proc/version                                                                                  12s  Sun 27 Mar 2022 10:14:53 PM CST
Linux version 5.17.0 (nixbld@localhost) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.38) #1-NixOS SMP PREEMPT Sun Mar 20 20:14:17 UTC 2022
@fabianhjr fabianhjr added bug triage Issues or feature request that have not been triaged yet labels Mar 28, 2022
@yu-re-ka
Copy link
Contributor

yu-re-ka commented Apr 2, 2022

diff --git a/modules/systemd.nix b/modules/systemd.nix
index cd5b30ed..5af892ee 100644
--- a/modules/systemd.nix
+++ b/modules/systemd.nix
@@ -38,11 +38,14 @@ let
 
       # Needed because systemd derives unit names from the ultimate
       # link target.
-      source = pkgs.writeTextFile {
-        name = pathSafeName;
+      source = (pkgs.runCommand "unit-${pathSafeName}" {
+        preferLocalBuild = true;
+        allowSubstitutes = false;
         text = toSystemdIni serviceCfg;
-        destination = lib.escapeShellArg "/${filename}";
-      } + "/${filename}";
+      } ''
+        mkdir -p $out
+        echo -n "$text" > $out/${lib.escapeShellArg filename}
+      '') + "/${filename}";
 
       wantedBy = target: {
         name = "systemd/user/${target}.wants/${filename}";

@andrevmatos
Copy link

staging-next got merged to master, and nixos-unstable-small is already broken; it seems any user's systemd unit triggers this

@berbiche berbiche removed the triage Issues or feature request that have not been triaged yet label Apr 5, 2022
@fabianhjr
Copy link
Author

FYI, @yu-re-ka patch works like a charm, forgot to report back.

@fabianhjr fabianhjr changed the title home-manager services have an issue on nixpkgs/staging-next home-manager services have an issue on nixpkgs/staging-next (update 2022-04-05: now on the main branch) Apr 5, 2022
@VergeDX
Copy link
Contributor

VergeDX commented Apr 6, 2022

Same issues at hm's release-21.11 + nixos-unstable.
So I made a fork with @yu-re-ka 's fork for temporary use.
Waiting for someone open PR for fixing.

@yu-re-ka
Copy link
Contributor

yu-re-ka commented Apr 6, 2022

Waiting for someone open PR for fixing.

If everyone waits for someone else to do that we can wait a long time :p
Like, anyone feel free to open a PR with the diff I posted above.

@andrevmatos
Copy link

My take: https://github.com/nix-community/home-manager/pull/2867/files#issuecomment-1090345033

diff --git a/modules/systemd.nix b/modules/systemd.nix
index cd5b30ed..0be586d7 100644
--- a/modules/systemd.nix
+++ b/modules/systemd.nix
@@ -41,7 +41,7 @@ let
       source = pkgs.writeTextFile {
         name = pathSafeName;
         text = toSystemdIni serviceCfg;
-        destination = lib.escapeShellArg "/${filename}";
+        destination = "/${filename}";
       } + "/${filename}";
 
       wantedBy = target: {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants