Merge pull request #30 from cole-h/cond-module

modules/age: build local rage if pkgs.rage is older than 0.5.0
This commit is contained in:
Ryan Mulligan 2021-03-01 14:08:09 -08:00 committed by GitHub
commit 9eb981eeb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,12 @@ with lib;
let
cfg = config.age;
rage = pkgs.callPackage ../pkgs/rage.nix {};
# we need at least rage 0.5.0 to support ssh keys
rage =
if lib.versionOlder pkgs.rage.version "0.5.0"
then pkgs.callPackage ./rage.nix { }
else pkgs.rage;
ageBin = "${rage}/bin/rage";
users = config.users.users;
@ -71,7 +76,8 @@ let
};
};
});
in {
in
{
options.age = {
secrets = mkOption {
type = types.attrsOf secretType;
@ -82,7 +88,8 @@ in {
};
sshKeyPaths = mkOption {
type = types.listOf types.path;
default = if config.services.openssh.enable then
default =
if config.services.openssh.enable then
map (e: e.path) (lib.filter (e: e.type == "rsa" || e.type == "ed25519") config.services.openssh.hostKeys)
else [ ];
description = ''