From 34e1eecd6b5a91e8b39f43fb758d8021541fa295 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 6 Jun 2019 00:34:29 -0700 Subject: [PATCH] [XMonad] Use nix for xmonad build script --- dotfiles/config/xmonad/build | 31 ++++---------------- dotfiles/config/xmonad/imalison-xmonad.cabal | 3 +- dotfiles/config/xmonad/xmonad.hs | 1 - 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/dotfiles/config/xmonad/build b/dotfiles/config/xmonad/build index b1282a26..e0dc98aa 100755 --- a/dotfiles/config/xmonad/build +++ b/dotfiles/config/xmonad/build @@ -1,32 +1,11 @@ #!/usr/bin/env bash -function min { - [ $1 -le $2 ] && echo "$1" || echo "$2" -} - -function get_exe_dir { - # XXX: This exists because calling in to stack is kind of slow with nix - # integration enabled, even when just using it to get a path. - if [ -e ./.cached-stack-install-path ]; then - cat .cached-stack-install-path - else - stack path --local-install-root - fi -} - SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -EXE_NAME=imalison-xmonad -EXE_LOCATION=$(get_exe_dir)/bin/$EXE_NAME output_file=$1; shift -if [ -e ./.cached-stack-install-path ]; then - last_built=$(stat -c '%Y' $EXE_LOCATION) - xmonad_modified=$(stat -c '%Y' ./xmonad.hs) - - [ $last_built -lt $xmonad_modified ] && stack install -else - stack install -fi - -cp -uf $EXE_LOCATION $output_file +cd "$SRC_DIR" +exe_location="$SRC_DIR/result/bin/imalison-xmonad" +nix-build +echo "$exe_location" "$output_file" > did_build +cp -f "$exe_location" "$output_file" diff --git a/dotfiles/config/xmonad/imalison-xmonad.cabal b/dotfiles/config/xmonad/imalison-xmonad.cabal index 4469c3c0..29cd7a81 100644 --- a/dotfiles/config/xmonad/imalison-xmonad.cabal +++ b/dotfiles/config/xmonad/imalison-xmonad.cabal @@ -29,6 +29,5 @@ executable imalison-xmonad , xmonad-contrib>=0.13 , xmonad>=0.13 hs-source-dirs: . - src - other-modules: PagerHints + other-modules: PagerHints default-language: Haskell2010 diff --git a/dotfiles/config/xmonad/xmonad.hs b/dotfiles/config/xmonad/xmonad.hs index 67beee97..8e31c8b1 100644 --- a/dotfiles/config/xmonad/xmonad.hs +++ b/dotfiles/config/xmonad/xmonad.hs @@ -213,7 +213,6 @@ emacsCommand = "emacsclient -c" htopCommand = "termite -e htop -t htop" transmissionCommand = "transmission-gtk" volumeCommand = "pavucontrol" -taffybarCommand = "restart_taffybar.sh" -- Startup hook