lol
1{
2 lib,
3 stdenv,
4 fetchFromGitea,
5 rustPlatform,
6 cairo,
7 pango,
8 pkg-config,
9 libadwaita,
10 blueprint-compiler,
11 wrapGAppsHook4,
12 gsettings-desktop-schemas,
13 just,
14}:
15
16let
17 version = "2.7.4";
18in
19rustPlatform.buildRustPackage {
20 pname = "turnon";
21 version = version;
22
23 src = fetchFromGitea {
24 domain = "codeberg.org";
25 owner = "swsnr";
26 repo = "turnon";
27 rev = "v${version}";
28 hash = "sha256-RTLFajUMJHZoXKhy83G3c7a2fZ+P6CZXadFpbcPFLY8=";
29 };
30
31 cargoHash = "sha256-8vqsQPbl3c2++8T5bjDjAWzm00qSDogT1YaumOC7qzk=";
32
33 doCheck = true;
34
35 checkFlags = [
36 # Skipped due to "Permission denied (os error 13)"
37 "--skip=net::ping::tests::ping_loopback_ipv4"
38 "--skip=net::ping::tests::ping_loopback_ipv6"
39 "--skip=net::ping::tests::ping_with_timeout_unroutable"
40 ];
41
42 nativeBuildInputs = [
43 cairo
44 pango
45 pkg-config
46 blueprint-compiler
47 wrapGAppsHook4
48 just
49 ];
50
51 buildInputs = [
52 libadwaita
53 gsettings-desktop-schemas
54 ];
55
56 strictDeps = true;
57
58 postPatch = ''
59 substituteInPlace justfile \
60 --replace-fail "version := \`git describe\`" "version := \"${version}\"" \
61 --replace-fail "DESTPREFIX := '/app'" "DESTPREFIX := '$out'" \
62 --replace-fail "just --list" "just compile" # Replacing the default recipe with the compile command as just-hook-buildPhase runs the default recipe to compile the package.
63 '';
64
65 postBuild = ''
66 cargo build --release
67 '';
68
69 meta = {
70 description = "Turn on devices in your local network";
71 homepage = "https://codeberg.org/swsnr/turnon";
72 license = lib.licenses.eupl12;
73 maintainers = with lib.maintainers; [ mksafavi ];
74 mainProgram = "de.swsnr.turnon";
75 platforms = lib.platforms.linux;
76 };
77}