Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

munnik
Copy link
Contributor

@munnik munnik commented Oct 15, 2024

#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;
  };
};

modules/sops/default.nix Outdated Show resolved Hide resolved
modules/sops/default.nix Outdated Show resolved Hide resolved
@Mic92
Copy link
Owner

Mic92 commented Oct 22, 2024

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

modules/sops/default.nix Outdated Show resolved Hide resolved
modules/sops/default.nix Outdated Show resolved Hide resolved
modules/sops/default.nix Outdated Show resolved Hide resolved
@munnik
Copy link
Contributor Author

munnik commented Oct 22, 2024

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

@Mic92
Copy link
Owner

Mic92 commented Oct 22, 2024

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

@Mic92
Copy link
Owner

Mic92 commented Oct 22, 2024

For a single test:

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

@munnik
Copy link
Contributor Author

munnik commented Oct 22, 2024

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

Done in a24e29e

…e 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;
  };
};
```

Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
@Mic92
Copy link
Owner

Mic92 commented Oct 23, 2024

@mergify queue

Copy link
Contributor

mergify bot commented Oct 23, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at a4c33bf

@mergify mergify bot merged commit a4c33bf into Mic92:master Oct 23, 2024
6 checks passed
@munnik
Copy link
Contributor Author

munnik commented Oct 23, 2024

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

akosnad added a commit to akosnad/nix-config that referenced this pull request Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants