Skip to content

Commit

Permalink
fix(apps): wrong version of 1password gui launched on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
zakuciael committed Nov 17, 2024
1 parent 516d925 commit c56726b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"aagl",
"ahci",
"alacritty",
"allowsinput",
"amdgpu",
"attrsets",
"audiostop",
Expand All @@ -44,8 +45,10 @@
"bootloader",
"bootmgfw",
"borderangle",
"builtins",
"catppuccin",
"chainloader",
"closewindow",
"colour",
"compat",
"concat",
Expand Down
32 changes: 19 additions & 13 deletions modules/desktop/apps/_1password.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,25 @@
username,
desktop,
...
}:
with lib;
with lib.my;
with lib.my.utils; let
}: let
inherit (lib) mkIf getExe listToAttrs nameValuePair attrByPath;
inherit (lib.my.utils) findLayoutConfig getLayoutMonitor recursiveReadSecretNames readSecrets mkSecretPlaceholder;
inherit (lib.my.mapper) toTOML;

hmConfig = config.home-manager.users.${username};
configDirectory = hmConfig.xdg.configHome;
pkgs' = {
gui = config.programs._1password-gui.package;
cli = config.programs._1password.package;
};

layout = findLayoutConfig config ({name, ...}: name == "main"); # Main monitor
monitor = getLayoutMonitor layout "wayland";
class = "1Password";

base = "1password/ssh_agent";
secretNames = utils.recursiveReadSecretNames {inherit config base;};
secrets = utils.readSecrets {inherit config base;};
secretNames = recursiveReadSecretNames {inherit config base;};
secrets = readSecrets {inherit config base;};
in {
programs = {
_1password = {
Expand All @@ -36,7 +42,7 @@ in {
};

modules.desktop.wm.${desktop}.autostartPrograms = [
"${pkgs._1password-gui}/bin/1password"
"${getExe pkgs'.gui}"
];

sops = {
Expand All @@ -45,13 +51,13 @@ in {
mode = "0644";
owner = username;
path = "${configDirectory}/1Password/ssh/agent.toml";
file = mapper.toTOML "agent.toml" {
file = toTOML "agent.toml" {
ssh-keys =
builtins.map
(
entry:
builtins.mapAttrs
(slot: _: utils.mkSecretPlaceholder config [base entry slot])
(slot: _: mkSecretPlaceholder config [base entry slot])
(attrByPath [entry] {} secrets)
)
(builtins.attrNames secrets);
Expand All @@ -71,7 +77,7 @@ in {

extraConfig = {
gpg.format = "ssh";
gpg.ssh.program = "${pkgs._1password-gui}/bin/op-ssh-sign";
gpg.ssh.program = "${pkgs'.gui}/bin/op-ssh-sign";
};
};

Expand All @@ -84,8 +90,8 @@ in {
wayland.windowManager.hyprland = mkIf (config.modules.desktop.wm.hyprland.enable) {
settings = {
bind = [
"Ctrl Shift, O, exec, 1password --toggle"
"Ctrl Shift, L, exec, 1password --lock"
"Ctrl Shift, O, exec, ${getExe pkgs'.gui} --toggle"
"Ctrl Shift, L, exec, ${getExe pkgs'.gui} --lock"
];

windowrulev2 = [
Expand All @@ -101,7 +107,7 @@ in {
};

extraConfig = ''
bind = Ctrl Shift, P, exec, 1password --quick-access
bind = Ctrl Shift, P, exec, ${getExe pkgs'.gui} --quick-access
bind = Ctrl Shift, P, submap, 1pass
submap = 1pass
Expand Down

0 comments on commit c56726b

Please sign in to comment.