-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract ssh identity management into separate module
- Loading branch information
Showing
4 changed files
with
104 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
|
||
cfg = config.custom.programs.logseq; | ||
|
||
sshKey = "id_logseq"; | ||
sshPubKey = "${sshKey}.pub"; | ||
|
||
in | ||
|
||
{ | ||
options = { | ||
custom.programs.logseq = { | ||
enable = mkEnableOption "Logseq"; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
|
||
custom = { | ||
programs.ssh = { | ||
enable = true; | ||
identities = [ sshKey sshPubKey ]; | ||
}; | ||
roles.homeage.secrets = [ sshKey sshPubKey ]; | ||
}; | ||
|
||
home.packages = [ pkgs.logseq ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
|
||
cfg = config.custom.programs.ssh; | ||
|
||
inherit (config.custom.roles.homeage) secretsPath; | ||
sshDirectory = ".ssh"; | ||
mkFileEntry = identity: { | ||
name = "${sshDirectory}/${identity}"; | ||
value = { source = "${secretsPath}/${identity}"; }; | ||
}; | ||
|
||
in | ||
|
||
{ | ||
options = { | ||
custom.programs.ssh = { | ||
enable = mkEnableOption "SSH client"; | ||
|
||
identities = mkOption { | ||
type = with types; listOf str; | ||
default = [ ]; | ||
description = "SSH identities managed by homeage"; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
custom.roles.homeage.secrets = cfg.identities; | ||
home.file = listToAttrs (map mkFileEntry cfg.identities); | ||
programs.ssh.enable = true; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters