Skip to content

Allow home-manager to specify a custom package for the cli #520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nix/shell-plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
pkgs.runCommand "op-plugin-list" { }
# 1Password CLI tries to create the config directory automatically, so set a temp XDG_CONFIG_HOME
# since we don't actually need it for this
"mkdir $out && XDG_CONFIG_HOME=$out ${pkgs._1password}/bin/op plugin list | cut -d ' ' -f1 | tail -n +2 > $out/plugins.txt"
"mkdir $out && XDG_CONFIG_HOME=$out ${cfg.package}/bin/op plugin list | cut -d ' ' -f1 | tail -n +2 > $out/plugins.txt"
}/plugins.txt");
getExeName = package:
# NOTE: SAFETY: This is okay because the `packages` list is also referred
Expand All @@ -21,6 +21,9 @@ in {
options = {
programs._1password-shell-plugins = {
enable = mkEnableOption "1Password Shell Plugins";

package = lib.mkPackageOption pkgs "_1password" { };

plugins = mkOption {
type = types.listOf types.package;
default = [ ];
Expand Down Expand Up @@ -62,7 +65,7 @@ in {
name = package;
value = "op plugin run -- ${package}";
}) pkg-exe-names);
packages = [ pkgs._1password ] ++ cfg.plugins;
packages = [ cfg.package ] ++ cfg.plugins;
in mkIf cfg.enable (mkMerge [
({
programs = {
Expand Down