-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.nix
More file actions
114 lines (105 loc) · 3.13 KB
/
package.nix
File metadata and controls
114 lines (105 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
lib,
python3,
python3Packages,
makeDesktopItem,
}:
let
desktopItem = makeDesktopItem {
name = "Zap";
exec = "zap";
icon = "zap.github.vv01f";
comment = "Zap LNAddress 2 BOLT11 Invoice";
desktopName = "Zap";
categories = [
"Office"
"Finance"
"Utility"
];
terminal = false;
startupWMClass = "Zap";
keywords = [
"bitcoin"
"lightning"
"payment"
"ecash"
"zap"
];
};
macAppAttrs = {
name = "Zap";
desktopName = "Zap";
exec = "zap";
icon = "zap.github.vv01f";
};
pkgs = python3Packages;
in pkgs.buildPythonApplication rec {
pname = "zap";
version = "0.1.0";
src = ./.;
pyproject = true;
nativeBuildInputs = with pkgs; [
setuptools
wheel
];
postInstall = let
plist = ''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key><string>${macAppAttrs.name}</string>
<key>CFBundleDisplayName</key><string>${macAppAttrs.desktopName}</string>
<key>CFBundleIdentifier</key><string>com.vv01f.${macAppAttrs.name}</string>
<key>CFBundleVersion</key><string>0.1.0</string>
<key>CFBundleExecutable</key><string>${macAppAttrs.exec}</string>
<key>CFBundleIconFile</key><string>${macAppAttrs.icon}.png</string>
<key>LSUIElement</key><false/>
<key>CFBundlePackageType</key><string>APPL</string>
</dict>
</plist>
'';
in ''
case "$(uname -s)" in
Linux)
mkdir -p $out/share/applications
mkdir -p $out/share/icons/hicolor/128x128/apps
install -Dm644 ${desktopItem}/share/applications/* $out/share/applications
install -Dm644 "./zap.png" "$out/share/icons/hicolor/128x128/apps/zap.github.vv01f.png"
;;
Darwin)
APPDIR="$out/Zap.app/Contents"
mkdir -p $APPDIR/{MacOS,Resources}
install -Dm644 ./zap.png $APPDIR/Resources/zap.png
install -Dm755 ./zap.py $APPDIR/MacOS/zap
echo "${plist}" > $APPDIR/Info.plist
#~ cat > $APPDIR/Info.plist <<EOF
#~ EOF
;;
*) echo "Unsupported platform: $(uname -s)" ;;
esac
'';
propagatedBuildInputs = with pkgs; [
requests
bech32
pyside6
qrcode
pillow
];
meta = {
description = "Lightning Address to BOLT11 invoice generator on CLI with PySide6 GUI.";
longDescription = ''
This GUI and CLI Tool allows user to derive a BOLT11 Invoice from
by passing a Lightning Address and desired parameters for a better
UX with Lightning Payments.
'';
homepage = "https://github.com/vv01f/lightning-address-invoice-generator";
source = "https://github.com/vv01f/lightning-address-invoice-generator.git";
bugReports = "https://github.com/vv01f/lightning-address-invoice-generator/issues";
license = lib.licenses.mit;
mainProgram = "zap";
platforms = lib.platforms.linux ++ lib.platforms.darwin; # not tested: windows for lib.platforms.all
maintainers = with lib.maintainers; [ "vv01f" ];
};
}