home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

systemd: make unit files with `runCommand`

Open jsoo1 opened this issue 3 years ago • 4 comments

Description

Fixes #3217

Avoids errors of the following sort when /tmp is mounted on a different drive.

mv: inter-device move failed: '/tmp/nix-build-emacs.service.drv-0/.attr-1' to "/nix/store/xyz-emacs.service'/emacs.service'"; unable to remove target: Permission denied

Checklist

  • [x] Change is backwards compatible.

  • [x] Code formatted with ./format.

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

  • [x] Test cases updated/added. See example.

  • [x] 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.

jsoo1 avatar Sep 09 '22 23:09 jsoo1

nix-shell --pure tests -A run.all failed for me??

Edit: Had to add -I nixpkgs=<path to nixpkgs>

Edit: Failed with error: attribute 'shellDryRun' missing, at .../modules/programs/bash.nix:12:9

Edit: switched to nixpkgs revision eb1f0837a05 and that seemed to work.

jsoo1 avatar Sep 09 '22 23:09 jsoo1

I believe this change is backwards-compatible but I am not 100% certain.

Edit: The compatibility would be modulo any changes to runCommand but I don't know the whole history of it.

jsoo1 avatar Sep 09 '22 23:09 jsoo1

Hm. I'm not 100% sure this actually fixes the issue. Simply bumping home-manager did the trick.

That said, I think this might be good to do?

jsoo1 avatar Sep 10 '22 00:09 jsoo1

Hmm, I think if this is an issue with writeTextFile then it needs to be fixed in Nixpkgs. Although, I'm not sure what could cause it. Seems like writeTextFile attempted to write the target file twice (the second time being after making Nix store read-only)? Quite curious.

rycee avatar Sep 10 '22 09:09 rycee

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar Dec 10 '22 02:12 stale[bot]