evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / go / goldwarden / package.nix
blobed7176025f66e9494173c7da042335b79c5509f4
1 { lib
2 , blueprint-compiler
3 , buildGoModule
4 , fetchFromGitHub
5 , gobject-introspection
6 , gtk4
7 , libadwaita
8 , libfido2
9 , libnotify
10 , python3
11 , wrapGAppsHook4
14 buildGoModule rec {
15   pname = "goldwarden";
16   version = "0.3.4";
18   src = fetchFromGitHub {
19     owner = "quexten";
20     repo = "goldwarden";
21     rev = "v${version}";
22     hash = "sha256-LAnhCQmyubWeZtTVaW8IoNmfipvMIlAnY4pKwrURPDs=";
23   };
25   postPatch = ''
26     substituteInPlace gui/src/{linux/main.py,linux/monitors/dbus_monitor.py,gui/settings.py} \
27       --replace-fail "python3" "${(python3.buildEnv.override { extraLibs = pythonPath; }).interpreter}"
29     substituteInPlace gui/com.quexten.Goldwarden.desktop \
30       --replace-fail "Exec=goldwarden_ui_main.py" "Exec=$out/bin/goldwarden-gui"
32     substituteInPlace gui/src/gui/resources/commands.json \
33       --replace-fail "flatpak run --filesystem=home --command=goldwarden com.quexten.Goldwarden" "goldwarden" \
34       --replace-fail "flatpak run --command=goldwarden com.quexten.Goldwarden" "goldwarden" \
35       --replace-fail 'SSH_AUTH_SOCK=/home/$USER/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock' 'SSH_AUTH_SOCK=/home/$USER/.goldwarden-ssh-agent.sock'
37     substituteInPlace cli/browserbiometrics/chrome-com.8bit.bitwarden.json cli/browserbiometrics/mozilla-com.8bit.bitwarden.json \
38       --replace-fail "@PATH@" "$out/bin/goldwarden"
39   '';
41   vendorHash = "sha256-rMs7FP515aClzt9sjgIQHiYo5SYa2tDHrVRhtT+I8aM=";
43   ldflags = [ "-s" "-w" ];
45   nativeBuildInputs = [
46     blueprint-compiler
47     gobject-introspection
48     python3.pkgs.wrapPython
49     wrapGAppsHook4
50   ];
52   buildInputs = [
53     gtk4
54     libadwaita
55     libfido2
56     libnotify
57   ];
59   pythonPath = with python3.pkgs; [
60     dbus-python
61     pygobject3
62     tendo
63   ];
65   postInstall = ''
66     blueprint-compiler batch-compile gui/src/gui/.templates/ gui/src/gui/ gui/src/gui/*.blp
67     chmod +x gui/goldwarden_ui_main.py
69     mkdir -p $out/share/goldwarden
70     cp -r gui/* $out/share/goldwarden/
71     ln -s $out/share/goldwarden/goldwarden_ui_main.py $out/bin/goldwarden-gui
72     rm $out/share/goldwarden/{com.quexten.Goldwarden.desktop,com.quexten.Goldwarden.metainfo.xml,goldwarden.svg,python3-requirements.json,requirements.txt}
74     install -D gui/com.quexten.Goldwarden.desktop -t $out/share/applications
75     install -D gui/goldwarden.svg -t $out/share/icons/hicolor/scalable/apps
76     install -Dm644 gui/com.quexten.Goldwarden.metainfo.xml -t $out/share/metainfo
77     install -Dm644 cli/resources/com.quexten.goldwarden.policy -t $out/share/polkit-1/actions
79     install -D cli/browserbiometrics/chrome-com.8bit.bitwarden.json $out/etc/chrome/native-messaging-hosts/com.8bit.bitwarden.json
80     install -D cli/browserbiometrics/chrome-com.8bit.bitwarden.json $out/etc/chromium/native-messaging-hosts/com.8bit.bitwarden.json
81     install -D cli/browserbiometrics/chrome-com.8bit.bitwarden.json $out/etc/edge/native-messaging-hosts/com.8bit.bitwarden.json
82     install -D cli/browserbiometrics/mozilla-com.8bit.bitwarden.json $out/lib/mozilla/native-messaging-hosts/com.8bit.bitwarden.json
83   '';
85   dontWrapGApps = true;
86   postFixup = ''
87     makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
88     wrapPythonProgramsIn $out/share/goldwarden "$out/share/goldwarden $pythonPath"
89   '';
91   meta = with lib; {
92     description = "Feature-packed Bitwarden compatible desktop integration";
93     homepage = "https://github.com/quexten/goldwarden";
94     license = licenses.mit;
95     maintainers = with maintainers; [ arthsmn justanotherariel ];
96     mainProgram = "goldwarden";
97     platforms = platforms.linux; # Support for other platforms is not yet ready, see https://github.com/quexten/goldwarden/issues/4
98   };