Skip to content

Secret never builds #29

@TheSirC

Description

@TheSirC

Thank you for the secret management library !

When I try to use it in an option defined like the following :

{
  config,
  pkgs,
  lib,
  ...
}:
with lib; {
  options.perso.cache = mkEnableOption "the build cache offloading";
  config = mkIf config.perso.cache {
    secrix.system.secrets.cachixToken.encrypted.file = ../../secrix/secrets/cachix;
    environment = {
      systemPackages = with pkgs; [cachix];
      variables.CACHIX_AUTH_TOKEN = (import config.secrix.system.secrets.cachixToken.decrypted.path).ouroboros;
    };
   # Whatever
  };
}

I get the following error message error: path '/run/system-keys/cachixToken' does not exist when I do sudo nixos-rebuild --flake .#host --impure build

As if the function defined here is never called :

secrix/module.nix

Lines 402 to 418 in f783b03

systemKeysMainService = {
secrix-system-secrets = {
script = ''
${c "mkdir"} -p ${runKeyDir}
'';
wantedBy = [ "multi-user.target" ];
unitConfig.PropagatesStopTo = map (x: "secrix-system-secret-${x}.service") (attrNames cfg.system.secrets);
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
RuntimeDirectory = cfg.system.secretsDir.name;
RuntimeDirectoryMode = cfg.system.secretsDir.permissions;
User = cfg.system.secretsDir.user;
Group = cfg.system.secretsDir.group;
};
};
};

In my flake.nix I have :

 outputs = inputs @ {
    secrix,
    self,
    ...
  }: {
      # ...
      host.modules = [
        # Here
        secrix.nixosModules.default
        ./modules
      ];
      apps.x86_64-linux.secrix = secrix.secrix self;
}

and I import somewhere in the host configuration :

    secrix.hostIdentityFile = builtins.readFile (../. + "/secrix/keys/ed25519-default-secrix");
    secrix.hostPubKey = builtins.readFile (../. + "/secrix/keys/ed25519-default-secrix.pub");

Of course, the selected key can decrypt the secret (tested independently with age).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions