From 023678dc00bcc5ebb93a33cec762f48cb9cf80ff Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 23 Jan 2017 16:06:52 +0100 Subject: Autogenerate .nix files via gup & cabal2nix --- .gitignore | 1 + Gupfile | 4 ++++ all.gup | 16 ++++++++++++++++ gup/cabal2nix.sh | 6 ++++++ 4 files changed, 27 insertions(+) create mode 100644 Gupfile create mode 100755 all.gup create mode 100755 gup/cabal2nix.sh diff --git a/.gitignore b/.gitignore index 0a1c2c0..88b1866 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ **/dist/ **/.cabal-sandbox /thermoprint.sqlite +**/.gup/ diff --git a/Gupfile b/Gupfile new file mode 100644 index 0000000..f494843 --- /dev/null +++ b/Gupfile @@ -0,0 +1,4 @@ +gup/cabal2nix.sh: + !./default.nix + !./shell.nix + **/*.nix \ No newline at end of file diff --git a/all.gup b/all.gup new file mode 100755 index 0000000..b1627cb --- /dev/null +++ b/all.gup @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh + +setopt EXTENDED_GLOB + +typeset -a nixFiles +nixFiles=(**/(*~(default|shell)).nix(N)) + +for f (${nixFiles}); do + [[ -e ${f:r}.cabal ]] && continue + nixFiles=("${(@)nixFiles:#${f}}") +done + +print -l ${nixFiles} | gup --contents +for f (${nixFiles}); do + gup -u ${f} +done diff --git a/gup/cabal2nix.sh b/gup/cabal2nix.sh new file mode 100755 index 0000000..ba23c4e --- /dev/null +++ b/gup/cabal2nix.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env zsh + +gup -u ${2:r}.cabal + +cd ${2:h} +cabal2nix ./. >! ${1} -- cgit v1.2.3