Compare commits
5 commits
c2b36207f2
...
c31afa6e76
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c31afa6e76 | ||
|
|
8cecf9c5c5 | ||
|
|
f0c8e1f6fe | ||
|
|
d70b24c2a8 | ||
|
|
0b53d57d3a |
8 changed files with 61 additions and 12 deletions
|
|
@ -88,7 +88,7 @@ in
|
|||
description = ''
|
||||
Shell script code called during global environment initialisation
|
||||
after all variables and profileVariables have been set.
|
||||
This code is asumed to be shell-independent, which means you should
|
||||
This code is assumed to be shell-independent, which means you should
|
||||
stick to pure sh without sh word split.
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,19 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
getExe'
|
||||
mkIf
|
||||
mkOption
|
||||
mkPackageOption
|
||||
optionalString
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.programs.gnupg;
|
||||
|
||||
|
|
@ -10,6 +21,8 @@ in
|
|||
|
||||
{
|
||||
options.programs.gnupg = {
|
||||
package = mkPackageOption pkgs "gnupg" { };
|
||||
|
||||
agent.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
|
@ -29,9 +42,12 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.agent.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
launchd.user.agents.gnupg-agent.serviceConfig = {
|
||||
ProgramArguments = [
|
||||
"${pkgs.gnupg}/bin/gpg-connect-agent" "/bye"
|
||||
(getExe' cfg.package "gpg-connect-agent")
|
||||
"/bye"
|
||||
];
|
||||
RunAtLoad = cfg.agent.enableSSHSupport;
|
||||
KeepAlive.SuccessfulExit = false;
|
||||
|
|
@ -40,12 +56,13 @@ in
|
|||
environment.extraInit = ''
|
||||
# Bind gpg-agent to this TTY if gpg commands are used.
|
||||
export GPG_TTY=$(tty)
|
||||
'' + (optionalString cfg.agent.enableSSHSupport ''
|
||||
''
|
||||
+ (optionalString cfg.agent.enableSSHSupport ''
|
||||
# SSH agent protocol doesn't support changing TTYs, so bind the agent
|
||||
# to every new TTY.
|
||||
${pkgs.gnupg}/bin/gpg-connect-agent --quiet updatestartuptty /bye > /dev/null 2>&1
|
||||
${getExe' cfg.package "gpg-connect-agent"} --quiet updatestartuptty /bye > /dev/null 2>&1
|
||||
|
||||
export SSH_AUTH_SOCK=$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)
|
||||
export SSH_AUTH_SOCK=$(${getExe' cfg.package "gpgconf"} --list-dirs agent-ssh-socket)
|
||||
'');
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ in {
|
|||
];
|
||||
|
||||
options.services.jankyborders = {
|
||||
enable = mkEnableOption "Enable the jankyborders service.";
|
||||
enable = mkEnableOption "the jankyborders service.";
|
||||
|
||||
package = mkPackageOption pkgs "jankyborders" {};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ in
|
|||
services.khd.i3Keybindings = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Wether to configure i3 style keybindings for kwm.";
|
||||
description = "Whether to configure i3 style keybindings for kwm.";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ in
|
|||
services.spacebar.enable = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to enable the spacebar spacebar.";
|
||||
description = "Whether to enable the spacebar.";
|
||||
};
|
||||
|
||||
services.spacebar.package = mkOption {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ let
|
|||
preDown = mkOption {
|
||||
type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
|
||||
default = "";
|
||||
description = "List of commadns to run before interface shutdown.";
|
||||
description = "List of commands to run before interface shutdown.";
|
||||
};
|
||||
|
||||
preUp = mkOption {
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ in {
|
|||
tests.networking-networkservices = makeTest ./tests/networking-networkservices.nix;
|
||||
tests.nix-enable = makeTest ./tests/nix-enable.nix;
|
||||
tests.nixpkgs-overlays = makeTest ./tests/nixpkgs-overlays.nix;
|
||||
tests.programs-gnupg = makeTest ./tests/programs-gnupg.nix;
|
||||
tests.programs-ssh = makeTest ./tests/programs-ssh.nix;
|
||||
tests.programs-tmux = makeTest ./tests/programs-tmux.nix;
|
||||
tests.programs-zsh = makeTest ./tests/programs-zsh.nix;
|
||||
|
|
|
|||
31
tests/programs-gnupg.nix
Normal file
31
tests/programs-gnupg.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
gnupg = pkgs.runCommand "gnupg-0.0.0" { } "mkdir -p $out/bin";
|
||||
in
|
||||
|
||||
{
|
||||
system.primaryUser = "test-gnupg-user";
|
||||
|
||||
programs.gnupg.package = gnupg;
|
||||
programs.gnupg.agent.enable = true;
|
||||
programs.gnupg.agent.enableSSHSupport = true;
|
||||
|
||||
test = ''
|
||||
echo >&2 "checking gnupg-agent service in ~/Library/LaunchAgents"
|
||||
grep "org.nixos.gnupg-agent" ${config.out}/user/Library/LaunchAgents/org.nixos.gnupg-agent.plist
|
||||
grep "${gnupg}/bin/gpg-connect-agent" ${config.out}/user/Library/LaunchAgents/org.nixos.gnupg-agent.plist
|
||||
|
||||
echo >&2 "checking GPG_TTY in set-environment"
|
||||
grep 'export GPG_TTY=\$(tty)' ${config.system.build.setEnvironment}
|
||||
|
||||
echo >&2 "checking SSH support in set-environment"
|
||||
grep "${gnupg}/bin/gpg-connect-agent --quiet updatestartuptty /bye" ${config.system.build.setEnvironment}
|
||||
grep "${gnupg}/bin/gpgconf --list-dirs agent-ssh-socket" ${config.system.build.setEnvironment}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue