Etc/nixos/ folder as user because git

Is there other proper solution for me to get git SSH working on /etc/nixos/ folder.

When it is on root as default I can’t get git/ash to connect to repo due SSH pub key authentication issue, but when I make that folder only to user it works, but I drop some security on it?

This is because I want to push my configs to repo backup feature so I would prefer default folder structure and permissions with ash and key to work.

This i haven’t figured out yet

You can keep anything you care about somewhere else and copy it into /etc/nixos before rebuilding. I do that and I think probably lots of other people do too?

1 Like

I think most people use the nixos-config NIX_PATH entry, or the --flake arg of nixos-rebuild. nh also has features for using a non-default location.

You can change the permissions of the directory, of course, but IMO having random directories outside of /home owned by non-system users is dirty.

2 Likes

It is dirty, but works now untill I get better one. Thank you for suggestions and I will see these options too and test what could be a best solution

Back when I used NixOS, I replaced the entries in /etc/nixos with symlinks to wherever I wanted to manage the repositories

2 Likes

Good option to test thank you