sops-nix icon indicating copy to clipboard operation
sops-nix copied to clipboard

Does `nix-sops` support using it as a module in `home-manager` configuration?

Open NobbZ opened this issue 3 years ago • 5 comments

If it is currently supported, please offer documentation about how to set it up.

If it is currently not supported, please consider supporting it.

NobbZ avatar Jan 14 '21 07:01 NobbZ

There is no home-manager module right now, but I would accept pull requests if they also come with a NixOS test for regression testing.

Mic92 avatar Jan 14 '21 08:01 Mic92

How would this look? I believe most home-manager modules are implemented in home-manager itself, rather than downstream.

A flakes implementation would probably need to output something like a homeManagerModule, but that's not an official output spec, and it'd be the first such. Home manager itself currently is also just starting to support flakes, so I'm not sure how happy upstream would be to support something like that.

I'd like to see some code sharing between this and a potential home manager module, and I'm interested in implementing it, I'm just not sure how it would best fit. Is it maybe better to start this discussion upstream?

TLATER avatar Feb 06 '21 21:02 TLATER

How would this look? I believe most home-manager modules are implemented in home-manager itself, rather than downstream.

A flakes implementation would probably need to output something like a homeManagerModule, but that's not an official output spec, and it'd be the first such. Home manager itself currently is also just starting to support flakes, so I'm not sure how happy upstream would be to support something like that.

I am aware of one flake-based home-manager module: https://github.com/vlaci/nix-doom-emacs#getting-started I would open an issue within the home-manager project to specify what flake attribute. Ideally this would be document somewhere in the README/documentation to manifest a standard.

I'd like to see some code sharing between this and a potential home manager module, and I'm interested in implementing it, I'm just not sure how it would best fit. Is it maybe better to start this discussion upstream?

I think home-manager also has activation scripts that can be hooked. One can obviously not use the host ssh key because it won't be readable to the user. However one can specify alternative ssh key directories i.e. $HOME/.ssh/id_rsa if it does not have password protection or a gnupg directory. For integration tests the home-assistant module could be added to a nixos configuration and tested in a nixos test.

Mic92 avatar Feb 06 '21 22:02 Mic92

I think the issue opened by @berbiche answers my question then :)

I agree on $HOME/.ssh/id_rsa (with a configuration option), since this is a home configuration after all, those should be represented by the user ssh keys.

TLATER avatar Feb 07 '21 01:02 TLATER

I think the issue opened by @berbiche answers my question then :)

I agree on $HOME/.ssh/id_rsa (with a configuration option), since this is a home configuration after all, those should be represented by the user ssh keys.

Many people will have a password for this file so, which we don't support. Hence I would force the user to make a decision which key to use, so they could do a different key in theory. Also using gnupg becomes more attractive again since the user running the activation and the owner of the gnupg directory should match in this case.

Mic92 avatar Feb 07 '21 07:02 Mic92