about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/window-managers/herbstluftwm/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-26 18:06:19 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-26 18:21:18 +0000
commit7ac6743433dd45ceaead2ca96f6356dc0d064ce6 (patch)
treeb68ec89d7d2a8d2b6e6b1ff94ba26d6af4096350 /nixpkgs/pkgs/applications/window-managers/herbstluftwm/default.nix
parentc5c7451dbef37b51f52792d6395a670ef5183d27 (diff)
parent891f607d5301d6730cb1f9dcf3618bcb1ab7f10e (diff)
downloadnixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.gz
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.bz2
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.lz
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.xz
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.zst
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.zip
Merge commit '891f607d5301d6730cb1f9dcf3618bcb1ab7f10e'
Diffstat (limited to 'nixpkgs/pkgs/applications/window-managers/herbstluftwm/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/window-managers/herbstluftwm/default.nix73
1 files changed, 58 insertions, 15 deletions
diff --git a/nixpkgs/pkgs/applications/window-managers/herbstluftwm/default.nix b/nixpkgs/pkgs/applications/window-managers/herbstluftwm/default.nix
index e547cea3c54c..ad45f01915da 100644
--- a/nixpkgs/pkgs/applications/window-managers/herbstluftwm/default.nix
+++ b/nixpkgs/pkgs/applications/window-managers/herbstluftwm/default.nix
@@ -1,35 +1,38 @@
-{ stdenv, fetchurl, cmake, pkgconfig, glib, libX11, libXext, libXinerama, libXrandr
-, withDoc ? stdenv.buildPlatform == stdenv.targetPlatform, asciidoc ? null }:
+{ lib, stdenv, fetchurl, cmake, pkg-config, python3, libX11, libXext, libXinerama, libXrandr, asciidoc
+, xdotool, xorgserver, xsetroot, xterm, runtimeShell
+, nixosTests }:
 
 # Doc generation is disabled by default when cross compiling because asciidoc
-# does not cross compile for now
+# dependency is broken when cross compiling for now
 
-assert withDoc -> asciidoc != null;
+let
+  cross = stdenv.buildPlatform != stdenv.targetPlatform;
 
-stdenv.mkDerivation rec {
+in stdenv.mkDerivation rec {
   pname = "herbstluftwm";
-  version = "0.8.3";
+  version = "0.9.1";
 
   src = fetchurl {
     url = "https://herbstluftwm.org/tarballs/herbstluftwm-${version}.tar.gz";
-    sha256 = "1qmb4pjf2f6g0dvcg11cw9njwmxblhqzd70ai8qnlgqw1iz3nkm1";
+    sha256 = "0r4qaklv97qcq8p0pnz4f2zqg69vfai6c2qi1ydi2kz24xqjf5hy";
   };
 
   outputs = [
     "out"
-  ] ++ stdenv.lib.optionals withDoc [
-    "doc"
+    "doc" # share/doc exists with examples even without generated html documentation
+  ] ++ lib.optionals (!cross) [
     "man"
   ];
 
   cmakeFlags = [
     "-DCMAKE_INSTALL_SYSCONF_PREFIX=${placeholder "out"}/etc"
-  ] ++ stdenv.lib.optional (!withDoc) "-DWITH_DOCUMENTATION=OFF";
+  ] ++ lib.optional cross "-DWITH_DOCUMENTATION=OFF";
 
   nativeBuildInputs = [
     cmake
-    pkgconfig
-  ] ++ stdenv.lib.optional withDoc asciidoc;
+    pkg-config
+    python3
+  ] ++ lib.optional (!cross) asciidoc;
 
   buildInputs = [
     libX11
@@ -38,10 +41,50 @@ stdenv.mkDerivation rec {
     libXrandr
   ];
 
-  meta = {
+  patches = [
+    ./test-path-environment.patch
+  ];
+
+  postPatch = ''
+    patchShebangs doc/gendoc.py
+
+    # fix /etc/xdg/herbstluftwm paths in documentation and scripts
+    grep -rlZ /etc/xdg/herbstluftwm share/ doc/ scripts/ | while IFS="" read -r -d "" path; do
+      substituteInPlace "$path" --replace /etc/xdg/herbstluftwm $out/etc/xdg/herbstluftwm
+    done
+
+    # fix shebang in generated scripts
+    substituteInPlace tests/conftest.py --replace "/usr/bin/env bash" ${runtimeShell}
+    substituteInPlace tests/test_herbstluftwm.py --replace "/usr/bin/env bash" ${runtimeShell}
+  '';
+
+  doCheck = true;
+
+  checkInputs = [
+    (python3.withPackages (ps: with ps; [ ewmh pytest xlib ]))
+    xdotool
+    xorgserver
+    xsetroot
+    xterm
+    python3.pkgs.pytestCheckHook
+  ];
+
+  # make the package's module avalaible
+  preCheck = ''
+    export PYTHONPATH="$PYTHONPATH:../python"
+  '';
+
+  pytestFlagsArray = [ "../tests" ];
+
+  passthru = {
+    tests.herbstluftwm = nixosTests.herbstluftwm;
+  };
+
+  meta = with lib; {
     description = "A manual tiling window manager for X";
     homepage = "https://herbstluftwm.org/";
-    license = stdenv.lib.licenses.bsd2;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ thibautmarty ];
   };
 }