All my system configs and packages in one repo
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

1password: hm-plusify

+44 -135
+11 -4
hm-plus/modules/programs/1password.nix
··· 4 4 config, 5 5 ... 6 6 }: let 7 - inherit (lib) mkIf mkMerge mkOption mkEnableOption mkPackageOption; 7 + inherit (lib) mkIf mkMerge mkOption mkEnableOption mkPackageOption optional; 8 8 cfg = config.programs._1password; 9 9 10 10 format = pkgs.formats.json {}; ··· 39 39 default = ["_1password-gui"]; 40 40 }; 41 41 42 + autostart = mkEnableOption "autostarting 1Password"; 43 + 42 44 settings = mkOption { 43 - type = format.type; 45 + inherit (format) type; 44 46 default = {}; 45 47 description = '' 46 48 Configuration written to {file}`$XDG_CONFIG_HOME/1Password/settings/settings.json`. ··· 57 59 }; 58 60 config = mkIf cfg.enable (mkMerge [ 59 61 { 60 - home.packages = [cfg.package]; 62 + home.packages = 63 + [cfg.package] 64 + ++ optional cfg.autostart (pkgs.makeAutostartItem { 65 + name = "1password"; 66 + inherit (cfg) package; 67 + }); 61 68 62 - xdg.configFile."1Password/settings/settings.json".source = format.generate "1password-settings" ( 69 + xdg.configFile."1Password/settings/settings.json".source = format.generate "1password-settings.json" ( 63 70 pathify ({version = 1;} // cfg.settings) 64 71 ); 65 72 }
-16
roles/1password/darwin.nix
··· 1 - { 2 - config, 3 - lib, 4 - pkgs, 5 - ... 6 - }: let 7 - inherit (lib) mkIf; 8 - cfg = config.roles._1password; 9 - in { 10 - config = mkIf cfg.enable { 11 - environment.systemPackages = with pkgs; [ 12 - _1password 13 - _1password-gui 14 - ]; 15 - }; 16 - }
-42
roles/1password/default.nix
··· 1 - { 2 - config, 3 - lib, 4 - pkgs, 5 - ... 6 - }: let 7 - inherit (lib) mkEnableOption mkIf mkOption types; 8 - cfg = config.roles._1password; 9 - 10 - inherit (config.programs._1password-gui) package; 11 - in { 12 - options.roles._1password = { 13 - enable = mkEnableOption "1Password"; 14 - package = mkOption { 15 - type = types.package; 16 - default = pkgs._1password-gui; 17 - }; 18 - autostart = mkEnableOption "autostarting 1Password"; 19 - 20 - settings = mkOption { 21 - type = types.nullOr (types.attrsOf types.anything); 22 - default = null; 23 - }; 24 - 25 - sshAgent.enable = 26 - mkEnableOption "1Password's SSH signing agent" 27 - // { 28 - default = cfg.settings.sshAgent.enabled or false; 29 - }; 30 - }; 31 - 32 - config = mkIf cfg.enable { 33 - hm.programs.git.signer = mkIf cfg.sshAgent.enable "${package}/bin/op-ssh-sign"; 34 - 35 - hm.home.file.".ssh/config" = mkIf cfg.sshAgent.enable { 36 - text = '' 37 - Host * 38 - IdentityAgent ~/.1password/agent.sock 39 - ''; 40 - }; 41 - }; 42 - }
-59
roles/1password/nixos.nix
··· 1 - { 2 - config, 3 - lib, 4 - pkgs, 5 - ... 6 - }: let 7 - inherit (lib) mkIf optional; 8 - cfg = config.roles._1password; 9 - in { 10 - config = let 11 - inherit (config.programs._1password-gui) package; 12 - 13 - # Converts an attrset like { p = 4; a.b.c = { d.e.f = 3; e = 5; }; } 14 - # to another attrset like { p = 4; "a.b.c.d.e.f" = 3; "a.b.c.e" = 5; } 15 - pathify = let 16 - inherit (lib) flatten mapAttrsToList nameValuePair; 17 - inherit (builtins) isAttrs listToAttrs; 18 - 19 - pathify' = name: value: 20 - if isAttrs value 21 - then 22 - flatten (mapAttrsToList (n: 23 - pathify' ( 24 - if name != "" 25 - then "${name}.${n}" 26 - else n 27 - )) 28 - value) 29 - else [(nameValuePair name value)]; 30 - in 31 - v: 32 - if isAttrs v 33 - then listToAttrs (pathify' "" v) 34 - else v; 35 - in 36 - mkIf cfg.enable { 37 - programs = { 38 - _1password.enable = true; 39 - _1password-gui = { 40 - inherit (cfg) package; 41 - enable = true; 42 - polkitPolicyOwners = optional config.roles.base.canSudo config.roles.base.username; 43 - }; 44 - }; 45 - 46 - hm = { 47 - home.packages = mkIf cfg.autostart [ 48 - (pkgs.makeAutostartItem { 49 - name = "1password"; 50 - inherit package; 51 - }) 52 - ]; 53 - 54 - xdg.configFile."1Password/settings/settings.json" = mkIf (cfg.settings != null) { 55 - text = builtins.toJSON (pathify ({version = 1;} // cfg.settings)); 56 - }; 57 - }; 58 - }; 59 - }
+33 -14
users/leah/programs/1password/default.nix
··· 1 - {pkgs, ...}: { 2 - # TODO: horrendously broken 3 - # hm = { 4 - # Use the 1Password CLI plugins 5 - # home.sessionVariables.OP_PLUGIN_ALIASES_SOURCED = "1"; 6 - # 7 - # programs.fish.shellAliases = { 8 - # cargo = "op plugin run -- cargo"; 9 - # gh = "op plugin run -- gh"; 10 - # }; 11 - # }; 1 + { 2 + pkgs, 3 + lib, 4 + config, 5 + ... 6 + }: { 7 + programs = { 8 + _1password.enable = true; 9 + _1password-gui = { 10 + enable = true; 11 + package = pkgs._1password-gui-beta; 12 + polkitPolicyOwners = lib.optional config.roles.base.canSudo config.roles.base.username; 13 + }; 14 + }; 12 15 13 - roles._1password = { 16 + hm.programs._1password = { 14 17 enable = true; 15 18 16 19 # I *somehow* ended up with a local DB whose schema version is newer than stable... ··· 44 47 # Display key names when authorizing connections 45 48 storeKeyTitles = true; 46 49 storeSshKeyTitlesResponseGiven = true; 47 - # FIXME: Rich prompts are currently broken on Nix! See nixpkgs#258139 48 - authPromptsV2.enabled = false; 50 + authPromptsV2.enabled = true; 49 51 }; 52 + 53 + # Scan disk for dev credentials 54 + devWatchtower.localDiskScanning = true; 50 55 }; 51 56 }; 57 + 58 + # Use the 1Password CLI plugins 59 + hm.home.sessionVariables = { 60 + OP_PLUGIN_ALIASES_SOURCED = "1"; 61 + OP_BIOMETRIC_UNLOCK_UNABLED = "true"; 62 + }; 63 + 64 + hm.programs.fish.shellAliases = lib.pipe ["cargo" "gh"] [ 65 + (map (name: { 66 + inherit name; 67 + value = "${lib.getExe' pkgs._1password "op"} plugin run -- ${name}"; 68 + })) 69 + builtins.listToAttrs 70 + ]; 52 71 }