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

bug: home.file doesn't work when using home-manager as a module in a nixos system #5519

Open
2 tasks done
bonds opened this issue Jun 9, 2024 · 4 comments
Open
2 tasks done
Assignees
Labels
bug status: stale triage Issues or feature request that have not been triaged yet

Comments

@bonds
Copy link

bonds commented Jun 9, 2024

Are you following the right branch?

  • My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • I have searched the existing issues

Issue description

home.file won't create a file and symlink when I use home-manager as a module in a nixos config and running sudo nixos-rebuild switch --flake . The rebuild runs fine except for home.file, which fails quietly. I note that home.packages and other home dot config works fine, so home.nix does seem to be operating in general, it's just home.file that's not working.

The specific nix config in question can be seen here: https://github.com/bonds/dotfiles/tree/58bdcaffaf5cd40eee1796c708effd28b0807b4e/.config/nix

Maintainer CC

No response

System information

~/.config/nix on  main 
at 14:03:03 🆇 1 ❄️ ❯  nix-shell -p nix-info --run "nix-info -m"
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.32, NixOS, 24.05 (Uakari), 24.05.20240606.9b5328b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - nixpkgs: `/nix/store/x887lkxvgnrrcfgrzz351qhfvvrkm80x-source`
@bonds bonds added bug triage Issues or feature request that have not been triaged yet labels Jun 9, 2024
@kbwhodat
Copy link

I'm facing the same issue as well, but for nix-darwin. I thought I solved it by downgrading versions. But no luck. Are there any workaround for this?

@bonds
Copy link
Author

bonds commented Jul 3, 2024

I think I found something. Manually running the home manager script generated after running nixos-rebuild switch I see this:

at 12:16:49 ❄️ ❯  /nix/store/7i0d80cp7l2f3kzphp2pgl75f8k9bqal-hm-setup-env /nix/store/3wxnh4nrqifbxswim1awibrcssxg040v-home-manager-generation
Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Existing file '/home/scott/.config/autostart/ulauncher.desktop' is in the way of '/nix/store/gsskllgsxxhikiv109lybnv6bgk12bzm-home-manager-files/.config/autostart/ulauncher.desktop'
Existing file '/home/scott/.local/share/applications/dwarf.desktop' is in the way of '/nix/store/gsskllgsxxhikiv109lybnv6bgk12bzm-home-manager-files/.local/share/applications/dwarf.desktop'
Please do one of the following:
- Move or remove the above files and try again.
- In standalone mode, use 'home-manager switch -b backup' to back up
  files automatically.
- When used as a NixOS or nix-darwin module, set
    'home-manager.backupFileExtension'
  to, for example, 'backup' and rebuild.

It seems that home manager errors out without reporting the problem to nixos-rebulid, so it's silently failing. I am able to fix the problem as it suggested, and then when I run nixos-rebuild switch, the home.files module works fine. So I think the bug here is the failing silently part...it would be better if home manager told nixos that there was an error and what the problem is, so that nixos-rebuild switch can error out and report the problem, rather than partially working and partially not working.

@Vortriz
Copy link

Vortriz commented Jul 16, 2024

I am facing a similar issue. I want add something to the end of .bashrc by

home.file.".bashrc".text = ''
    eval "$(direnv hook bash)"
'';

There are no errors in nixos-rebuild and the contents are also not appended to .bashrc.

EDIT: I disabled bash using programs.bash.enable = false; and now it did append. So is this taking precedence over home.file?

Copy link

stale bot commented Oct 30, 2024

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 you are the original author of the issue

  • 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 not the original author of the 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.

Memorandum on closing issues

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.

@stale stale bot added the status: stale label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status: stale triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

No branches or pull requests

6 participants