From adc2e34deb47900a7c5411043ba2186450fdbf59 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 28 Sep 2019 15:27:19 +0200 Subject: [PATCH] Remove the bash implementation --- arion-compose.cabal | 1 - arion.nix | 39 ------ src/arion | 317 -------------------------------------------- 3 files changed, 357 deletions(-) delete mode 100644 arion.nix delete mode 100755 src/arion diff --git a/arion-compose.cabal b/arion-compose.cabal index 77891a7..18e4fb3 100644 --- a/arion-compose.cabal +++ b/arion-compose.cabal @@ -19,7 +19,6 @@ data-files: nix/*.nix , nix/modules/composition/*.nix , nix/modules/nixos/*.nix , nix/modules/service/*.nix - , arion-image/Dockerfile -- all data is verbatim from some sources data-dir: src diff --git a/arion.nix b/arion.nix deleted file mode 100644 index 2b4f81a..0000000 --- a/arion.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ stdenv, lib -, coreutils, docker_compose, jq -}: -let - - # TODO: Replace by a new expression for the new Haskell main - arion = stdenv.mkDerivation { - name = "arion"; - src = ./src; - unpackPhase = ""; - buildPhase = ""; - installPhase = '' - mkdir -p $out/bin $out/share/arion - cp -a nix $out/share/arion/ - cp -a arion-image $out/share/arion/ - tar -czf $out/share/arion/arion-image/tarball.tar.gz -C arion-image/tarball . - substitute arion $out/bin/arion \ - --subst-var-by path ${lib.makeBinPath [jq coreutils docker_compose]} \ - --subst-var-by nix_dir $out/share/arion/nix \ - ; - chmod a+x $out/bin/arion - ''; - inherit passthru; - }; - - passthru = { - inherit eval build; - }; - - eval = import "${nix_dir}/eval-composition.nix"; - - build = args@{...}: - let composition = eval args; - in composition.config.build.dockerComposeYaml; - - nix_dir = "${arion.outPath}/share/arion/nix"; - -in - arion diff --git a/src/arion b/src/arion deleted file mode 100755 index f8aff15..0000000 --- a/src/arion +++ /dev/null @@ -1,317 +0,0 @@ -#!/usr/bin/env bash - -# Close off the python module search path -# -# Accepting directories from the environment into the search path -# tends to break things. Docker Compose does not have a plugin -# system as far as I can tell, so I don't expect this to break a -# feature, but rather to make the program more robustly self- -# contained. -unset PYTHONPATH - -set -euo pipefail - -export PATH="@path@:$PATH" - -nix_dir="@nix_dir@" -docker_compose_args=() -files=() -command="docker-compose" -pkgs_argument="./arion-pkgs.nix" - -debug() { - # echo "$@" - : -} - -while test $# != 0; do - case "$1" in - -f|--file) - shift - files+=("$1") - ;; - -f*) - files+=("${1/#-f/}") - ;; - --file=*) - files+=("${1/#--file=}") - ;; - --pkgs) - shift - pkgs_argument="$1" - ;; - -h|--help|help) - command="help" - shift - break - ;; - cat) - command="$1" - shift - break - ;; - repl) - command="$1" - shift - break - ;; - exec) - command="$1" - shift - break - ;; - docker-compose) - command="docker-compose" - shift - break - ;; - *) - break - ;; - esac - shift -done - -while test $# != 0; do - docker_compose_args+=("$1") - shift -done - -case "$command" in - help) - cat <&2 "Evaluating configuration..." - # read-write-mode is required for import from derivation - nix-instantiate \ - "$nix_dir/eval-composition.nix" \ - --eval \ - --read-write-mode \ - --json \ - --argstr uid "$UID" \ - --arg modules "$modules" \ - --arg pkgs "$pkgs_argument" \ - --show-trace \ - --attr 'config.build.dockerComposeYamlText' \ - | jq -r . >$docker_compose_yaml; -} - -do_build() { - echo 1>&2 "Building configuration..." - nix-build \ - "$nix_dir/eval-composition.nix" \ - --out-link $docker_compose_yaml \ - --argstr uid "$UID" \ - --arg modules "$modules" \ - --arg pkgs "$pkgs_argument" \ - --show-trace \ - --attr 'config.build.dockerComposeYaml' \ - >/dev/null ; - - echo 1>&2 "Ensuring required images are loaded..." - jq -r <"$docker_compose_yaml" \ - '.["x-arion"].images | map(" - " + .imageName + ":" + .imageTag) | join("\n")' - eval "$( - jq -r '.["docker-compose"]["x-arion"].images as $images - | .["existing-images"] as $loaded - | $images - | map( - if $loaded[.imageName + ":" + .imageTag] - then "" - else "docker load <" + .image + ";" end - ) - | join("\n") - ' < arguments - # so we improvise. We need a file in this directory - # to make sure that all paths are as expected :( - trap do_repl_cleanup EXIT; - - REPL_TMP=.tmp-repl-$$-$RANDOM - cat <"$REPL_TMP" <