Skip to content

Commit

Permalink
Merge pull request #47 from nlewo/allow-other-users
Browse files Browse the repository at this point in the history
Set safe.directory=*
  • Loading branch information
nlewo authored Jun 30, 2024
2 parents 75f74e5 + 90f9e3e commit 375938e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,21 @@
import ./nix/module-options-doc.nix (nixpkgsFor."${system}")
);
in {
overlays.default = final: prev: {
overlays.default = final: prev: let
# - safe.directory: this is to allow comin to fetch local repositories belonging
# to other users. Otherwise, comin fails with:
# Pull from remote 'local' failed: unknown error: fatal: detected dubious ownership in repository
# - core.hooksPath: to avoid Git executing hooks from a repository belonging to another user
gitConfigFile = final.writeTextFile {
name = "git.config";
text = ''
[safe]
directory = *
[core]
hooksPath = /dev/null
'';
};
in {
comin = final.buildGoModule rec {
pname = "comin";
version = "0.2.0";
Expand All @@ -35,7 +49,7 @@
buildInputs = [ final.makeWrapper ];
postInstall = ''
# This is because Nix needs Git at runtime by the go-git library
wrapProgram $out/bin/comin --prefix PATH : ${final.git}/bin
wrapProgram $out/bin/comin --set GIT_CONFIG_SYSTEM ${gitConfigFile} --prefix PATH : ${final.git}/bin
'';
};
};
Expand Down

0 comments on commit 375938e

Please sign in to comment.