-
-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
855 additions
and
449 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ lib, config, pkgs, ... }: | ||
let | ||
cfg = config.programs.goldwarden; | ||
in | ||
{ | ||
options.programs.goldwarden = { | ||
enable = lib.mkEnableOption "Goldwarden"; | ||
package = lib.mkPackageOption pkgs "goldwarden" {}; | ||
useSshAgent = lib.mkEnableOption "Goldwarden's SSH Agent" // { default = true; }; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
assertions = [{ | ||
assertion = cfg.useSshAgent -> !config.programs.ssh.startAgent; | ||
message = "Only one ssh-agent can be used at a time."; | ||
}]; | ||
|
||
environment = { | ||
etc = lib.mkIf config.programs.chromium.enable { | ||
"chromium/native-messaging-hosts/com.8bit.bitwarden.json".source = "${cfg.package}/etc/chromium/native-messaging-hosts/com.8bit.bitwarden.json"; | ||
"opt/chrome/native-messaging-hosts/com.8bit.bitwarden.json".source = "${cfg.package}/etc/chrome/native-messaging-hosts/com.8bit.bitwarden.json"; | ||
}; | ||
|
||
extraInit = lib.mkIf cfg.useSshAgent '' | ||
if [ -z "$SSH_AUTH_SOCK" -a -n "$HOME" ]; then | ||
export SSH_AUTH_SOCK="$HOME/.goldwarden-ssh-agent.sock" | ||
fi | ||
''; | ||
|
||
systemPackages = [ | ||
# for cli and polkit action | ||
cfg.package | ||
# binary exec's into pinentry which should match the DE | ||
config.programs.gnupg.agent.pinentryPackage | ||
]; | ||
}; | ||
|
||
programs.firefox.nativeMessagingHosts.packages = [ cfg.package ]; | ||
|
||
# see https://github.com/quexten/goldwarden/blob/main/cmd/goldwarden.service | ||
systemd.user.services.goldwarden = { | ||
description = "Goldwarden daemon"; | ||
wantedBy = [ "graphical-session.target" ]; | ||
after = [ "graphical-session.target" ]; | ||
serviceConfig.ExecStart = "${lib.getExe cfg.package} daemonize"; | ||
path = [ config.programs.gnupg.agent.pinentryPackage ]; | ||
unitConfig.ConditionUser = "!@system"; | ||
}; | ||
}; | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.