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: programs.bat causes activation to fail #4826

Closed
2 tasks done
mcwitt opened this issue Dec 30, 2023 · 10 comments · Fixed by #5112
Closed
2 tasks done

bug: programs.bat causes activation to fail #4826

mcwitt opened this issue Dec 30, 2023 · 10 comments · Fixed by #5112
Assignees
Labels
bug triage Issues or feature request that have not been triaged yet

Comments

@mcwitt
Copy link
Contributor

mcwitt commented Dec 30, 2023

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

With programs.bat.enable = true, nixos-rebuild switch --flake . fails during activation with the following error:

Dec 29 16:43:20 xxxx hm-activate-matt[587149]: Activating batCache
Dec 29 16:43:20 xxxx hm-activate-matt[587870]: error: unexpected argument '--build' found
Dec 29 16:43:20 xxxx hm-activate-matt[587870]:   tip: to pass '--build' as a value, use '-- --build'
Dec 29 16:43:20 xxxx hm-activate-matt[587870]: Usage: bat <FILE>...
Dec 29 16:43:20 xxxx hm-activate-matt[587870]: For more information, try '--help'.

Maintainer CC

@lovesegfault

System information

- system: `"x86_64-linux"`
- host os: `Linux 6.1.69, NixOS, 24.05 (Uakari), 24.05.20231224.5f64a12`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.18.1`
- channels(root): `"nixos"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@mcwitt mcwitt added bug triage Issues or feature request that have not been triaged yet labels Dec 30, 2023
@zoriya
Copy link

zoriya commented Jan 20, 2024

Can confirm this issue. But running bat cache --build on the cli does work, so I don't understand why it fails.

@lovesegfault
Copy link
Contributor

lovesegfault commented Jan 20, 2024

I can't reproduce it

@zoriya
Copy link

zoriya commented Jan 20, 2024

This happens on latest unstable. Did you try with unstable too?

@Diti
Copy link

Diti commented Jan 30, 2024

This issue happens to break the post-activation steps of home-manager generations, following unstable Nixpkgs.
To be clearer, the error does occur with sudo nixos-rebuild switch (because it reloads systemd units), but there is no error with sudo nixos-rebuild build && sudo ./result/activate (because it doesn’t reload the home-manager units).

Strangely enough, on my particular system, I think the error mostly occurs when there’s a system-wide cudaSupport = true attribute set in the nixpkgs.config attribute in my configuration.nix; when I commented out this option, then, after rebooting, I didn’t seem to have this bat cache --build problem. @mcwitt, out of curiosity would you happen to also have this nixpkgs.config.cudaSupport option set to true?

$ cat /etc/systemd/system/home-manager-diti.service

[Unit]
After=nix-daemon.socket
Before=systemd-user-sessions.service
Description=Home Manager environment for diti
RequiresMountsFor=/home/diti
Wants=nix-daemon.socket

[Service]
Environment="LOCALE_ARCHIVE=/nix/store/hsa779ydi29sp4q2w7plgzhxmiv1n8qb-glibc-locales-2.38-27/lib/locale/locale-archive"
Environment="PATH=/nix/store/5idwbbv23b6vnqdicx97s3hsgrwwnj7j-coreutils-9.4/bin:/nix/store/4ajik70nplhkb8ndn3gqh7v0b09hmvg9-findutils-4.9.0/bin:/nix/store/6i00hdmzlj56qy500p5gb5v88wfj6nhg-gnugrep-3.11/bin:/nix/store/9zial3lqry9f7rsw31r7vs5p1mnb7lan-gnused-4.9/bin:/nix/store/3zwz5ywmrrh8m6nqzgw3glq6pilxcphq-systemd-255.2/bin:/nix/store/5idwbbv23b6vnqdicx97s3hsgrwwnj7j-coreutils-9.4/sbin:/nix/store/4ajik70nplhkb8ndn3gqh7v0b09hmvg9-findutils-4.9.0/sbin:/nix/store/6i00hdmzlj56qy500p5gb5v88wfj6nhg-gnugrep-3.11/sbin:/nix/store/9zial3lqry9f7rsw31r7vs5p1mnb7lan-gnused-4.9/sbin:/nix/store/3zwz5ywmrrh8m6nqzgw3glq6pilxcphq-systemd-255.2/sbin"
Environment="TZDIR=/nix/store/g4bk1chlkfw18f6zkljygxp3r4yi8m48-tzdata-2023d/share/zoneinfo"
X-StopIfChanged=false
ExecStart=/nix/store/cv17kn1r2d7im3bjkj4qca1ig0myn3s2-hm-setup-env /nix/store/6irsm5c1rcf24vl4f7diic262zz0vhhz-home-manager-generation
RemainAfterExit=yes
SyslogIdentifier=hm-activate-diti
TimeoutStartSec=5m
Type=oneshot
User=diti

[Install]
WantedBy=multi-user.target
$ /nix/store/cv17kn1r2d7im3bjkj4qca1ig0myn3s2-hm-setup-env /nix/store/6irsm5c1rcf24vl4f7diic262zz0vhhz-home-manager-generation

Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating createGpgHomedir
Activating linkGeneration
Cleaning up orphan links from /home/diti
No change so reusing latest profile generation 51
Creating home file links in /home/diti
Activating batCache
error: unexpected argument '--build' found

  tip: to pass '--build' as a value, use '-- --build'

Usage: bat <FILE>...

For more information, try '--help'.

@mcwitt
Copy link
Contributor Author

mcwitt commented Feb 4, 2024

@Diti

out of curiosity would you happen to also have this nixpkgs.config.cudaSupport option set to true?

hmm, I do not have nixpkgs.config.cudaSupport set to true in my system configuration. I do routinely use flakes (via nix shell/direnv, not in my hm configuration) that set this option to true when importing nixpkgs, but that's probably not related?

@philipwilk
Copy link

This has just started occuring for me as well even though I've been using unstable for months.
image

@aidalgol
Copy link
Contributor

aidalgol commented Mar 9, 2024

I've just started getting this with standalone home-manager, also tracking unstable.

@rycee
Copy link
Member

rycee commented Mar 9, 2024

Could somebody who has this issue check their activation script. It should have a line

run /nix/store/…/bin/bat cache --build

Could you check the version of bat, it should be included in the path or run the command with --version.

Also please run /nix/store/…/bin/bat cache --help. Hopefully some of the above will show what is going on.

@mcwitt
Copy link
Contributor Author

mcwitt commented Mar 9, 2024

I think I've figured out what's going on in my case: I have a directory ~/cache (which in my case was created by Steam).

When ~/cache exists, I can reproduce the failure of the command in the activation script:

$ touch cache
$ /nix/store/wc8yb1n2wbkflv66nqmx536xla2bq5gf-bat-0.24.0/bin/bat cache --build
error: unexpected argument '--build' found

After removing ~/cache, that command and the hm activation script finish successfully. It seems like the root of the issue is that the interpretation of bat cache differs depending on whether the path cache exists in the cwd.

Edit: this is a known issue with bat: sharkdp/bat#1726

@rycee
Copy link
Member

rycee commented Mar 9, 2024

Wow, that's pretty wild. Thanks for figuring it out @mcwitt 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants