summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMoritz Ulrich <moritz@tarn-vedra.de>2015-04-05 14:09:16 +0200
committerMoritz Ulrich <moritz@tarn-vedra.de>2015-04-05 14:09:16 +0200
commit4eaf2f1114e3119e3f4f20a72b63e1cf6a361c0d (patch)
tree873353e445b724ce5718f47919e5294912b2600f /pkgs
parent5c866dc5e96356c8f3ef06dff53c8e183dc45f1e (diff)
downloadnixlib-4eaf2f1114e3119e3f4f20a72b63e1cf6a361c0d.tar
nixlib-4eaf2f1114e3119e3f4f20a72b63e1cf6a361c0d.tar.gz
nixlib-4eaf2f1114e3119e3f4f20a72b63e1cf6a361c0d.tar.bz2
nixlib-4eaf2f1114e3119e3f4f20a72b63e1cf6a361c0d.tar.lz
nixlib-4eaf2f1114e3119e3f4f20a72b63e1cf6a361c0d.tar.xz
nixlib-4eaf2f1114e3119e3f4f20a72b63e1cf6a361c0d.tar.zst
nixlib-4eaf2f1114e3119e3f4f20a72b63e1cf6a361c0d.zip
Stumpwm: Fix contrib modules, install stumpish.
This was caused by multiple things: First, the module-path was wrong in
the release. Second, when modules tried to load stumpwm, asdf searched
for its sources in /tmp/nix-build-*.

Both of these issues are fixed by a nix-specific patch that tells adsf
to *never* try to load stumpwm (and others) from the filesystem. This is
fine as those modules are already available in the image anyway.

We also refactor some stuff & clean up the build. Stumpish works now
too.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/window-managers/stumpwm/contrib.nix31
-rw-r--r--pkgs/applications/window-managers/stumpwm/default.nix85
-rw-r--r--pkgs/applications/window-managers/stumpwm/fix-module-path.patch16
-rw-r--r--pkgs/top-level/all-packages.nix1
4 files changed, 73 insertions, 60 deletions
diff --git a/pkgs/applications/window-managers/stumpwm/contrib.nix b/pkgs/applications/window-managers/stumpwm/contrib.nix
deleted file mode 100644
index dc707983811a..000000000000
--- a/pkgs/applications/window-managers/stumpwm/contrib.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ stdenv, fetchgit }:
-
-let
-  tag = "0.9.8";
-in
-
-stdenv.mkDerivation rec {
- name = "stumpwmContrib-${tag}";
-
- src = fetchgit {
-   url = "https://github.com/stumpwm/stumpwm";
-   rev = "refs/tags/${tag}";
-   sha256 = "0a0lwwlly4hlmb30bk6dmi6bsdsy37g4crvv1z24gixippyv1qzm";
- };
-
-  phases = [ "unpackPhase" "installPhase" ];
-
-  installPhase = ''
-   mkdir -p $out/bin
-   cp -a $src/contrib $out/
-   cp -a $src/contrib/stumpish $out/bin
- '';
-
-  meta = with stdenv.lib; {
-    description = "Extension modules for the StumpWM";
-    homepage    = https://github.com/stumpwm/;
-    license     = licenses.gpl2Plus;
-    maintainers = with maintainers; [ _1126 ];
-    platforms   = platforms.linux;
-  };
-}
\ No newline at end of file
diff --git a/pkgs/applications/window-managers/stumpwm/default.nix b/pkgs/applications/window-managers/stumpwm/default.nix
index 3ed68412b37d..fe62b8250ae4 100644
--- a/pkgs/applications/window-managers/stumpwm/default.nix
+++ b/pkgs/applications/window-managers/stumpwm/default.nix
@@ -1,46 +1,75 @@
-{ stdenv, pkgs, fetchgit, autoconf, sbcl, lispPackages, xdpyinfo, texinfo4, makeWrapper, stumpwmContrib }:
+{ stdenv, pkgs, fetchgit, autoconf, sbcl, lispPackages, xdpyinfo, texinfo4
+, makeWrapper , rlwrap, gnused, gnugrep, coreutils, xprop
+, extraModulePaths ? [] }:
 
 let
-  tag = "0.9.9";
+  version = "0.9.9";
+  contrib = (fetchgit {
+    url = "https://github.com/stumpwm/stumpwm-contrib.git";
+    rev = "e139885fffcedaeba4b263e4575daae4364cad52";
+    sha256 = "fe75bb27538a56f2d213fb21e06a8983699e129a10da7014ddcf6eed5cd965f8";
+  });
 in
-
 stdenv.mkDerivation rec {
- name = "stumpwm-${tag}";
+  name = "stumpwm-${version}";
+
+  src = fetchgit {
+    url = "https://github.com/stumpwm/stumpwm";
+    rev = "refs/tags/${version}";
+    sha256 = "05fkng2wlmhy3kb9zhrrv9zpa16g2p91p5y0wvmwkppy04cw04ps";
+  };
+
+  buildInputs = [
+    texinfo4 makeWrapper autoconf
+    sbcl
+    lispPackages.clx
+    lispPackages.cl-ppcre
+    xdpyinfo
+  ];
+
+  # NOTE: The patch needs an update for the next release.
+  # `(stumpwm:set-module-dir "@MODULE_DIR@")' needs to be in it.
+  patches = [ ./fix-module-path.patch ];
+
+  # Stripping destroys the generated SBCL image
+  dontStrip = true;
 
- src = fetchgit {
-   url = "https://github.com/stumpwm/stumpwm";
-   rev = "refs/tags/${tag}";
-   sha256 = "05fkng2wlmhy3kb9zhrrv9zpa16g2p91p5y0wvmwkppy04cw04ps";
- };
+  configurePhase = ''
+    ./autogen.sh
+    ./configure --prefix=$out --with-module-dir=$out/share/stumpwm/modules
+  '';
 
- buildInputs = [ texinfo4 autoconf lispPackages.clx lispPackages.cl-ppcre sbcl makeWrapper stumpwmContrib ];
+  preBuild = ''
+    cp -r --no-preserve=mode ${contrib} modules
+  '';
 
- phases = [ "unpackPhase" "preConfigurePhase" "configurePhase" "installPhase" ];
+  installPhase = ''
+    mkdir -pv $out/bin
+    make install
 
- preConfigurePhase = ''
-   $src/autogen.sh
-   mkdir -pv $out/bin
- '';
+    mkdir -p $out/share/stumpwm/modules
+    cp -r modules/* $out/share/stumpwm/modules/
+    for d in ${stdenv.lib.concatStringsSep " " extraModulePaths}; do
+      cp -r --no-preserve=mode "$d" $out/share/stumpwm/modules/
+    done
 
- configurePhase = ''
-   ./configure --prefix=$out --with-contrib-dir=${stumpwmContrib}/contrib
- '';
+    # Copy stumpish;
+    cp $out/share/stumpwm/modules/util/stumpish/stumpish $out/bin/
+    chmod +x $out/bin/stumpish
+    wrapProgram $out/bin/stumpish \
+      --prefix PATH ":" "${rlwrap}/bin:${gnused}/bin:${gnugrep}/bin:${coreutils}/bin:${xprop}/bin"
 
- installPhase = ''
-   make
-   make install
-   # For some reason, stumpwmContrib is not retained as a runtime
-   # dependency (probably because $out/bin/stumpwm is compressed or
-   # obfuscated in some way). Thus we add an explicit reference here.
-   mkdir $out/nix-support
-   echo ${stumpwmContrib} > $out/nix-support/stumpwm-contrib
- '';
+    # Paths in the compressed image $out/bin/stumpwm are not
+    # recognized by Nix. Add explicit reference here.
+    mkdir $out/nix-support
+    echo ${xdpyinfo} > $out/nix-support/xdpyinfo
+  '';
 
   meta = with stdenv.lib; {
     description = "A tiling window manager for X11";
     homepage    = https://github.com/stumpwm/;
     license     = licenses.gpl2Plus;
-    maintainers = with maintainers; [ _1126 ];
+    maintainers = with maintainers; [ _1126 the-kenny ];
     platforms   = platforms.linux;
   };
 }
diff --git a/pkgs/applications/window-managers/stumpwm/fix-module-path.patch b/pkgs/applications/window-managers/stumpwm/fix-module-path.patch
new file mode 100644
index 000000000000..79bfaad3dec3
--- /dev/null
+++ b/pkgs/applications/window-managers/stumpwm/fix-module-path.patch
@@ -0,0 +1,16 @@
+diff --git a/make-image.lisp.in b/make-image.lisp.in
+index 121e9d6..2210242 100644
+--- a/make-image.lisp.in
++++ b/make-image.lisp.in
+@@ -2,7 +2,10 @@
+ 
+ (load "load-stumpwm.lisp")
+ 
+-#-ecl (stumpwm:set-module-dir "@CONTRIB_DIR@")
++(setf asdf::*immutable-systems*
++      (uiop:list-to-hash-set (asdf:already-loaded-systems)))
++
++#-ecl (stumpwm:set-module-dir "@MODULE_DIR@")
+ 
+ #+sbcl
+ (sb-ext:save-lisp-and-die "stumpwm" :toplevel (lambda ()
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index af09744f09e7..cb19147eab06 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -11834,7 +11834,6 @@ let
 
   stp = callPackage ../applications/science/logic/stp {};
 
-  stumpwmContrib = callPackage ../applications/window-managers/stumpwm/contrib.nix { };
   stumpwm = callPackage ../applications/window-managers/stumpwm {
     sbcl = sbcl_1_2_5;
     lispPackages = lispPackagesFor (wrapLisp sbcl_1_2_5);