Skip to content

Commit bde2c00

Browse files
authored
netbird: unbreak netbird-ui build (NixOS#390989)
* netbird: 0.37.1 -> 0.38.2 * netbird: unbreak `netbird-ui` build * netbird: add `versionCheckHook` * netbird: use `buildGoModule` * netbird: use `darwin.apple_sdk.framework` * netbird: move to `pkgs/by-name` * netbird: use `finalAttrs` pattern * netbird: remove `with lib;` in front of the `meta` attribute set * netbird: minor cleanup * netbird: remove `darwin` parameter * netbird: disable `installCheck` for `netbird-ui` only
1 parent f63a963 commit bde2c00

File tree

3 files changed

+38
-47
lines changed

3 files changed

+38
-47
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{ netbird }:
2+
3+
netbird.override {
4+
ui = true;
5+
}
Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
libX11,
1313
libXcursor,
1414
libXxf86vm,
15-
Cocoa,
16-
IOKit,
17-
Kernel,
18-
UserNotifications,
19-
WebKit,
2015
ui ? false,
2116
netbird-ui,
17+
versionCheckHook,
2218
}:
2319
let
2420
modules =
@@ -33,43 +29,35 @@ let
3329
signal = "netbird-signal";
3430
};
3531
in
36-
buildGoModule rec {
32+
buildGoModule (finalAttrs: {
3733
pname = "netbird";
38-
version = "0.37.1";
34+
version = "0.38.2";
3935

4036
src = fetchFromGitHub {
4137
owner = "netbirdio";
4238
repo = "netbird";
43-
tag = "v${version}";
44-
hash = "sha256-5+R0Y/xPgnVH53p1vtY65tOqePWQVOMR4oY1yOOFHK4=";
39+
tag = "v${finalAttrs.version}";
40+
hash = "sha256-8uxRR8XkomUB9dMN9h1M4/K09wxy5E+XhXVbNc0g6xQ=";
4541
};
4642

47-
vendorHash = "sha256-DGvDkkdM8WaaR5FQwZgKn2n1JEDeqUegZxeAIxniJ5A=";
43+
vendorHash = "sha256-m5ou5p2/ubDDMLr0M2F+9qgkqKjhXRJ6HpizwxJhmtU=";
4844

4945
nativeBuildInputs = [ installShellFiles ] ++ lib.optional ui pkg-config;
5046

51-
buildInputs =
52-
lib.optionals (stdenv.hostPlatform.isLinux && ui) [
53-
gtk3
54-
libayatana-appindicator
55-
libX11
56-
libXcursor
57-
libXxf86vm
58-
]
59-
++ lib.optionals (stdenv.hostPlatform.isDarwin && ui) [
60-
Cocoa
61-
IOKit
62-
Kernel
63-
UserNotifications
64-
WebKit
65-
];
47+
buildInputs = lib.optionals (stdenv.hostPlatform.isLinux && ui) [
48+
gtk3
49+
libayatana-appindicator
50+
libX11
51+
libXcursor
52+
libXxf86vm
53+
];
6654

6755
subPackages = lib.attrNames modules;
6856

6957
ldflags = [
7058
"-s"
7159
"-w"
72-
"-X github.com/netbirdio/netbird/version.version=${version}"
60+
"-X github.com/netbirdio/netbird/version.version=${finalAttrs.version}"
7361
"-X main.builtBy=nix"
7462
];
7563

@@ -100,31 +88,38 @@ buildGoModule rec {
10088
) modules
10189
)
10290
+ lib.optionalString (stdenv.hostPlatform.isLinux && ui) ''
103-
mkdir -p $out/share/pixmaps
104-
cp $src/client/ui/netbird-systemtray-connected.png $out/share/pixmaps/netbird.png
105-
106-
mkdir -p $out/share/applications
107-
cp $src/client/ui/netbird.desktop $out/share/applications/netbird.desktop
91+
install -Dm644 "$src/client/ui/assets/netbird-systemtray-connected.png" "$out/share/pixmaps/netbird.png"
92+
install -Dm644 "$src/client/ui/build/netbird.desktop" "$out/share/applications/netbird.desktop"
10893
10994
substituteInPlace $out/share/applications/netbird.desktop \
11095
--replace-fail "Exec=/usr/bin/netbird-ui" "Exec=$out/bin/netbird-ui"
11196
'';
11297

98+
nativeInstallCheckInputs = [
99+
versionCheckHook
100+
];
101+
versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
102+
versionCheckProgramArg = "version";
103+
# Disabled for the `netbird-ui` version because it does a network request.
104+
doInstallCheck = !ui;
105+
113106
passthru = {
114-
tests.netbird = nixosTests.netbird;
115-
tests.netbird-ui = netbird-ui;
107+
tests = {
108+
nixos = nixosTests.netbird;
109+
withUI = netbird-ui;
110+
};
116111
updateScript = nix-update-script { };
117112
};
118113

119-
meta = with lib; {
114+
meta = {
120115
homepage = "https://netbird.io";
121-
changelog = "https://github.com/netbirdio/netbird/releases/tag/v${version}";
116+
changelog = "https://github.com/netbirdio/netbird/releases/tag/v${finalAttrs.version}";
122117
description = "Connect your devices into a single secure private WireGuard®-based mesh network with SSO/MFA and simple access controls";
123-
license = licenses.bsd3;
124-
maintainers = with maintainers; [
118+
license = lib.licenses.bsd3;
119+
maintainers = with lib.maintainers; [
125120
vrifox
126121
saturn745
127122
];
128123
mainProgram = if ui then "netbird-ui" else "netbird";
129124
};
130-
}
125+
})

pkgs/top-level/all-packages.nix

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,15 +2815,6 @@ with pkgs;
28152815

28162816
libotf = callPackage ../tools/inputmethods/m17n-lib/otf.nix { };
28172817

2818-
netbird = callPackage ../tools/networking/netbird {
2819-
inherit (darwin.apple_sdk_11_0.frameworks) Cocoa IOKit Kernel UserNotifications WebKit;
2820-
buildGoModule = buildGo123Module;
2821-
};
2822-
2823-
netbird-ui = netbird.override {
2824-
ui = true;
2825-
};
2826-
28272818
skkDictionaries = callPackages ../tools/inputmethods/skk/skk-dicts { };
28282819

28292820
ibus = callPackage ../tools/inputmethods/ibus { };

0 commit comments

Comments
 (0)