Skip to content

Commit 6c3cae0

Browse files
committed
Make 1Password CLI package configurable. Fixes deprecation warning for using pkgs._1password.
1 parent f03bbc8 commit 6c3cae0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

nix/shell-plugins.nix

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let
88
pkgs.runCommand "op-plugin-list" { }
99
# 1Password CLI tries to create the config directory automatically, so set a temp XDG_CONFIG_HOME
1010
# since we don't actually need it for this
11-
"mkdir $out && XDG_CONFIG_HOME=$out ${pkgs._1password}/bin/op plugin list | cut -d ' ' -f1 | tail -n +2 > $out/plugins.txt"
11+
"mkdir $out && XDG_CONFIG_HOME=$out ${getExe cfg.cliPackage} plugin list | cut -d ' ' -f1 | tail -n +2 > $out/plugins.txt"
1212
}/plugins.txt");
1313
getExeName = package:
1414
# NOTE: SAFETY: This is okay because the `packages` list is also referred
@@ -21,6 +21,13 @@ in {
2121
options = {
2222
programs._1password-shell-plugins = {
2323
enable = mkEnableOption "1Password Shell Plugins";
24+
cliPackage = mkOption {
25+
type = types.package;
26+
default = pkgs._1password-cli;
27+
description = ''
28+
The 1Password CLI package
29+
'';
30+
};
2431
plugins = mkOption {
2532
type = types.listOf types.package;
2633
default = [ ];
@@ -62,7 +69,7 @@ in {
6269
name = package;
6370
value = "op plugin run -- ${package}";
6471
}) pkg-exe-names);
65-
packages = [ pkgs._1password ] ++ cfg.plugins;
72+
packages = [ cfg.cliPackage ] ++ cfg.plugins;
6673
in mkIf cfg.enable (mkMerge [
6774
({
6875
programs = {

0 commit comments

Comments
 (0)