From b517ac71dcc35e7d9bc574b53179143156a96bf4 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 23 Jun 2024 09:57:28 -0400 Subject: [PATCH] Switch to using KeePass --- configs/home.nogui.nix | 2 ++ configs/programs/fish.nix | 7 +++--- packages/all-packages.nix | 1 + packages/passhole.nix | 52 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 packages/passhole.nix diff --git a/configs/home.nogui.nix b/configs/home.nogui.nix index 7e8b5f7..39ce9b1 100644 --- a/configs/home.nogui.nix +++ b/configs/home.nogui.nix @@ -28,6 +28,8 @@ yt-dlp magic-wormhole-rs hledger + keepassxc + passhole ] ++ (import ../system/home-manager.nix).extraPackages pkgs; editorconfig = { enable = true; diff --git a/configs/programs/fish.nix b/configs/programs/fish.nix index 840bef9..02f9022 100644 --- a/configs/programs/fish.nix +++ b/configs/programs/fish.nix @@ -24,12 +24,11 @@ pkgs: { tab = "clone-in-kitty --type=tab"; win = "clone-in-kitty --type=os-window"; ns = "nix-shell --run fish -p"; - unlock-rclone = "set -x RCLONE_CONFIG_PASS (pass rclone)"; + unlock-rclone = "set -x RCLONE_CONFIG_PASS (ph show --field Password rclone)"; ":qa" = "exit"; ":q" = "exit"; "rmount" = "rclone --rc --rc-web-gui --rc-no-auth --cache-dir /tmp/rclone-cache mount --vfs-cache-mode full --vfs-cache-max-size 8Gi"; - "backup" = "eval (pass backblaze/backup-bucket) && restic -r s3:s3.us-west-000.backblazeb2.com/ember-restic-backups/(hostname | sed \"s/\\(.\\)/\\u\\1/\") -p (pass backups | psub) backup ~/ --exclude-caches --exclude-file=${import ./restic.nix}"; - "diary" = "bwrap --bind ~/Diary/gate/ / --bind ~/Diary/store /store --ro-bind /nix /nix --bind /run /run -- (whereis -b restic | cut -c 9-) -r /store -p (pass diary | psub) backup -H 'diary' -e /nix -e /run -e /store -e /home /"; + "backup" = "eval (ph show --field 'Fish Script' 'Backblaze - Backup Bucket') && restic -r s3:s3.us-west-000.backblazeb2.com/ember-restic-backups/(hostname | sed \"s/\\(.\\)/\\u\\1/\") -p (ph show --field Password System/Backups | psub) backup ~/ --exclude-caches --exclude-file=${import ./restic.nix}"; "dl" = "wget (kitty +kitten clipboard --get-clipboard)"; yt = "yt-dlp -o '%(release_date>%Y-%m-%d,upload_date>%Y-%m-%d|???)s.%(title)s.%(ext)s' -f bestvideo+bestaudio --embed-subs --embed-thumbnail --embed-metadata --embed-chapters --embed-info-json (kitten clipboard -g)"; }; @@ -60,7 +59,7 @@ pkgs: { description = "notices your fish function"; body = '' set UWU_DIR (mktemp -d /tmp/uwu.XXX) - encfs -i 60 ~/Pictures/uwu/ $UWU_DIR --extpass 'pass storage-encryption/annex-fs' + encfs -i 60 ~/Pictures/uwu/ $UWU_DIR --extpass 'ph show System/encfs/uwu --field Password' cd $UWU_DIR fish --private cd - diff --git a/packages/all-packages.nix b/packages/all-packages.nix index 1ed1063..ce4ced9 100644 --- a/packages/all-packages.nix +++ b/packages/all-packages.nix @@ -2,4 +2,5 @@ dw = pkgs.callPackage ./dw.nix {}; justseeds = pkgs.callPackage ./justseeds.nix {}; anarchists-stencil = pkgs.callPackage ./anarchists-stencil.nix {}; + passhole = pkgs.callPackage ./passhole.nix {}; } \ No newline at end of file diff --git a/packages/passhole.nix b/packages/passhole.nix new file mode 100644 index 0000000..39b4e72 --- /dev/null +++ b/packages/passhole.nix @@ -0,0 +1,52 @@ +{ lib, python3Packages, fetchFromGitHub, callPackage}: +with python3Packages; +let + pykeepass-cache = + buildPythonPackage { + pname = "pykeepass-cache"; + version = "2.0.2"; + propagatedBuildInputs = [ pykeepass rpyc python-daemon ]; + doCheck = false; + src = fetchFromGitHub { + owner = "libkeepass"; + repo = "pykeepass_cache"; + rev = "8ccd94e"; + hash = "sha256-2QbbjC/GyBHMCEEZOJimPe+MZpHr5Hs1QzHhXS8Hn0k="; + }; + pythonImportsCheck = [ "pykeepass_cache" ]; + meta = with lib; { + homepage = "https://github.com/libkeepass/pykeepass_cache/tree/master"; + description = "database caching for PyKeePass"; + license = licenses.gpl3Only; + maintainers = [{ + email = "ember@corviform.gay"; + github = "Alch-Emi"; + githubId = 38897201; + name = "Ember Hearth"; + }]; + }; + }; +in + buildPythonApplication rec { + pname = "passhole"; + version = "1.10.0"; + propagatedBuildInputs = [ pynput pykeepass pykeepass-cache colorama future pyotp qrcode ]; + src = fetchFromGitHub { + owner = "Evidlo"; + repo = "passhole"; + rev = "v${version}"; + hash = "sha256-SupFNFSgewpXogtZwfg1EvyLiLzE68CoJITWSG9NcwQ="; + }; + pythonImportsCheck = [ "passhole" ]; + meta = with lib; { + homepage = "https://github.com/Evidlo/passhole"; + description = "CLI KeePass client with dmenu support"; + license = licenses.gpl3Only; + maintainers = [{ + email = "ember@corviform.gay"; + github = "Alch-Emi"; + githubId = 38897201; + name = "Ember Hearth"; + }]; + }; + } \ No newline at end of file