1password options

This commit is contained in:
John Lancaster
2025-06-30 23:21:22 -05:00
parent 57d59a9dea
commit 6afd99827c
3 changed files with 45 additions and 12 deletions

View File

@@ -7,9 +7,10 @@
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
_1password-shell-plugins.url = "github:1Password/shell-plugins";
}; };
outputs = { nixpkgs, home-manager, ... }: outputs = { nixpkgs, ... }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
@@ -21,6 +22,10 @@
./options.nix ./options.nix
./home.nix ./home.nix
./git.nix ./git.nix
inputs._1password-shell-plugins.hmModules.default
];
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"1password-cli"
]; ];
}; };
}; };

View File

@@ -100,25 +100,47 @@
"git" "git"
"ssh" "ssh"
"ssh-agent" "ssh-agent"
]; ] ++ lib.optional config._1password "1password";
}; };
shellAliases.ls = "${pkgs.eza}/bin/eza -lgos type --no-time"; shellAliases.ls = "${pkgs.eza}/bin/eza -lgos type --no-time";
# initContent = lib.mkIf config._1password ''
# source ${config.home.homeDirectory}/.config/op/plugins.sh
# '';
}; };
programs.ssh = lib.mkIf config.ssh { programs.ssh = lib.mkIf config.ssh {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
SetEnv TERM="xterm-256color" SetEnv TERM="xterm-256color"
${lib.optionalString config._1password "IdentityAgent ~/.1password/agent.sock"}
''; '';
matchBlocks = lib.mkIf (config.profile == "personal") { matchBlocks = lib.mkMerge [
"panoptes" = { (lib.mkIf (config.profile == "personal") {
hostname = "192.168.1.107"; "panoptes" = {
user = "panoptes"; hostname = "192.168.1.107";
}; user = "panoptes";
"pve5070" = { };
hostname = "192.168.1.130"; "pve5070" = {
user = "root"; hostname = "192.168.1.130";
}; user = "root";
}; };
})
(lib.mkIf (config.profile == "work") {
"ubuntu-nvidia" = {
hostname = "10.118.46.120";
user = "john";
};
})
];
};
# https://developer.1password.com/docs/cli/shell-plugins/nix/
programs._1password-shell-plugins = lib.mkIf config._1password {
# enable 1Password shell plugins for bash, zsh, and fish shell
enable = true;
# the specified packages as well as 1Password CLI will be
# automatically installed and configured to use shell plugins
# https://developer.1password.com/docs/cli/shell-plugins
plugins = with pkgs; [ gh ];
}; };
} }

View File

@@ -23,4 +23,10 @@
default = true; default = true;
description = "Whether to enable SSH configuration"; description = "Whether to enable SSH configuration";
}; };
options._1password = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to enable 1 password stuff";
};
} }