Compare commits

..

No commits in common. "4887e06117d49b607688e4e4cde5df9ff0c2ed5e" and "371fc984068696f308691a3608749a81e76c055e" have entirely different histories.

7 changed files with 22 additions and 42 deletions

View file

@ -29,14 +29,14 @@
gui.domain = "syncthing.${privateDomain}";
doBackups = true;
};
};
web-services = {
atuin = {
enable = true;
domain = "atuin.${privateDomain}";
};
};
web-services = {
filebrowser = {
enable = true;
domain = "files.${privateDomain}";

View file

@ -4,7 +4,7 @@
config = lib.mkIf config.custom.programs.git.enable {
sops.secrets =
config.custom.sops.secretsData.ssh-key
config.custom.sops.secrets.ssh-key
|> lib.mapAttrs' (
name: _: lib.nameValuePair "ssh-key/${name}" { path = "${config.home.homeDirectory}/.ssh/${name}"; }
);
@ -42,7 +42,7 @@
lazygit.enable = true;
ssh.matchBlocks =
config.custom.sops.secretsData.ssh-key
config.custom.sops.secrets.ssh-key
|> lib.mapAttrs (name: _: { identityFile = config.sops.secrets."ssh-key/${name}".path; });
};
};

View file

@ -25,7 +25,7 @@ in
type = self.lib.types.existingPath;
default = "${self}/users/${config.home.username}/@${osConfig.networking.hostName}/secrets.json";
};
secretsData = lib.mkOption {
secrets = lib.mkOption {
type = lib.types.anything;
default = cfg.secretsFile |> lib.readFile |> lib.strings.fromJSON;
};
@ -38,21 +38,11 @@ in
};
assertions =
(
config.sops.secrets
|> lib.attrNames
|> lib.map (secretPath: {
assertion = cfg.secretsData |> lib.hasAttrByPath (secretPath |> lib.splitString "/");
message = "Sops secret `${secretPath}` is used in a module but not defined in secrets.json";
})
)
++ (
lib.removeAttrs cfg.secretsData [ "sops" ]
|> lib.mapAttrsToListRecursive (path: _: path |> lib.concatStringsSep "/")
|> lib.map (secretPath: {
assertion = config.sops.secrets |> lib.hasAttr secretPath;
message = "Sops secret `${secretPath}` is defined in secrets.json but not used in any module";
})
);
assertion = cfg.secrets |> lib.hasAttrByPath (secretPath |> lib.splitString "/");
message = "Sops secret `${secretPath}` must be defined in secrets.json";
});
};
}

View file

@ -33,7 +33,7 @@ in
enable = lib.mkEnableOption "";
networks = lib.mkOption {
type = lib.types.listOf lib.types.nonEmptyStr;
default = config.custom.sops.secretsData.iwd |> lib.attrNames;
default = config.custom.sops.secrets.iwd |> lib.attrNames;
};
};
};

View file

@ -1,10 +1,10 @@
{ config, lib, ... }:
let
cfg = config.custom.web-services.atuin;
cfg = config.custom.services.atuin;
dataDir = "/var/lib/atuin";
in
{
options.custom.web-services.atuin = {
options.custom.services.atuin = {
enable = lib.mkEnableOption "";
domain = lib.mkOption {
type = lib.types.nonEmptyStr;

View file

@ -11,7 +11,7 @@ let
inherit (config.services.syncthing) dataDir;
useSopsSecrets = config.custom.sops.secretsData |> lib.hasAttr "syncthing";
useSopsSecrets = config.custom.sops.secrets |> lib.hasAttr "syncthing";
in
{
options.custom.services.syncthing = {

View file

@ -21,7 +21,7 @@ in
type = self.lib.types.existingPath;
default = "${self}/hosts/${config.networking.hostName}/secrets.json";
};
secretsData = lib.mkOption {
secrets = lib.mkOption {
type = lib.types.anything;
default = cfg.secretsFile |> lib.readFile |> lib.strings.fromJSON;
};
@ -36,21 +36,11 @@ in
};
assertions =
(
config.sops.secrets
|> lib.attrNames
|> lib.map (secretPath: {
assertion = cfg.secretsData |> lib.hasAttrByPath (secretPath |> lib.splitString "/");
message = "Sops secret `${secretPath}` is used in a module but not defined in secrets.json";
})
)
++ (
lib.removeAttrs cfg.secretsData [ "sops" ]
|> lib.mapAttrsToListRecursive (path: _: path |> lib.concatStringsSep "/")
|> lib.map (secretPath: {
assertion = config.sops.secrets |> lib.hasAttr secretPath;
message = "Sops secret `${secretPath}` is defined in secrets.json but not used in any module";
})
);
assertion = cfg.secrets |> lib.hasAttrByPath (secretPath |> lib.splitString "/");
message = "Sops secret `${secretPath}` must be defined in secrets.json";
});
};
}