Skip to content

Commit

Permalink
feat: Add _1password home-manager module and enable it on gamer and l…
Browse files Browse the repository at this point in the history
…aptop hosts
  • Loading branch information
rodent1 committed Sep 1, 2024
1 parent 236a391 commit 665c76b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 28 deletions.
30 changes: 15 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions homes/_modules/security/_1password/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ lib, config, ... }:
let
cfg = config.modules.security._1password;
in
{
options.modules.security._1password = {
enable = lib.mkEnableOption "_1password";
};

config = lib.mkMerge [
(lib.mkIf cfg.enable {
# TODO: See if I can get this to work with home.sessionVariables instead
programs.fish.shellInit = ''
set -gx OP_CONNECT_HOST (jq -r .host ${config.sops.secrets.op_connect.path})
set -gx OP_CONNECT_TOKEN (jq -r .token ${config.sops.secrets.op_connect.path})
'';
})
];
}
2 changes: 2 additions & 0 deletions homes/_modules/security/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{ ... }:
{
imports = [
./_1password
./gnugpg
./ssh
];

}
10 changes: 3 additions & 7 deletions homes/stianrs/hosts/gamer.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{ config, ... }:
{ ... }:
{
modules = {
development.enable = true;
kubernetes.enable = true;
# TODO: See if I can automate this based on the nixos module being enabled on the host
security._1password.enable = true;
};

# TODO: See if I can get this to work with home.sessionVariables instead
programs.fish.shellInit = ''
set -gx OP_CONNECT_HOST (jq -r .host ${config.sops.secrets.op_connect.path})
set -gx OP_CONNECT_TOKEN (jq -r .token ${config.sops.secrets.op_connect.path})
'';
}
8 changes: 2 additions & 6 deletions homes/stianrs/hosts/laptop.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{ config, ... }:
{ ... }:
{
modules = {
development.enable = true;
kubernetes.enable = true;
security._1password.enable = true;
};

programs.fish.shellInit = ''
set -gx OP_CONNECT_HOST (jq -r .host ${config.sops.secrets.op_connect.path})
set -gx OP_CONNECT_TOKEN (jq -r .token ${config.sops.secrets.op_connect.path})
'';
}

0 comments on commit 665c76b

Please sign in to comment.