Skip to content

Optional package #471

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 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Aigeruth
Copy link

Overview

1Password CLI requires setting the group of the executable to onepassword-cli. This isn't possible when home-manager is installed in standalone mode (e.g. Ubuntu or other distributions). Opting out of installing the 1Password CLI
with nix allows using the system-wide installation (e.g. via apt).

This change also allows changing the package. It's beneficial when nixpkgs-unstable is mapped to pkgs.unstable via an overlay.

This is not breaking, the current behavior remains as is.

Type of change

Improved experience for nix users.

How To Test

Opting out of installing the package:

{
    imports = [ inputs._1password-shell-plugins.hmModules.default ];
    programs._1password-shell-plugins = {
      enable = true;
      package = null;
      plugins = with pkgs; [ gh awscli2 cachix ];
    };
}

Changing the package:

{
    imports = [ inputs._1password-shell-plugins.hmModules.default ];
    programs._1password-shell-plugins = {
      enable = true;
      package = pkgs.unstable._1password;
      plugins = with pkgs; [ gh awscli2 cachix ];
    };
}

Changelog

Allow nix users to change the _1password package like in home-manager modules or allow opting out from installing the package by setting it to null.

Copy link
Contributor

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

Aigeruth added 2 commits June 15, 2024 15:39
1Password CLI requires setting the group to onepassword-cli. This isn't
possible when home-manager is installed in standalone mode (e.g. Ubuntu
or other distributions). Opting out of installing the 1Password CLI
with nix allows using the system-wide installation (e.g. via apt).
@shymega
Copy link

shymega commented Sep 19, 2024

I would love to see this merged. Mostly because of standalone home-manager.

Copy link
Member

@SimonBarendse SimonBarendse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not breaking, the current behavior remains as is.

Excellent! Definitely appreciate you thinking about this. 💙

This all looks sensible to me. @hculea or @mrjones2014 could you give this a look for a second pair of eyes?

@SimonBarendse
Copy link
Member

How does this compare to alternative implementation in #503 ?

@mrjones2014
Copy link
Member

#503 is technically solving a different issue. The upstream nixpkgs changed the package name from _1password to _1password-cli to closer match our 1Password nomenclature, so evaluation prints a warning about that.

However, this PR also changes the default package from _1password to _1password-cli which also fixes that issue.

Basically, this PR supersedes #503 (in a slightly more Nix-convetional way as well) and also fixes an additional problem with the home-manager integration.

So we can merge this PR and close #503.

@mrjones2014
Copy link
Member

The changes look good to me but it looks like we need another approval from someone with write access. @hculea ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants