diff options
author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-09-20 16:17:18 +0200 |
---|---|---|
committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-09-20 16:17:18 +0200 |
commit | 682f6e3719f2248849e898d2a03aa1cbfea6677f (patch) | |
tree | e81e1745d4879ef5d926a39c5cd3d986c7776d03 |
init commit
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | flake.lock | 27 | ||||
-rw-r--r-- | flake.nix | 30 | ||||
-rwxr-xr-x | password-store-menu | 14 |
4 files changed, 72 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..65dd1c1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1726463316, + "narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..dfb03e5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + description = "Wofi Pass"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = + { self, nixpkgs }: + let + pkgs = import nixpkgs { system = "x86_64-linux"; }; + in + { + packages.x86_64-linux.default = pkgs.stdenv.mkDerivation { + name = "wofi-pass"; + src = self; + installPhase = "mkdir -p $out/bin; install -t $out/bin password-store-menu"; + }; + + overlays.default = final: prev: { inherit (self.packages.${prev.system}) wofi-pass; }; + + nixosModules.default = + { pkgs, ... }: + { + config = { + environment.systemPackages = [ self.packages.${pkgs.system}.default ]; + }; + }; + }; +} diff --git a/password-store-menu b/password-store-menu new file mode 100755 index 0000000..5eec3e6 --- /dev/null +++ b/password-store-menu @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +menu='wofi -d --prompt Pass' + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | $menu) + +[ -z "$password" ] && exit + +pass "$@" -c "$password" |