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

Allow to set uid and gid instead of owner and group.

Open munnik opened this issue 1 year ago • 1 comments

https://github.com/Mic92/sops-nix/issues/514

Allow to set uid and gid instead of owner and group. No checks will be performed when uid and gid are set.

sops.secrets = {
  sslCertificate = {
    sopsFile = ./secrets.yaml;
    owner = "";
    group = "";
    uid = config.containers."nginx".config.users.users."nginx".uid;
    gid = config.containers."nginx".config.users.groups."nginx".gid;
  };
  sslCertificateKey = {
    sopsFile = ./secrets.yaml;
    owner = "";
    group = "";
    uid = config.containers."nginx".config.users.users."nginx".uid;
    gid = config.containers."nginx".config.users.groups."nginx".gid;
  };
};

munnik avatar Oct 15 '24 23:10 munnik

Could you also add a simple secret example to our existing nixos test? Than we won't regress in future.

Mic92 avatar Oct 22 '24 09:10 Mic92

Could you also add a simple secret example to our existing nixos test? Than we won't regress in future.

I'm not sure how to run the tests?

$ nix-build  pkgs/sops-install-secrets/nixos-test.nix
error: cannot evaluate a function that has an argument without a value ('lib')
       Nix attempted to evaluate a function as a top level expression; in
       this case it must have its arguments supplied either by default
       values, or passed explicitly with '--arg' or '--argstr'. See
       https://nixos.org/manual/nix/stable/language/constructs.html#functions.

       at /home/munnik/Code/sops-nix/pkgs/sops-install-secrets/nixos-test.nix:1:3:

            1| { lib, testers }:
             |   ^
            2| let

munnik avatar Oct 22 '24 13:10 munnik

@munnik cd sops-nix; nix-build -A sops-install-secrets.tests

Mic92 avatar Oct 22 '24 16:10 Mic92

For a single test:

nix-build -A sops-install-secrets.tests.age-ssh-keys

Mic92 avatar Oct 22 '24 16:10 Mic92

Could you also add a simple secret example to our existing nixos test? Than we won't regress in future.

Done in https://github.com/Mic92/sops-nix/pull/637/commits/a24e29e38dca7e16b88bade2c5789de396dc7273

munnik avatar Oct 22 '24 21:10 munnik

@mergify queue

Mic92 avatar Oct 23 '24 07:10 Mic92

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at a4c33bfecb93458d90f9eb26f1cf695b47285243

mergify[bot] avatar Oct 23 '24 07:10 mergify[bot]

Thank you! Also, for the help and feedback. Learned a lot of new Nix things. :+1:

munnik avatar Oct 23 '24 10:10 munnik