[XMonad] Use nix for xmonad build script

This commit is contained in:
Ivan Malison 2019-06-06 00:34:29 -07:00
parent a1338e63f1
commit 34e1eecd6b
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
3 changed files with 6 additions and 29 deletions

View File

@ -1,32 +1,11 @@
#!/usr/bin/env bash #!/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 )" SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
EXE_NAME=imalison-xmonad
EXE_LOCATION=$(get_exe_dir)/bin/$EXE_NAME
output_file=$1; shift output_file=$1; shift
if [ -e ./.cached-stack-install-path ]; then cd "$SRC_DIR"
last_built=$(stat -c '%Y' $EXE_LOCATION) exe_location="$SRC_DIR/result/bin/imalison-xmonad"
xmonad_modified=$(stat -c '%Y' ./xmonad.hs) nix-build
echo "$exe_location" "$output_file" > did_build
[ $last_built -lt $xmonad_modified ] && stack install cp -f "$exe_location" "$output_file"
else
stack install
fi
cp -uf $EXE_LOCATION $output_file

View File

@ -29,6 +29,5 @@ executable imalison-xmonad
, xmonad-contrib>=0.13 , xmonad-contrib>=0.13
, xmonad>=0.13 , xmonad>=0.13
hs-source-dirs: . hs-source-dirs: .
src
other-modules: PagerHints other-modules: PagerHints
default-language: Haskell2010 default-language: Haskell2010

View File

@ -213,7 +213,6 @@ emacsCommand = "emacsclient -c"
htopCommand = "termite -e htop -t htop" htopCommand = "termite -e htop -t htop"
transmissionCommand = "transmission-gtk" transmissionCommand = "transmission-gtk"
volumeCommand = "pavucontrol" volumeCommand = "pavucontrol"
taffybarCommand = "restart_taffybar.sh"
-- Startup hook -- Startup hook