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.

+73 -60
-31
pkgs/applications/window-managers/stumpwm/contrib.nix
··· 1 - { stdenv, fetchgit }: 2 - 3 - let 4 - tag = "0.9.8"; 5 - in 6 - 7 - stdenv.mkDerivation rec { 8 - name = "stumpwmContrib-${tag}"; 9 - 10 - src = fetchgit { 11 - url = "https://github.com/stumpwm/stumpwm"; 12 - rev = "refs/tags/${tag}"; 13 - sha256 = "0a0lwwlly4hlmb30bk6dmi6bsdsy37g4crvv1z24gixippyv1qzm"; 14 - }; 15 - 16 - phases = [ "unpackPhase" "installPhase" ]; 17 - 18 - installPhase = '' 19 - mkdir -p $out/bin 20 - cp -a $src/contrib $out/ 21 - cp -a $src/contrib/stumpish $out/bin 22 - ''; 23 - 24 - meta = with stdenv.lib; { 25 - description = "Extension modules for the StumpWM"; 26 - homepage = https://github.com/stumpwm/; 27 - license = licenses.gpl2Plus; 28 - maintainers = with maintainers; [ _1126 ]; 29 - platforms = platforms.linux; 30 - }; 31 - }
+57 -28
pkgs/applications/window-managers/stumpwm/default.nix
··· 1 - { stdenv, pkgs, fetchgit, autoconf, sbcl, lispPackages, xdpyinfo, texinfo4, makeWrapper, stumpwmContrib }: 1 + { stdenv, pkgs, fetchgit, autoconf, sbcl, lispPackages, xdpyinfo, texinfo4 2 + , makeWrapper , rlwrap, gnused, gnugrep, coreutils, xprop 3 + , extraModulePaths ? [] }: 2 4 3 5 let 4 - tag = "0.9.9"; 6 + version = "0.9.9"; 7 + contrib = (fetchgit { 8 + url = "https://github.com/stumpwm/stumpwm-contrib.git"; 9 + rev = "e139885fffcedaeba4b263e4575daae4364cad52"; 10 + sha256 = "fe75bb27538a56f2d213fb21e06a8983699e129a10da7014ddcf6eed5cd965f8"; 11 + }); 5 12 in 13 + stdenv.mkDerivation rec { 14 + name = "stumpwm-${version}"; 6 15 7 - stdenv.mkDerivation rec { 8 - name = "stumpwm-${tag}"; 16 + src = fetchgit { 17 + url = "https://github.com/stumpwm/stumpwm"; 18 + rev = "refs/tags/${version}"; 19 + sha256 = "05fkng2wlmhy3kb9zhrrv9zpa16g2p91p5y0wvmwkppy04cw04ps"; 20 + }; 21 + 22 + buildInputs = [ 23 + texinfo4 makeWrapper autoconf 24 + sbcl 25 + lispPackages.clx 26 + lispPackages.cl-ppcre 27 + xdpyinfo 28 + ]; 29 + 30 + # NOTE: The patch needs an update for the next release. 31 + # `(stumpwm:set-module-dir "@MODULE_DIR@")' needs to be in it. 32 + patches = [ ./fix-module-path.patch ]; 33 + 34 + # Stripping destroys the generated SBCL image 35 + dontStrip = true; 9 36 10 - src = fetchgit { 11 - url = "https://github.com/stumpwm/stumpwm"; 12 - rev = "refs/tags/${tag}"; 13 - sha256 = "05fkng2wlmhy3kb9zhrrv9zpa16g2p91p5y0wvmwkppy04cw04ps"; 14 - }; 37 + configurePhase = '' 38 + ./autogen.sh 39 + ./configure --prefix=$out --with-module-dir=$out/share/stumpwm/modules 40 + ''; 15 41 16 - buildInputs = [ texinfo4 autoconf lispPackages.clx lispPackages.cl-ppcre sbcl makeWrapper stumpwmContrib ]; 42 + preBuild = '' 43 + cp -r --no-preserve=mode ${contrib} modules 44 + ''; 17 45 18 - phases = [ "unpackPhase" "preConfigurePhase" "configurePhase" "installPhase" ]; 46 + installPhase = '' 47 + mkdir -pv $out/bin 48 + make install 19 49 20 - preConfigurePhase = '' 21 - $src/autogen.sh 22 - mkdir -pv $out/bin 23 - ''; 50 + mkdir -p $out/share/stumpwm/modules 51 + cp -r modules/* $out/share/stumpwm/modules/ 52 + for d in ${stdenv.lib.concatStringsSep " " extraModulePaths}; do 53 + cp -r --no-preserve=mode "$d" $out/share/stumpwm/modules/ 54 + done 24 55 25 - configurePhase = '' 26 - ./configure --prefix=$out --with-contrib-dir=${stumpwmContrib}/contrib 27 - ''; 56 + # Copy stumpish; 57 + cp $out/share/stumpwm/modules/util/stumpish/stumpish $out/bin/ 58 + chmod +x $out/bin/stumpish 59 + wrapProgram $out/bin/stumpish \ 60 + --prefix PATH ":" "${rlwrap}/bin:${gnused}/bin:${gnugrep}/bin:${coreutils}/bin:${xprop}/bin" 28 61 29 - installPhase = '' 30 - make 31 - make install 32 - # For some reason, stumpwmContrib is not retained as a runtime 33 - # dependency (probably because $out/bin/stumpwm is compressed or 34 - # obfuscated in some way). Thus we add an explicit reference here. 35 - mkdir $out/nix-support 36 - echo ${stumpwmContrib} > $out/nix-support/stumpwm-contrib 37 - ''; 62 + # Paths in the compressed image $out/bin/stumpwm are not 63 + # recognized by Nix. Add explicit reference here. 64 + mkdir $out/nix-support 65 + echo ${xdpyinfo} > $out/nix-support/xdpyinfo 66 + ''; 38 67 39 68 meta = with stdenv.lib; { 40 69 description = "A tiling window manager for X11"; 41 70 homepage = https://github.com/stumpwm/; 42 71 license = licenses.gpl2Plus; 43 - maintainers = with maintainers; [ _1126 ]; 72 + maintainers = with maintainers; [ _1126 the-kenny ]; 44 73 platforms = platforms.linux; 45 74 }; 46 75 }
+16
pkgs/applications/window-managers/stumpwm/fix-module-path.patch
··· 1 + diff --git a/make-image.lisp.in b/make-image.lisp.in 2 + index 121e9d6..2210242 100644 3 + --- a/make-image.lisp.in 4 + +++ b/make-image.lisp.in 5 + @@ -2,7 +2,10 @@ 6 + 7 + (load "load-stumpwm.lisp") 8 + 9 + -#-ecl (stumpwm:set-module-dir "@CONTRIB_DIR@") 10 + +(setf asdf::*immutable-systems* 11 + + (uiop:list-to-hash-set (asdf:already-loaded-systems))) 12 + + 13 + +#-ecl (stumpwm:set-module-dir "@MODULE_DIR@") 14 + 15 + #+sbcl 16 + (sb-ext:save-lisp-and-die "stumpwm" :toplevel (lambda ()
-1
pkgs/top-level/all-packages.nix
··· 11834 11834 11835 11835 stp = callPackage ../applications/science/logic/stp {}; 11836 11836 11837 - stumpwmContrib = callPackage ../applications/window-managers/stumpwm/contrib.nix { }; 11838 11837 stumpwm = callPackage ../applications/window-managers/stumpwm { 11839 11838 sbcl = sbcl_1_2_5; 11840 11839 lispPackages = lispPackagesFor (wrapLisp sbcl_1_2_5);