Skip to content

systemd: fix creation of user service unit files#2867

Merged
berbiche merged 2 commits intonix-community:masterfrom
andresilva:fix-systemd-services
Apr 7, 2022
Merged

systemd: fix creation of user service unit files#2867
berbiche merged 2 commits intonix-community:masterfrom
andresilva:fix-systemd-services

Conversation

@andresilva
Copy link
Copy Markdown
Contributor

@andresilva andresilva commented Apr 6, 2022

Description

Fix #2846, diff provided by @yu-re-ka.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

    • Added myself and the module files to .github/CODEOWNERS.

@andresilva andresilva requested a review from rycee as a code owner April 6, 2022 09:18
@andresilva andresilva force-pushed the fix-systemd-services branch from ec7e0fb to bdb34bd Compare April 6, 2022 11:20
@andrevmatos
Copy link
Copy Markdown

This seems to be caused by NixOS/nixpkgs#162246 , but I'm not a big fan of the runCommand approach, instead of the utilities

@andrevmatos
Copy link
Copy Markdown

Ok, I tested several options, and it seems the issue is caused because of double-applying escapeShellArg after above PR.
The fix therefore is even simpler:

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: {

wentasah added a commit to wentasah/home-manager that referenced this pull request Apr 6, 2022
@elizagamedev
Copy link
Copy Markdown
Contributor

It seems like this PR does not have the second, simpler fix, is this a mistake?

@berbiche berbiche force-pushed the fix-systemd-services branch from bdb34bd to 8ffe592 Compare April 7, 2022 05:19
@berbiche
Copy link
Copy Markdown
Member

berbiche commented Apr 7, 2022

Sorry @andresilva, I took the liberty to force push the "simpler" fix on your branch.

@berbiche berbiche merged commit 66ffa7a into nix-community:master Apr 7, 2022
wentasah added a commit to wentasah/nix-conf that referenced this pull request Apr 7, 2022
It contains a fix from
nix-community/home-manager#2867 (comment).

Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/07b941f0c45ac4af6732d96f4cb6142824eee3df' (2022-04-05)
  → 'github:wentasah/home-manager/7bf9f0cd90169f93fa581dcd8db971eb7aa60ce7' (2022-04-06)
@andresilva
Copy link
Copy Markdown
Contributor Author

@berbiche no worries, made sense to get this merged asap and simpler is better :)

jficz pushed a commit to jficz/home-manager that referenced this pull request Apr 7, 2022
* systemd: fix creation of user service unit files

* helix: fix failing test due to file output format change

Co-authored-by: Nicolas Berbiche <nicolas@normie.dev>
@genofire
Copy link
Copy Markdown

genofire commented Apr 8, 2022

Is there any new release in NixOS/nixpkgs planned? That release is really outdated (and without this patch broken now)

datakurre pushed a commit to datakurre/home-manager that referenced this pull request Apr 14, 2022
* systemd: fix creation of user service unit files

* helix: fix failing test due to file output format change

Co-authored-by: Nicolas Berbiche <nicolas@normie.dev>
@nixos-discourse
Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/builder-for-nix-store-failed-to-produce-output-path-nix-store-via-home-manager/18649/6

timokau added a commit to timokau/nixpkgs that referenced this pull request Apr 17, 2022
@timokau
Copy link
Copy Markdown
Contributor

timokau commented Apr 17, 2022

I have opened a nixpkgs PR: NixOS/nixpkgs#169084

teto pushed a commit to NixOS/nixpkgs that referenced this pull request Apr 17, 2022
@NorfairKing
Copy link
Copy Markdown

NorfairKing commented Jun 20, 2022

Could this be backported to release-22.05 and release-21.11?

EDIT: I found a better solution than to depend on a specific home-manager; depending on pkgs.home-manager.src

@teto teto mentioned this pull request Aug 22, 2022
7 tasks
teto pushed a commit to teto/home-manager that referenced this pull request Aug 22, 2022
* systemd: fix creation of user service unit files

* helix: fix failing test due to file output format change

Co-authored-by: Nicolas Berbiche <nicolas@normie.dev>
spacekookie pushed a commit to spacekookie/home-manager that referenced this pull request Feb 10, 2023
* systemd: fix creation of user service unit files

* helix: fix failing test due to file output format change

Co-authored-by: Nicolas Berbiche <nicolas@normie.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

8 participants