-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
164 lines (150 loc) · 6.22 KB
/
Copy pathflake.nix
File metadata and controls
164 lines (150 loc) · 6.22 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
{
description = "NetBird Exit Node - Python Development Environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; # https://github.com/NixOS/nixpkgs
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # https://github.com/NixOS/nixpkgs
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
requests
click
pyqt6
]);
buildInputs = with pkgs; [
libGL
libGLU
libxkbcommon
glib
zlib
xorg.libX11
xorg.libXext
xorg.libXrender
fontconfig
freetype
stdenv.cc.cc.lib
qt6.qtbase
qt6.qtwayland
];
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
pythonEnv
python3Packages.pip
python3Packages.setuptools
python3Packages.wheel
poetry
# GUI dependencies for the applet
qt6.qtbase
qt6.qtwayland
] ++ buildInputs;
shellHook = ''
# Set up Qt environment for the applet
export QT_QPA_PLATFORM=xcb
export QT_QPA_PLATFORM_PLUGIN_PATH="${pkgs.qt6.qtbase}/lib/qt-6/plugins"
export QT_PLUGIN_PATH="${pkgs.qt6.qtbase}/lib/qt-6/plugins:$QT_PLUGIN_PATH"
poetry install
echo "Installing Poetry virtual environment..."
eval "$(poetry env activate)"
echo "NetBird Exit Node Python Development Environment"
echo "Python version: $(python --version)"
echo "Poetry version: $(poetry --version)"
echo "Virtual environment: ACTIVATED"
echo ""
echo "Available commands:"
echo " python - Python interpreter"
echo " pip - Package installer"
echo " poetry - Dependency management"
echo " netbird-exit-node - NetBird CLI tool (terminal/ncurses)"
echo " netbird-exit-node-applet - NetBird system tray applet (GUI)"
echo ""
echo "Environment variables (take precedence over config file):"
echo " export NETBIRD_API_URL=\"https://your-netbird-api.com\""
echo " export NETBIRD_ACCESS_TOKEN=\"your-access-token\""
echo ""
echo "Quick start:"
echo " netbird-exit-node config set # Configure API credentials"
echo " netbird-exit-node config show # Show configuration status"
echo " netbird-exit-node # Interactive ncurses menu (no args)"
echo " netbird-exit-node --help # Show CLI usage"
echo " netbird-exit-node routes list # List routes for current hostname"
echo " netbird-exit-node routes list --peer host # List routes for specific peer"
echo " netbird-exit-node exit-nodes list # List all exit nodes"
echo " netbird-exit-node exit-nodes info # Show peer info & groups"
echo " netbird-exit-node exit-nodes info --peer peer-2 # Show info for specific peer"
echo " netbird-exit-node exit-nodes set exit-node-1 # Set exit node for current peer"
echo " netbird-exit-node exit-nodes set exit-node-1 --peer peer-2 # Set exit node for peer-2"
echo " netbird-exit-node exit-nodes rm # Remove current peer from exit nodes"
'';
};
# Package definitions
packages = {
default = pkgs.python3Packages.buildPythonApplication {
pname = "netbird-exit-node";
version = "0.1.0";
src = ./.;
format = "pyproject";
nativeBuildInputs = with pkgs; [
python3Packages.poetry-core
makeWrapper
qt6.wrapQtAppsHook
];
buildInputs = with pkgs; [
libGL
libGLU
libxkbcommon
glib
zlib
xorg.libX11
xorg.libXext
xorg.libXrender
fontconfig
freetype
stdenv.cc.cc.lib
qt6.qtbase
qt6.qtwayland
];
propagatedBuildInputs = with pkgs.python3Packages; [
requests
click
pyqt6
] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
# Linux-specific dependencies
] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
# macOS-specific dependencies
] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [
# Windows-specific dependencies
windows-curses
];
# Let wrapQtAppsHook handle Qt application wrapping automatically
# It will set up Qt plugin paths and environment variables
# Additional runtime dependencies for GUI libraries
qtWrapperArgs = [
"--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath [
pkgs.libGL pkgs.libGLU pkgs.libxkbcommon pkgs.glib.out pkgs.zlib
pkgs.xorg.libX11 pkgs.xorg.libXext pkgs.xorg.libXrender
pkgs.fontconfig.lib pkgs.freetype pkgs.stdenv.cc.cc.lib
]}"
"--set QT_QPA_PLATFORM xcb"
];
postInstall = ''
mkdir -p $out/share/applications
cp ${./netbird-exit-node-applet.desktop} $out/share/applications/
'';
meta = with pkgs.lib; {
description = "NetBird Exit Node Management Tool";
homepage = "https://github.com/yeoldegrove/netbird-exit-node";
license = licenses.gpl3Only;
maintainers = [ ];
platforms = platforms.unix;
};
};
netbird-exit-node = self.packages.${system}.default;
};
});
}