formatting
This commit is contained in:
+53
-54
@@ -14,63 +14,62 @@ in
|
|||||||
imports = [ inputs.sops-nix.nixosModules.sops ];
|
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Define the homeModules that are used by flake-parts
|
flake.modules.homeManager.mysops =
|
||||||
# https://flake.parts/options/home-manager.html#opt-flake.modules.homeManager
|
{ config, pkgs, lib, ... }:
|
||||||
flake.modules.homeManager.mysops = { config, pkgs, lib, ... }:
|
let
|
||||||
let
|
cfg = config.mysops;
|
||||||
cfg = config.mysops;
|
in
|
||||||
in
|
{
|
||||||
{
|
imports = [
|
||||||
imports = [
|
# This import makes the sops config attribute available below
|
||||||
# This import makes the sops config attribute available below
|
inputs'.sops-nix.homeManagerModules.sops
|
||||||
inputs'.sops-nix.homeManagerModules.sops
|
];
|
||||||
];
|
|
||||||
|
|
||||||
options.mysops = {
|
options.mysops = {
|
||||||
hostSecretFile = lib.mkOption {
|
hostSecretFile = lib.mkOption {
|
||||||
description = "Path to the secrets file for this host. Used to create the edit-secrets script";
|
description = "Path to the secrets file for this host. Used to create the edit-secrets script";
|
||||||
type = lib.types.nullOr lib.types.str;
|
type = lib.types.nullOr lib.types.str;
|
||||||
default = null;
|
default = null;
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
my-sops = (inputs.self.wrappers.mySops.apply {
|
|
||||||
inherit pkgs;
|
|
||||||
sshKey = config.ssh.identityFile;
|
|
||||||
}).wrapper;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# Option definitions for the sops home-manager module:
|
|
||||||
# https://github.com/Mic92/sops-nix/blob/master/modules/home-manager/sops.nix
|
|
||||||
sops = {
|
|
||||||
defaultSopsFile = ../../keys/secrets.yaml;
|
|
||||||
defaultSopsFormat = "yaml";
|
|
||||||
age.sshKeyPaths = [ "${config.ssh.identityFile}" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
my-sops
|
|
||||||
(inputs.wrappers.lib.wrapPackage {
|
|
||||||
binName = "ls-secrets";
|
|
||||||
inherit pkgs;
|
|
||||||
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-eza;
|
|
||||||
args = [
|
|
||||||
"-T" "--follow-symlinks"
|
|
||||||
"${config.xdg.configHome}/sops-nix/secrets"
|
|
||||||
];
|
|
||||||
})
|
|
||||||
|
|
||||||
]
|
|
||||||
++ lib.optional (cfg.hostSecretFile != null) (inputs.wrappers.lib.wrapPackage {
|
|
||||||
binName = "edit-secrets";
|
|
||||||
inherit pkgs;
|
|
||||||
package = my-sops;
|
|
||||||
args = [ cfg.hostSecretFile ];
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
my-sops = (inputs.self.wrappers.mySops.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
sshKey = config.ssh.identityFile;
|
||||||
|
}).wrapper;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# Option definitions for the sops home-manager module:
|
||||||
|
# https://github.com/Mic92/sops-nix/blob/master/modules/home-manager/sops.nix
|
||||||
|
sops = {
|
||||||
|
defaultSopsFile = ../../keys/secrets.yaml;
|
||||||
|
defaultSopsFormat = "yaml";
|
||||||
|
age.sshKeyPaths = [ "${config.ssh.identityFile}" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
my-sops
|
||||||
|
(inputs.wrappers.lib.wrapPackage {
|
||||||
|
binName = "ls-secrets";
|
||||||
|
inherit pkgs;
|
||||||
|
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-eza;
|
||||||
|
args = [
|
||||||
|
"-T" "--follow-symlinks"
|
||||||
|
"${config.xdg.configHome}/sops-nix/secrets"
|
||||||
|
];
|
||||||
|
})
|
||||||
|
|
||||||
|
]
|
||||||
|
++ lib.optional (cfg.hostSecretFile != null) (inputs.wrappers.lib.wrapPackage {
|
||||||
|
binName = "edit-secrets";
|
||||||
|
inherit pkgs;
|
||||||
|
package = my-sops;
|
||||||
|
args = [ cfg.hostSecretFile ];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
flake.wrappers.mySops = inputs.wrappers.lib.wrapModule ({config, lib, wlib, ... }: {
|
flake.wrappers.mySops = inputs.wrappers.lib.wrapModule ({config, lib, wlib, ... }: {
|
||||||
options = {
|
options = {
|
||||||
|
|||||||
Reference in New Issue
Block a user