diff --git a/modules/programs/sops.nix b/modules/programs/sops.nix index 1e9e91d..a8b1929 100644 --- a/modules/programs/sops.nix +++ b/modules/programs/sops.nix @@ -14,63 +14,62 @@ in imports = [ inputs.sops-nix.nixosModules.sops ]; }; - # Define the homeModules that are used by flake-parts - # https://flake.parts/options/home-manager.html#opt-flake.modules.homeManager - flake.modules.homeManager.mysops = { config, pkgs, lib, ... }: - let - cfg = config.mysops; - in - { - imports = [ - # This import makes the sops config attribute available below - inputs'.sops-nix.homeManagerModules.sops - ]; + flake.modules.homeManager.mysops = + { config, pkgs, lib, ... }: + let + cfg = config.mysops; + in + { + imports = [ + # This import makes the sops config attribute available below + inputs'.sops-nix.homeManagerModules.sops + ]; - options.mysops = { - hostSecretFile = lib.mkOption { - description = "Path to the secrets file for this host. Used to create the edit-secrets script"; - type = lib.types.nullOr lib.types.str; - 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}" ]; + options.mysops = { + hostSecretFile = lib.mkOption { + description = "Path to the secrets file for this host. Used to create the edit-secrets script"; + type = lib.types.nullOr lib.types.str; + default = null; }; - - 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, ... }: { options = {