-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
133 additions
and
79 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,112 @@ | ||
{ lib | ||
, stdenv | ||
, atk | ||
, cairo | ||
, czkawka | ||
, darwin | ||
, fetchFromGitHub | ||
, gdk-pixbuf | ||
, glib | ||
, gobject-introspection | ||
, gtk4 | ||
, pango | ||
, overrideSDK | ||
, pkg-config | ||
, rustPlatform | ||
, testers | ||
, wrapGAppsHook4 | ||
, xvfb-run | ||
{ | ||
lib, | ||
atk, | ||
cairo, | ||
callPackage, | ||
darwin, | ||
fetchFromGitHub, | ||
gdk-pixbuf, | ||
glib, | ||
gobject-introspection, | ||
gtk4, | ||
overrideSDK, | ||
pango, | ||
pkg-config, | ||
rustPlatform, | ||
stdenv, | ||
testers, | ||
wrapGAppsHook4, | ||
xvfb-run, | ||
}: | ||
|
||
let | ||
pname = "czkawka"; | ||
version = "7.0.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "qarmin"; | ||
repo = "czkawka"; | ||
rev = version; | ||
hash = "sha256-SOWtLmehh1F8SoDQ+9d7Fyosgzya5ZztCv8IcJZ4J94="; | ||
}; | ||
cargoPatches = [ ./time.patch ]; | ||
cargoHash = "sha256-cQv8C0P3xizsvnJODkTMJQA98P4nYSCHFT75isJE6es="; | ||
|
||
buildRustPackage' = rustPlatform.buildRustPackage.override { | ||
stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv; | ||
}; | ||
in | ||
buildRustPackage' { | ||
inherit pname version src cargoPatches cargoHash; | ||
|
||
nativeBuildInputs = [ | ||
gobject-introspection | ||
pkg-config | ||
wrapGAppsHook4 | ||
]; | ||
self = buildRustPackage' { | ||
pname = "czkawka"; | ||
version = "7.0.0"; | ||
|
||
buildInputs = [ | ||
atk | ||
cairo | ||
gdk-pixbuf | ||
glib | ||
gtk4 | ||
pango | ||
] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ | ||
Foundation | ||
AppKit | ||
]); | ||
src = fetchFromGitHub { | ||
owner = "qarmin"; | ||
repo = "czkawka"; | ||
rev = self.version; | ||
hash = "sha256-SOWtLmehh1F8SoDQ+9d7Fyosgzya5ZztCv8IcJZ4J94="; | ||
}; | ||
|
||
nativeCheckInputs = [ | ||
xvfb-run | ||
]; | ||
cargoPatches = [ | ||
# Updates time and time-macros from Cargo.lock | ||
./0000-time.diff | ||
]; | ||
|
||
strictDeps = true; | ||
cargoHash = "sha256-cQv8C0P3xizsvnJODkTMJQA98P4nYSCHFT75isJE6es="; | ||
|
||
checkPhase = '' | ||
runHook preCheck | ||
xvfb-run cargo test | ||
runHook postCheck | ||
''; | ||
nativeBuildInputs = [ | ||
gobject-introspection | ||
pkg-config | ||
wrapGAppsHook4 | ||
]; | ||
|
||
doCheck = stdenv.hostPlatform.isLinux | ||
&& (stdenv.hostPlatform == stdenv.buildPlatform); | ||
buildInputs = | ||
[ | ||
atk | ||
cairo | ||
gdk-pixbuf | ||
glib | ||
gtk4 | ||
pango | ||
] | ||
++ lib.optionals stdenv.hostPlatform.isDarwin ( | ||
with darwin.apple_sdk.frameworks; | ||
[ | ||
AppKit | ||
Foundation | ||
] | ||
); | ||
|
||
passthru.tests.version = testers.testVersion { | ||
package = czkawka; | ||
command = "czkawka_cli --version"; | ||
}; | ||
nativeCheckInputs = [ xvfb-run ]; | ||
|
||
# Desktop items, icons and metainfo are not installed automatically | ||
postInstall = '' | ||
install -Dm444 -t $out/share/applications data/com.github.qarmin.czkawka.desktop | ||
install -Dm444 -t $out/share/icons/hicolor/scalable/apps data/icons/com.github.qarmin.czkawka.svg | ||
install -Dm444 -t $out/share/icons/hicolor/scalable/apps data/icons/com.github.qarmin.czkawka-symbolic.svg | ||
install -Dm444 -t $out/share/metainfo data/com.github.qarmin.czkawka.metainfo.xml | ||
''; | ||
strictDeps = true; | ||
|
||
meta = { | ||
changelog = "https://github.com/qarmin/czkawka/raw/${version}/Changelog.md"; | ||
description = "Simple, fast and easy to use app to remove unnecessary files from your computer"; | ||
homepage = "https://github.com/qarmin/czkawka"; | ||
license = with lib.licenses; [ mit ]; | ||
mainProgram = "czkawka_gui"; | ||
maintainers = with lib.maintainers; [ AndersonTorres yanganto _0x4A6F ]; | ||
doCheck = stdenv.hostPlatform.isLinux && (stdenv.hostPlatform == stdenv.buildPlatform); | ||
|
||
checkPhase = '' | ||
runHook preCheck | ||
xvfb-run cargo test | ||
runHook postCheck | ||
''; | ||
|
||
# Desktop items, icons and metainfo are not installed automatically | ||
postInstall = '' | ||
install -Dm444 -t $out/share/applications data/com.github.qarmin.czkawka.desktop | ||
install -Dm444 -t $out/share/icons/hicolor/scalable/apps data/icons/com.github.qarmin.czkawka.svg | ||
install -Dm444 -t $out/share/icons/hicolor/scalable/apps data/icons/com.github.qarmin.czkawka-symbolic.svg | ||
install -Dm444 -t $out/share/metainfo data/com.github.qarmin.czkawka.metainfo.xml | ||
''; | ||
|
||
passthru = { | ||
tests.version = testers.testVersion { | ||
package = self; | ||
command = "czkawka_cli --version"; | ||
}; | ||
wrapper = callPackage ./wrapper.nix { | ||
czkawka = self; | ||
}; | ||
}; | ||
|
||
meta = { | ||
homepage = "https://github.com/qarmin/czkawka"; | ||
description = "Simple, fast and easy to use app to remove unnecessary files from your computer"; | ||
changelog = "https://github.com/qarmin/czkawka/raw/${self.version}/Changelog.md"; | ||
license = with lib.licenses; [ mit ]; | ||
mainProgram = "czkawka_gui"; | ||
maintainers = with lib.maintainers; [ | ||
AndersonTorres | ||
yanganto | ||
_0x4A6F | ||
]; | ||
}; | ||
}; | ||
} | ||
in | ||
self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
lib, | ||
czkawka, | ||
makeWrapper, | ||
symlinkJoin, | ||
# configurable options | ||
extraPackages ? [ ], | ||
}: | ||
|
||
symlinkJoin { | ||
name = "czkawka-wrapped-${czkawka.version}"; | ||
inherit (czkawka) pname version outputs; | ||
|
||
nativeBuildInputs = [ makeWrapper ]; | ||
|
||
paths = [ czkawka ]; | ||
|
||
postBuild = '' | ||
${lib.concatMapStringsSep "\n" ( | ||
output: "ln --symbolic --no-target-directory ${czkawka.${output}} \$${output}" | ||
) (lib.remove "out" czkawka.outputs)} | ||
pushd $out/bin | ||
for f in *; do | ||
rm -v $f | ||
makeWrapper ${lib.getBin czkawka}/bin/$f $out/bin/$f \ | ||
--prefix PATH ":" "${lib.makeBinPath extraPackages}" | ||
done | ||
popd | ||
''; | ||
|
||
meta = czkawka.meta; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters