khuedoan/homelab

make tools -> repository path is not owned by current user

east4ming opened this issue · 6 comments

Describe the bug

make tools -> repository path is not owned by current user

❯ make tools       
error:
       … while fetching the input 'git+file:///home/casey/projects/homelab'

       error: opening Git repository '"/home/casey/projects/homelab"': repository path '/home/casey/projects/homelab' is not owned by current user
make: *** [Makefile:30: tools] Error 1

To reproduce

Steps to reproduce the behavior:

  1. Run make tools use a non-root linux user and a git latest version

Expected behavior

can run.

Logs and screenshots

❯ make tools       
error:
       … while fetching the input 'git+file:///home/casey/projects/homelab'

       error: opening Git repository '"/home/casey/projects/homelab"': repository path '/home/casey/projects/homelab' is not owned by current user
make: *** [Makefile:30: tools] Error 1

Additional context

no

Workaround

change Makefile:

tools add:

tools:
	@docker run \
       ...
		--volume ${HOME}/.gitconfig:/root/.gitconfig \

and ${HOME}/.gitconfig like this:

[user]
    name = <your name>
    email = <your email>
[safe]
    directory = *

Using Docker as an abstraction to wrap dependencies seems a bit leaky and has caused several problems (e.g. #139, #165), including this one 😅 I'm considering removing the Docker wrapper and using only Nix as the dependency manager for the project instead (I’ve rarely used the Docker wrapper in the past few years), but not everyone has Nix installed 🤔

Using Docker as an abstraction to wrap dependencies seems a bit leaky and has caused several problems, including this one 😅 I'm considering removing the Docker wrapper and using only Nix as the dependency manager for the project instead (I’ve rarely used the Docker wrapper in the past few years), but not everyone has Nix installed 🤔

Yes, totally agree with you. I switched to nix after hitting a few brick walls with docker due to permissions, and it's just a matter of making sure users join the nix group. Nix is great for development environments.

Just curious, are you using Nix on NixOS or Nix on another distro? If it's the latter, how was the experience? (I jumped head first into NixOS, so I don't know if the Nix UX on other distros is as smooth)

The Docker wrapper has been removed in 47aefc5

Related decision record: https://homelab.khuedoan.com/reference/architecture/decision-records/#remove-the-docker-wrapper-for-nix-shell

Thanks for reporting the issue!

Just curious, are you using Nix on NixOS or Nix on another distro? If it's the latter, how was the experience? (I jumped head first into NixOS, so I don't know if the Nix UX on other distros is as smooth)

I use ubuntu 24.04, and I work very well most of the time, but there are the following points to pay attention to:

  1. Add your normal users to the group corresponding to nix.
  2. Running nix develop directly will give an error, so you need to add 2 flags to enable nix commands and flakes features.
  3. My running terraform to create k8s secrets has always failed, which may be caused by file permissions, but I haven't found the root cause and solution yet.

Thanks for the insight!