Skip to content

Commit

Permalink
cargo-gra: init at 0.6.0; karlender: 0.9.2 -> 0.10.4, refactor (#353793)
Browse files Browse the repository at this point in the history
  • Loading branch information
wegank authored Nov 7, 2024
2 parents 196e4c2 + 9a47d38 commit af0422b
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 22 deletions.
25 changes: 25 additions & 0 deletions pkgs/by-name/ca/cargo-gra/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
rustPlatform,
fetchCrate,
lib,
}:

rustPlatform.buildRustPackage rec {
pname = "cargo-gra";
version = "0.6.0";

src = fetchCrate {
inherit pname version;
hash = "sha256-cli7qaIVYvoZpDml/QAxm2vjvh/g28zlDSpU9IIUBfw=";
};

cargoHash = "sha256-xsaavcpDaiDDbL3Dl+7NLcfB5U6vuYsVPoIuA/KXCvI=";

meta = {
license = lib.licenses.gpl3Plus;
homepage = "https://gitlab.com/floers/gtk-stuff/cargo-gra/";
maintainers = with lib.maintainers; [ bot-wxt1221 ];
platforms = lib.platforms.unix;
description = "gtk-rust-app cli for building flatpak apps with ease";
};
}
Original file line number Diff line number Diff line change
@@ -1,48 +1,71 @@
{ lib
, rustPlatform
, fetchFromGitLab
, pkg-config
, gtk4
, libadwaita
, wrapGAppsHook4
, glib
, tzdata
{
lib,
rustPlatform,
fetchFromGitLab,
pkg-config,
gtk4,
libadwaita,
wrapGAppsHook4,
glib,
tzdata,
nix-update-script,
dbus,
cargo-gra,
fetchpatch,
}:

rustPlatform.buildRustPackage rec {
pname = "karlender";
version = "0.9.2";
version = "0.10.4";

src = fetchFromGitLab {
owner = "floers";
repo = pname;
rev = "v${version}";
hash = "sha256-txPMOWwxgs9PH1Scnwr/X4cuMIUa+eoLW3K2aqmqRMQ=";
hash = "sha256-W+s1RCPwy7ZiK514AaQLwV9y+VJ58oMGlrS5cdoFKIg=";
};

cargoHash = "sha256-OyyzzkoYBed2XFCesj3QBodT9e/BaapGl/z0f6+cDZA=";
cargoPatches = [
# https://gitlab.com/floers/calendar-stuff/karlender/-/merge_requests/43
# Remove it when it is merged and released.
(fetchpatch {
url = "https://gitlab.com/floers/calendar-stuff/karlender/-/commit/ce50c68323a834a0ee2cbff88ed285a971dfd91e.patch";
hash = "sha256-0hGgJPwnSNGTO/eiooQkQlBJ4brbaWVKRY6MT1PZApg=";
})
];

cargoHash = "sha256-CeHIx6oUtAcr6tBdqmIDTLuYcesaA6G72L3HwHDLY7Y=";

nativeBuildInputs = [
pkg-config
wrapGAppsHook4
glib
cargo-gra
];

buildInputs = [
gtk4
libadwaita
dbus
];

checkFlags = [
"--skip domain::time::tests::test_get_correct_offset_for_dst" # Need time
];

preBuild = ''
cargo-gra gen
'';

postPatch = ''
substituteInPlace src/domain/time.rs --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
substituteInPlace build.rs --replace "// gra::build" "gra::build"
substituteInPlace src/domain/time.rs --replace-fail "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
'';

postInstall = ''
substituteInPlace target/gra-gen/data/codes.loers.Karlender.desktop \
--replace "Exec=codes.loers.Karlender" "Exec=karlender"
--replace-fail "Exec=codes.loers.Karlender" "Exec=karlender"
substituteInPlace target/gra-gen/data/codes.loers.Karlender.appdata.xml \
--replace "<binary>codes.loers.Karlender</binary>" "<binary>karlender</binary>"
--replace-fail "<binary>codes.loers.Karlender</binary>" "<binary>karlender</binary>"
install -Dm444 target/gra-gen/codes.loers.Karlender.gschema.xml -t $out/share/gsettings-schemas/$name/glib-2.0/schemas/
glib-compile-schemas $out/share/gsettings-schemas/$name/glib-2.0/schemas/
install -Dm444 target/gra-gen/data/codes.loers.Karlender.svg -t $out/share/icons/hicolor/scalable/apps/
Expand All @@ -52,12 +75,17 @@ rustPlatform.buildRustPackage rec {
install -Dm444 target/gra-gen/data/codes.loers.Karlender.appdata.xml -t $out/share/metainfo/
'';

meta = with lib; {
passthru.updateScript = nix-update-script { };

meta = {
description = "Mobile-friendly GTK calendar application";
mainProgram = "karlender";
homepage = "https://gitlab.com/floers/karlender";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ chuangzhu ];
platforms = platforms.linux;
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [
chuangzhu
bot-wxt1221
];
platforms = lib.platforms.linux;
};
}
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28742,8 +28742,6 @@ with pkgs;
avahi = avahi.override { withLibdnssdCompat = true; };
};

karlender = callPackage ../applications/office/karlender { };

keepassxc = libsForQt5.callPackage ../applications/misc/keepassxc {
inherit (darwin.apple_sdk_11_0.frameworks) LocalAuthentication;
stdenv = if stdenv.hostPlatform.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
Expand Down

0 comments on commit af0422b

Please sign in to comment.