chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / sq / squirreldisk / package.nix
blobf394cce79ada72dce925c3365c1d5afc5d8c2c07
2   dbus,
3   openssl,
4   freetype,
5   libsoup,
6   gtk3,
7   webkitgtk,
8   pkg-config,
9   wrapGAppsHook3,
10   parallel-disk-usage,
11   fetchFromGitHub,
12   buildNpmPackage,
13   rustPlatform,
14   lib,
15   stdenv,
16   copyDesktopItems,
17   makeDesktopItem,
18 }: let
19   pname = "squirreldisk";
20   version = "0.3.4";
22   src = fetchFromGitHub {
23     owner = "adileo";
24     repo = "squirreldisk";
25     rev = "v${version}";
26     hash = "sha256-As2nvc68knjeLPuX0QLBoybj8vuvkpS5Vr+7U7E5CjA=";
27   };
28   frontend-build = buildNpmPackage {
29     inherit version src;
30     pname = "squirreldisk-ui";
32     npmDepsHash = "sha256-Japcn0KYP7aYIDK8+Ns+mrnbbAb0fLWXHIV2+yltI6I=";
34     packageJSON = ./package.json;
35     postBuild = ''
36       cp -r dist/ $out
37     '';
38     distPhase = "true";
39     dontInstall = true;
40   };
42   rustPlatform.buildRustPackage rec {
43     inherit version src pname;
45     sourceRoot = "${src.name}/src-tauri";
47     cargoLock = {
48       lockFile = ./Cargo.lock;
49       outputHashes = {
50         "window-shadows-0.2.1" = "sha256-3meM04TG63PvB0M5wUH1cDMBo7ObcB0zdgwGt2aKHMs=";
51       };
52     };
54     # copy the frontend static resources to final build directory
55     # Also modify tauri.conf.json so that it expects the resources at the new location
56     postPatch = ''
57       cp ${./Cargo.lock} Cargo.lock
59       mkdir -p frontend-build
60       cp -r ${frontend-build}/* frontend-build
62       substituteInPlace tauri.conf.json --replace-fail '"distDir": "../dist"' '"distDir": "./frontend-build"'
64       # Copy pdu binary from nixpkgs, since the default packaged binary has issues.
65       cp ${parallel-disk-usage}/bin/pdu bin/pdu-${stdenv.hostPlatform.config}
66     '';
68     nativeBuildInputs = [pkg-config wrapGAppsHook3 copyDesktopItems];
69     buildInputs = [dbus openssl freetype libsoup gtk3 webkitgtk];
71     # Disable checkPhase, since the project doesn't contain tests
72     doCheck = false;
74     postInstall = ''
75       mv $out/bin/squirreldisk-tauri $out/bin/squirreldisk
76       install -DT icons/256x256.png $out/share/icons/hicolor/256x256/apps/squirrel-disk.png
77       install -DT icons/128x128@2x.png $out/share/icons/hicolor/128x128@2/apps/squirrel-disk.png
78       install -DT icons/128x128.png $out/share/icons/hicolor/128x128/apps/squirrel-disk.png
79       install -DT icons/32x32.png $out/share/icons/hicolor/32x32/apps/squirrel-disk.png
80     '';
82     # WEBKIT_DISABLE_COMPOSITING_MODE essential in NVIDIA + compositor https://github.com/NixOS/nixpkgs/issues/212064#issuecomment-1400202079
83     postFixup = ''
84       wrapProgram "$out/bin/squirreldisk" \
85         --set WEBKIT_DISABLE_COMPOSITING_MODE 1
86     '';
88     desktopItems = [
89       (makeDesktopItem {
90         name = "SquirrelDisk";
91         exec = "squirreldisk";
92         icon = "squirrel-disk";
93         desktopName = "SquirrelDisk";
94         comment = meta.description;
95       })
96     ];
98     meta = with lib; {
99       description = "Cross-platform disk usage analysis tool";
100       homepage = "https://www.squirreldisk.com/";
101       license = licenses.agpl3Only;
102       maintainers = with maintainers; [peret];
103       mainProgram = "squirreldisk";
104     };
105   }