diff options
| author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2017-01-23 16:06:52 +0100 |
|---|---|---|
| committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2017-01-23 16:06:52 +0100 |
| commit | 023678dc00bcc5ebb93a33cec762f48cb9cf80ff (patch) | |
| tree | 778fa160e7185b576e2237ec572b7c6474207234 | |
| parent | e95dac748371afcad3ffddf5c98e5fcb0a8302b7 (diff) | |
| download | thermoprint-023678dc00bcc5ebb93a33cec762f48cb9cf80ff.tar thermoprint-023678dc00bcc5ebb93a33cec762f48cb9cf80ff.tar.gz thermoprint-023678dc00bcc5ebb93a33cec762f48cb9cf80ff.tar.bz2 thermoprint-023678dc00bcc5ebb93a33cec762f48cb9cf80ff.tar.xz thermoprint-023678dc00bcc5ebb93a33cec762f48cb9cf80ff.zip | |
Autogenerate .nix files via gup & cabal2nix
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Gupfile | 4 | ||||
| -rwxr-xr-x | all.gup | 16 | ||||
| -rwxr-xr-x | gup/cabal2nix.sh | 6 |
4 files changed, 27 insertions, 0 deletions
| @@ -4,3 +4,4 @@ | |||
| 4 | **/dist/ | 4 | **/dist/ |
| 5 | **/.cabal-sandbox | 5 | **/.cabal-sandbox |
| 6 | /thermoprint.sqlite | 6 | /thermoprint.sqlite |
| 7 | **/.gup/ | ||
| @@ -0,0 +1,4 @@ | |||
| 1 | gup/cabal2nix.sh: | ||
| 2 | !./default.nix | ||
| 3 | !./shell.nix | ||
| 4 | **/*.nix \ No newline at end of file | ||
| @@ -0,0 +1,16 @@ | |||
| 1 | #!/usr/bin/env zsh | ||
| 2 | |||
| 3 | setopt EXTENDED_GLOB | ||
| 4 | |||
| 5 | typeset -a nixFiles | ||
| 6 | nixFiles=(**/(*~(default|shell)).nix(N)) | ||
| 7 | |||
| 8 | for f (${nixFiles}); do | ||
| 9 | [[ -e ${f:r}.cabal ]] && continue | ||
| 10 | nixFiles=("${(@)nixFiles:#${f}}") | ||
| 11 | done | ||
| 12 | |||
| 13 | print -l ${nixFiles} | gup --contents | ||
| 14 | for f (${nixFiles}); do | ||
| 15 | gup -u ${f} | ||
| 16 | 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 @@ | |||
| 1 | #!/usr/bin/env zsh | ||
| 2 | |||
| 3 | gup -u ${2:r}.cabal | ||
| 4 | |||
| 5 | cd ${2:h} | ||
| 6 | cabal2nix ./. >! ${1} | ||
