summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartino Fontana <tinozzo123@tutanota.com>2022-11-08 23:48:05 +0100
committerMartino Fontana <tinozzo123@gmail.com>2023-08-10 13:24:42 +0200
commita03a8db8b9143e5e04777d7f359fc72efc17fc34 (patch)
treeb76abeb720b297400223d756ad644fb66b84cf5d
parentce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e (diff)
downloadnixpkgs-a03a8db8b9143e5e04777d7f359fc72efc17fc34.tar
nixpkgs-a03a8db8b9143e5e04777d7f359fc72efc17fc34.tar.gz
nixpkgs-a03a8db8b9143e5e04777d7f359fc72efc17fc34.tar.bz2
nixpkgs-a03a8db8b9143e5e04777d7f359fc72efc17fc34.tar.lz
nixpkgs-a03a8db8b9143e5e04777d7f359fc72efc17fc34.tar.xz
nixpkgs-a03a8db8b9143e5e04777d7f359fc72efc17fc34.tar.zst
nixpkgs-a03a8db8b9143e5e04777d7f359fc72efc17fc34.zip
caffeine-ng: 4.0.2 -> 4.2.0
-rw-r--r--pkgs/tools/X11/caffeine-ng/default.nix73
-rw-r--r--pkgs/tools/X11/caffeine-ng/fix-build.patch24
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 55 insertions, 44 deletions
diff --git a/pkgs/tools/X11/caffeine-ng/default.nix b/pkgs/tools/X11/caffeine-ng/default.nix
index 66103ba6f8d..90292e8beda 100644
--- a/pkgs/tools/X11/caffeine-ng/default.nix
+++ b/pkgs/tools/X11/caffeine-ng/default.nix
@@ -1,77 +1,63 @@
-{ buildPythonApplication
-, fetchPypi
+{ fetchFromGitea
+, meson
+, ninja
+, pkg-config
+, scdoc
 , gobject-introspection
-, gtk3
 , lib
-, libappindicator-gtk3
+, libayatana-appindicator
 , libnotify
-, click
-, dbus-python
-, ewmh
-, pulsectl
-, pygobject3
-, pyxdg
-, setproctitle
-, python3
+, python3Packages
 , procps
 , xset
 , xautolock
 , xscreensaver
 , xfce
-, glib
-, setuptools-scm
 , wrapGAppsHook
 }:
 
-let
-  click_7 = click.overridePythonAttrs (old: rec {
-    version = "7.1.2";
-    src = old.src.override {
-      inherit version;
-      hash = "sha256-0rUlXHxjSbwb0eWeCM0SrLvWPOZJ8liHVXg6qU37axo=";
-    };
-    disabledTests = [ "test_bytes_args" ]; # https://github.com/pallets/click/commit/6e05e1fa1c2804
-  });
-in buildPythonApplication rec {
+python3Packages.buildPythonApplication rec {
   pname = "caffeine-ng";
-  version = "4.0.2";
-  format = "setuptools";
+  version = "4.2.0";
+  format = "other";
 
-  src = fetchPypi {
-    inherit pname version;
-    hash = "sha256-umIjXJ0et6Pi5Ejj96Q+ZhiKS+yj7bsgb4uQW6Ym6rU=";
+  src = fetchFromGitea {
+    domain = "codeberg.org";
+    owner = "WhyNotHugo";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-uYzLRZ+6ZgIwhSuJWRBpLYHgonX7sFXgUZid0V26V0Q=";
   };
 
-  nativeBuildInputs = [ wrapGAppsHook glib gobject-introspection setuptools-scm ];
+  nativeBuildInputs = [ gobject-introspection meson ninja pkg-config wrapGAppsHook ];
 
   buildInputs = [
-    libappindicator-gtk3
+    libayatana-appindicator
     libnotify
-    gtk3
   ];
 
-  pythonPath = [
-    click_7
+  pythonPath = with python3Packages; [
+    click
     dbus-python
     ewmh
     pulsectl
     pygobject3
-    pyxdg
+    scdoc
     setproctitle
   ];
 
-  doCheck = false; # There are no tests.
   dontWrapGApps = true;
-  strictDeps = false;
 
-  postInstall = ''
-    cp -r share $out/
-    cp -r caffeine/assets/icons $out/share/
+  patches = [
+    ./fix-build.patch
+  ];
 
-    # autostart file
-    ln -s $out/${python3.sitePackages}/etc $out/etc
+  postPatch = ''
+    echo "${version}" > version
+  '';
 
-    glib-compile-schemas --strict $out/share/glib-2.0/schemas
+  postInstall = ''
+    glib-compile-schemas $out/share/glib-2.0/schemas
   '';
 
   preFixup = ''
@@ -86,6 +72,7 @@ in buildPythonApplication rec {
     maintainers = with maintainers; [ marzipankaiser ];
     description = "Status bar application to temporarily inhibit screensaver and sleep mode";
     homepage = "https://codeberg.org/WhyNotHugo/caffeine-ng";
+    changelog = "https://codeberg.org/WhyNotHugo/caffeine-ng/src/tag/v${version}/CHANGELOG.rst";
     license = licenses.gpl3;
     platforms = platforms.linux;
   };
diff --git a/pkgs/tools/X11/caffeine-ng/fix-build.patch b/pkgs/tools/X11/caffeine-ng/fix-build.patch
new file mode 100644
index 00000000000..cf075451138
--- /dev/null
+++ b/pkgs/tools/X11/caffeine-ng/fix-build.patch
@@ -0,0 +1,24 @@
+diff --git a/meson.build b/meson.build
+index 3e4f9ea..5b82861 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2,10 +2,6 @@ project(
+     'caffeine-ng',
+     version: run_command('./scripts/read_version.sh', check: true).stdout().strip(),
+     meson_version: '>=0.63.0',
+-    default_options: [
+-      # The default can yield broken results.
+-      'python.install_env=auto'
+-    ]
+ )
+ 
+ dependency('pygobject-3.0')
+@@ -82,7 +78,7 @@ configure_file(
+ 
+ install_data(
+   'share/applications/caffeine.desktop',
+-  install_dir: '/etc/xdg/autostart',
++  install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'),
+ )
+ 
+ install_data(
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7ba26b924f4..d905ef83515 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -39503,7 +39503,7 @@ with pkgs;
 
   caffeWithCuda = caffe.override { cudaSupport = true; };
 
-  caffeine-ng = python3Packages.callPackage ../tools/X11/caffeine-ng { };
+  caffeine-ng = callPackage ../tools/X11/caffeine-ng { };
 
   cntk = callPackage ../applications/science/math/cntk {
     stdenv = gcc7Stdenv;