Cannot run makes on NixOS systems which configure programs.git #979
Labels
No labels
dependencies
difficulty::high
difficulty::low
difficulty::medium
good first issue
help wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
justin/makes#979
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
I am unable to run any makes commands in any NixOS system which uses NixOS to configure git (resulting in a read-only
~/.config/git/configfile).Reproduction Steps
~/.config/git/configor configure NixOS withprograms.git.config.*nix run github:fluidattacks/makes -- m github:fluidattacks/makes /helloWorld 1 2 3Expected Result
I should be able to run
makeson NixOS under a user with a read-onlyconfigor NixOS configuredconfig.I looked through the current documentation and issues and found nothing related to this problem.
@kraftnix Thank you so much for this report!
This is most likely related to this change:
github.com/fluidattacks/makes@0251c2a195 (diff-2c1c4ba253)@jpverde Can you please provide more context on the Git issue that forced us to to this and possible workarounds?
Thanks!
@kraftnix By the way, I'm guessing you want to keep your git config read only for reproducibility reasons?
This is how I configure git using NixOS and Home Manager: https://github.com/dsalaza4/env/blob/main/modules/pkgs/git/default.nix
The git config is still writable.
Curious, I am also using
home-managerto configure my.git/config, however the resulting config is a symlink to the nix store and is thus not writable.I remember the issue as well from other projects, here is the related
nixpkgsissue: https://github.com/NixOS/nixpkgs/issues/169193I would prefer to keep it read-only for reproducibility reasons. I also am not a fan of tools reconfiguring my settings globally, so if we could find a solution which keeps the git config changes project local that would be ideal.
nix run github:fluidattacks/makes -- github:fluidattacks/makes@main /helloWorld 1 2 3, it works properly for me._add_safe_directoryhas, I get the error you reported:_add_safe_directoryfunction for me. 🤔_add_safe_directory:github.com/fluidattacks/makes@d24478d1e4/src/cli/main/cli.py (L122)I think I should be reaching the function here:github.com/fluidattacks/makes@d24478d1e4/src/cli/main/cli.py (L130)but for some reason i don't?@jpverde
@kraftnix Hey!
Were you able to find a solution for this?
Unfortunately I never did seem to find a decent solution.
It appears I worked around it by setting
git configoptions from within a script that needed to use git / whenever I ran into this issue.Something like:
This is definitely a bad workaround but it's been working in my CI since so I haven't come back to this issue.
@kraftnix Oh wait a moment, this looks like a different problem!
makeScriptdoes not inherit the$HOMEenvar used by git to get its global configs.If you want to use your global git configurations from a
makeScriptcontext, you can use the$HOME_IMPUREenvar like this:HOME="${HOME_IMPURE}" git ...In the above script it is a different problem indeed. But
nix run github:fluidattacks/makes -- m github:fluidattacks/makes /helloWorld 1 2 3still fails with the same error as before if I configured my global git config with home-manager or NixOS.yeah, just tacking on on this one, editing users' global config leaves a pretty terrible taste in the mouth of the evaluator. took me a while to even figure out what was going on here.
my guess here is that there's something a bit broken about your "using stable nix" checks. i'm executing it from flakes (
nix run -- github:fluidattacks/makes github:fluidattacks/makes) and it's trying to run that global config edit, which it shouldn't need to do.Hi everyone!
A fix for this has been merged: https://github.com/fluidattacks/makes/pull/1165/files
Make sure you update to the latest version.
Let me know if things work for you now.
I had another look at the issue.
The
mainbranch seems to resolve the git config issues, as initially reportedHappy to close the issue now.