czkawka: refactor
- use explicit self-reference - so that we don't need to refer to czkawka in the input set - nixfmt-rfc-style
This commit is contained in:
parent
d52e321130
commit
dbeb07693d
@ -1,95 +1,106 @@
|
||||
{ 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,
|
||||
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;
|
||||
};
|
||||
|
||||
self = buildRustPackage' {
|
||||
pname = "czkawka";
|
||||
version = "7.0.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "qarmin";
|
||||
repo = "czkawka";
|
||||
rev = self.version;
|
||||
hash = "sha256-SOWtLmehh1F8SoDQ+9d7Fyosgzya5ZztCv8IcJZ4J94=";
|
||||
};
|
||||
|
||||
cargoPatches = [
|
||||
# Updates time and time-macros from Cargo.lock
|
||||
./0000-time.diff
|
||||
];
|
||||
|
||||
cargoHash = "sha256-cQv8C0P3xizsvnJODkTMJQA98P4nYSCHFT75isJE6es=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
gobject-introspection
|
||||
pkg-config
|
||||
wrapGAppsHook4
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
atk
|
||||
cairo
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk4
|
||||
pango
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin (
|
||||
with darwin.apple_sdk.frameworks;
|
||||
[
|
||||
AppKit
|
||||
Foundation
|
||||
]
|
||||
);
|
||||
|
||||
nativeCheckInputs = [ xvfb-run ];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
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";
|
||||
};
|
||||
|
||||
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
|
||||
buildRustPackage' {
|
||||
inherit pname version src cargoPatches cargoHash;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gobject-introspection
|
||||
pkg-config
|
||||
wrapGAppsHook4
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
atk
|
||||
cairo
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk4
|
||||
pango
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
|
||||
Foundation
|
||||
AppKit
|
||||
]);
|
||||
|
||||
nativeCheckInputs = [
|
||||
xvfb-run
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
xvfb-run cargo test
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
doCheck = stdenv.hostPlatform.isLinux
|
||||
&& (stdenv.hostPlatform == stdenv.buildPlatform);
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = czkawka;
|
||||
command = "czkawka_cli --version";
|
||||
};
|
||||
|
||||
# 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
|
||||
'';
|
||||
|
||||
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 ];
|
||||
};
|
||||
}
|
||||
self
|
||||
|
Loading…
Reference in New Issue
Block a user