diff --git a/README.md b/README.md index 470c392..4b43a9a 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,7 @@ On macOS, non-root Nix store support is made possible by [fakedir](https://githu ## How do I add Nixie to my project? -To "install" Nixie onto your project's Git repository, you need to be running the Nix package manager, preferably with flakes enabled. - -
- - - -### You have flakes enabled - +To "install" Nixie onto your project's Git repository, you need to be running the Nix package manager, with [flakes](https://wiki.nixos.org/wiki/Flakes#Setup) enabled. You only need to run one command. Make sure your current directory is this of the project you wish to populate. @@ -28,38 +21,6 @@ You only need to run one command. Make sure your current directory is this of th nix run github:nixie-dev/nixie ``` -
- -
- - - -### You don't use flakes - - -In this case, you need to retrieve Nixie manually, either by cloning this repository or adding it as a Nix channel: - -#### As a Nix channel - -```sh -nix-channel --add https://github.com/nixie-dev/nixie/archive/master.tar.gz nixie -nix-channel --update -nix-env -iA nixie -``` - -#### By cloning this repository - -```sh -git clone https://github.com/nixie-dev/nixie -nix-shell /path/to/cloned/nixie/shell.nix -``` - -While it is possible to build Nixie directly from this repository, the resulting binary still requires Nix to be available on setup. - -Once you have acquired Nixie, simply run `nixie` to automatically configure the repository you're in. - -
- ## What do the generated files mean? Running the `nix` script at the root of your repository will automatically determine if you have Nix installed or not. If Nix is installed, it will just redirect the call to your system-wide Nix. It's when it is _not installed_ that the magic happens. diff --git a/default.nix b/default.nix index 51b58e4..77ce01e 100644 --- a/default.nix +++ b/default.nix @@ -1,46 +1,21 @@ { lib, python3Packages, fetchPypi, nix-index, nix, hatch, amber-lang -, libfaketime, ... }: +, ... }: let - nixie_ver = "2025.02-a2"; + nixie_ver = "2026.03-a1"; pzp = python3Packages.buildPythonPackage rec { pname = "pzp"; - version = "0.0.27"; + version = "0.0.28"; + pyproject = true; + build-system = with python3Packages; [ setuptools ]; src = fetchPypi { inherit pname version; - sha256 = "sha256-HwsOJA3spcCUFvIBLFkSpMIPZgcU9r1JkAgt0Cj/oUg="; + sha256 = "sha256-xO3x2v5yT5cxz4pa7Ug/f2sQFkJcMIVSWLfj/Lm70E4="; }; doCheck = false; }; - hatch-build-scripts = python3Packages.buildPythonPackage rec { - pname = "hatch-build-scripts"; - version = "0.0.4"; - format = "pyproject"; - - buildInputs = - [ hatch - ]; - - src = fetchPypi { - inherit version; - pname = "hatch_build_scripts"; - sha256 = "sha256-x4UgmGkH5HU48suyT95B7fwsxV9FK1Ni+64Vzk5jRPc="; - }; - }; - - # By default, Amber adds a header with the build time, which can't be disabled. - # This wraps the compiler in faketime to make the timestamp reproducible. - # See amber-lang/amber#672 - amber-reproducible = amber-lang.overrideAttrs (self: super: { - postInstall = '' - ${super.postInstall} - mv $out/bin/amber $out/bin/.amber-orig - makeWrapper ${libfaketime}/bin/faketime $out/bin/amber \ - --add-flags "-f '1970-01-01 01:00:00' $out/bin/.amber-orig" - ''; - }); in python3Packages.buildPythonApplication { pname = "nixie"; version = nixie_ver; @@ -48,11 +23,10 @@ in python3Packages.buildPythonApplication { src = ./.; format = "pyproject"; - nativeBuildInputs = + nativeBuildInputs = with python3Packages; [ hatch hatch-build-scripts - amber-reproducible - libfaketime + amber-lang ]; propagatedBuildInputs = with python3Packages; diff --git a/flake.lock b/flake.lock index 07c0328..23ee4e8 100644 --- a/flake.lock +++ b/flake.lock @@ -8,16 +8,15 @@ "utils": "utils" }, "locked": { - "lastModified": 1740394272, - "narHash": "sha256-s/ZxG/ZB1hDhH2pTlHV0ANgQid18gnva6NnF/7G8nr0=", - "owner": "thesola10", + "lastModified": 1772528384, + "narHash": "sha256-KsSaLlrYtpsxq5lxpkyCR1VGx1c3pGmMzTJG5HavMms=", + "owner": "amber-lang", "repo": "amber", - "rev": "d9acb8aa6a49ae77041fccc61c93e60f5aa429a6", + "rev": "dd1b7dc7313b1de1c0b958ba17f06655f3ff9d42", "type": "github" }, "original": { - "owner": "thesola10", - "ref": "nameof-function", + "owner": "amber-lang", "repo": "amber", "type": "github" } @@ -138,11 +137,11 @@ ] }, "locked": { - "lastModified": 1721727458, - "narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=", + "lastModified": 1739824009, + "narHash": "sha256-fcNrCMUWVLMG3gKC5M9CBqVOAnJtyRvGPxptQFl5mVg=", "owner": "nix-community", "repo": "naersk", - "rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11", + "rev": "e5130d37369bfa600144c2424270c96f0ef0e11d", "type": "github" }, "original": { @@ -178,11 +177,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722415718, - "narHash": "sha256-5US0/pgxbMksF92k1+eOa8arJTJiPvsdZj9Dl+vJkM4=", + "lastModified": 1741037377, + "narHash": "sha256-SvtvVKHaUX4Owb+PasySwZsoc5VUeTf1px34BByiOxw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c3392ad349a5227f4a3464dce87bcc5046692fce", + "rev": "02032da4af073d0f6110540c8677f16d4be0117f", "type": "github" }, "original": { @@ -242,11 +241,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1740402658, - "narHash": "sha256-r9gIbKRxH+tzXkXfgYoGVeywS9r3zirUya2ibrrqNeE=", + "lastModified": 1771520265, + "narHash": "sha256-ZVfCQHlXPP6ju9u9UQ4RrmVCif3wJvo5Scm5RhtGEZw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9de281f1057097fe911e69fc5816268b020f61af", + "rev": "ff246e499c33164ff8c27d820035d56b95eff4ca", "type": "github" }, "original": { @@ -272,11 +271,11 @@ ] }, "locked": { - "lastModified": 1722479030, - "narHash": "sha256-98tsdV+N9wSVU0vlzjJ30+9QL2bescJs5jWFurTpvAw=", + "lastModified": 1741141853, + "narHash": "sha256-FauVtC+FbOgkKpGVuQTNxSqrvgbmVc7hFkjn/DacwMo=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c02e7d32607e4e16c80152a40ee141c4877b00cb", + "rev": "02edad1f19d6dec824e0812e4cdc0aa7930ff8ae", "type": "github" }, "original": { @@ -320,11 +319,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index fc54178..a186273 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "Put Nix in everything!"; inputs.nixpkgs.url = github:nixos/nixpkgs; - inputs.amber.url = github:thesola10/amber/nameof-function; + inputs.amber.url = github:amber-lang/amber; inputs.nix.url = github:nixos/nix/2.26.2; inputs.fakedir = { url = github:nixie-dev/fakedir; diff --git a/nix b/nix index 93889f1..fd09ea6 100755 --- a/nix +++ b/nix @@ -1,572 +1,575 @@ #!/usr/bin/env bash -# Written in [Amber](https://amber-lang.com/) -# version: 0.4.0-alpha -# date: 1970-01-01 01:00:00 -split__3_v0() { - local text=$1 - local delimiter=$2 - __AMBER_ARRAY_0=(); - local result=("${__AMBER_ARRAY_0[@]}") - IFS="${delimiter}" read -rd '' -a result < <(printf %s "$text") ; - __AS=$? - __AF_split3_v0=("${result[@]}"); - return 0 -} -split_lines__4_v0() { - local text=$1 - split__3_v0 "${text}" " -"; - __AF_split3_v0__40_12=("${__AF_split3_v0[@]}"); - __AF_split_lines4_v0=("${__AF_split3_v0__40_12[@]}"); +# Nix wrapper script, generated by Nixie (https://github.com/nixie-dev/nixie) +# Nixie (c) Karim Vergnes +# Built using Amber 0.5.1-alpha-nix-dd1b7dc (https://amber-lang.com) + +[ "$EUID" -ne 0 ] && { { command -v sudo >/dev/null 2>&1 && __sudo=sudo; } || { command -v doas >/dev/null 2>&1 && __sudo=doas; }; } +split__5_v0() { + local text_259="${1}" + local delimiter_260="${2}" + local result_261=() + IFS="${delimiter_260}" read -rd '' -a result_261 < <(printf %s "$text_259") + __status=$? + ret_split5_v0=("${result_261[@]}") return 0 } -join__6_v0() { - local list=("${!1}") - local delimiter=$2 - __AMBER_VAL_1=$( IFS="${delimiter}" ; echo "${list[*]}" ); - __AS=$?; - __AF_join6_v0="${__AMBER_VAL_1}"; + +join__8_v0() { + local list_267=("${!1}") + local delimiter_268="${2}" + local command_1 + command_1="$(IFS="${delimiter_268}" ; printf "%s +" "${list_267[*]}")" + __status=$? + ret_join8_v0="${command_1}" return 0 } -parse_number__12_v0() { - local text=$1 - [ -n "${text}" ] && [ "${text}" -eq "${text}" ] 2>/dev/null ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_parse_number12_v0='' -return $__AS -fi - __AF_parse_number12_v0="${text}"; + +parse_int__14_v0() { + local text_2760="${1}" + [ -n "${text_2760}" ] && [ "${text_2760}" -eq "${text_2760}" ] 2>/dev/null + __status=$? + if [ "${__status}" != 0 ]; then + ret_parse_int14_v0='' + return "${__status}" + fi + ret_parse_int14_v0="${text_2760}" return 0 } -text_contains__14_v0() { - local text=$1 - local phrase=$2 - __AMBER_VAL_2=$( if [[ "${text}" == *"${phrase}"* ]]; then - echo 1 - fi ); - __AS=$?; - local result="${__AMBER_VAL_2}" - __AF_text_contains14_v0=$([ "_${result}" != "_1" ]; echo $?); + +text_contains__17_v0() { + local source_22="${1}" + local search_23="${2}" + [[ "${source_22}" == *"${search_23}"* ]] + __status=$? + ret_text_contains17_v0="$(( __status == 0 ))" return 0 } -starts_with__20_v0() { - local text=$1 - local prefix=$2 - __AMBER_VAL_3=$( if [[ "${text}" == "${prefix}"* ]]; then - echo 1 - fi ); - __AS=$?; - local result="${__AMBER_VAL_3}" - __AF_starts_with20_v0=$([ "_${result}" != "_1" ]; echo $?); + +starts_with__23_v0() { + local text_26="${1}" + local prefix_27="${2}" + [[ "${text_26}" == "${prefix_27}"* ]] + __status=$? + ret_starts_with23_v0="$(( __status == 0 ))" return 0 } -ends_with__21_v0() { - local text=$1 - local suffix=$2 - __AMBER_VAL_4=$( if [[ "${text}" == *"${suffix}" ]]; then - echo 1 - fi ); - __AS=$?; - local result="${__AMBER_VAL_4}" - __AF_ends_with21_v0=$([ "_${result}" != "_1" ]; echo $?); + +ends_with__24_v0() { + local text_2842="${1}" + local suffix_2843="${2}" + [[ "${text_2842}" == *"${suffix_2843}" ]] + __status=$? + ret_ends_with24_v0="$(( __status == 0 ))" return 0 } -slice__22_v0() { - local text=$1 - local index=$2 - local length=$3 - if [ $(echo ${length} '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_LEN="${text}"; - length=$(echo "${#__AMBER_LEN}" '-' ${index} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') -fi - if [ $(echo ${length} '<=' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AF_slice22_v0=""; + +slice__25_v0() { + local text_245="${1}" + local index_246="${2}" + local length_247="${3}" + local result_248="" + if [ "$(( length_247 == 0 ))" != 0 ]; then + local __length_2="${text_245}" + length_247="$(( ${#__length_2} - index_246 ))" + fi + if [ "$(( length_247 <= 0 ))" != 0 ]; then + ret_slice25_v0="${result_248}" return 0 -fi - __AMBER_VAL_5=$( printf "%.${length}s" "${text:${index}}" ); - __AS=$?; - __AF_slice22_v0="${__AMBER_VAL_5}"; + fi + result_248="${text_245: ${index_246}: ${length_247}}" + __status=$? + ret_slice25_v0="${result_248}" return 0 } -dir_exists__32_v0() { - local path=$1 - [ -d "${path}" ] ; - __AS=$?; -if [ $__AS != 0 ]; then - __AF_dir_exists32_v0=0; - return 0 -fi - __AF_dir_exists32_v0=1; + +dir_exists__41_v0() { + local path_252="${1}" + [ -d "${path_252}" ] + __status=$? + ret_dir_exists41_v0="$(( __status == 0 ))" return 0 } -file_exists__33_v0() { - local path=$1 - [ -f "${path}" ] ; - __AS=$?; -if [ $__AS != 0 ]; then - __AF_file_exists33_v0=0; - return 0 -fi - __AF_file_exists33_v0=1; + +file_exists__42_v0() { + local path_284="${1}" + [ -f "${path_284}" ] + __status=$? + ret_file_exists42_v0="$(( __status == 0 ))" return 0 } -file_write__35_v0() { - local path=$1 - local content=$2 - __AMBER_VAL_6=$( echo "${content}" > "${path}" ); - __AS=$?; -if [ $__AS != 0 ]; then -__AF_file_write35_v0='' -return $__AS -fi; - __AF_file_write35_v0="${__AMBER_VAL_6}"; + +file_write__44_v0() { + local path_2830="${1}" + local content_2831="${2}" + local command_3 + command_3="$(printf '%s +' "${content_2831}" > "${path_2830}")" + __status=$? + if [ "${__status}" != 0 ]; then + ret_file_write44_v0='' + return "${__status}" + fi + ret_file_write44_v0="${command_3}" return 0 } -dir_create__38_v0() { - local path=$1 - dir_exists__32_v0 "${path}"; - __AF_dir_exists32_v0__52_12="$__AF_dir_exists32_v0"; - if [ $(echo '!' "$__AF_dir_exists32_v0__52_12" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - mkdir -p "${path}" ; - __AS=$? -fi + +dir_create__47_v0() { + local path_251="${1}" + dir_exists__41_v0 "${path_251}" + local ret_dir_exists41_v0__87_12="${ret_dir_exists41_v0}" + if [ "$(( ! ret_dir_exists41_v0__87_12 ))" != 0 ]; then + mkdir -p "${path_251}" + __status=$? + if [ "${__status}" != 0 ]; then + ret_dir_create47_v0='' + return "${__status}" + fi + fi } -env_var_test__87_v0() { - local name=$1 - [[ ! -z ${!name+z} ]] ; - __AS=$?; -if [ $__AS != 0 ]; then - __AF_env_var_test87_v0=0; - return 0 -fi - __AF_env_var_test87_v0=1; + +array_last__74_v0() { + local array_2754=("${!1}") + local __length_4=("${array_2754[@]}") + local index_2755="$(( ${#__length_4[@]} - 1 ))" + if [ "$(( index_2755 < 0 ))" != 0 ]; then + ret_array_last74_v0='' + return 1 + fi + ret_array_last74_v0="${array_2754[${index_2755}]}" return 0 } -env_var_set__90_v0() { - local name=$1 - local val=$2 - export $name="$val" 2> /dev/null ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_env_var_set90_v0='' -return $__AS -fi + +array_pop__77_v0() { + local array_263=("${1}") + eval "local array_263_deref_84=(\"\${${array_263[0]}[@]}\")" + local __length_5=("${array_263_deref_84[@]}") + local length_264="${#__length_5[@]}" + local index_265="$(( length_264 - 1 ))" + if [ "$(( index_265 < 0 ))" != 0 ]; then + ret_array_pop77_v0='' + return 1 + fi + eval "local array_263_deref_85=\"\${${array_263[0]}[${index_265}]}\"" + local element_266="${array_263_deref_85}" + local slice_upper_6="${index_265}" + local slice_offset_7=0 + local slice_offset_7=$((${slice_offset_7} > 0 ? ${slice_offset_7} : 0)) + local slice_length_8="$(( slice_upper_6 - slice_offset_7 ))" + local slice_length_8=$((${slice_length_8} > 0 ? ${slice_length_8} : 0)) + eval "local array_263_deref_86=(\"\${${array_263[0]}[@]:\${slice_offset_7}:\${slice_length_8}}\")" + eval "${array_263}=(\"\${array_263_deref_86[@]}\")" + ret_array_pop77_v0="${element_266}" + return 0 } -env_var_get__91_v0() { - local name=$1 - __AMBER_VAL_7=$( echo ${!name} ); - __AS=$?; -if [ $__AS != 0 ]; then -__AF_env_var_get91_v0='' -return $__AS -fi; - __AF_env_var_get91_v0="${__AMBER_VAL_7}"; + +array_shift__78_v0() { + local array_279=("${1}") + eval "local array_279_deref_87=(\"\${${array_279[0]}[@]}\")" + local __length_9=("${array_279_deref_87[@]}") + local length_280="${#__length_9[@]}" + if [ "$(( length_280 == 0 ))" != 0 ]; then + ret_array_shift78_v0='' + return 1 + fi + eval "local array_279_deref_88=\"\${${array_279[0]}[0]}\"" + local element_281="${array_279_deref_88}" + local slice_upper_10="${length_280}" + local slice_offset_11=1 + local slice_offset_11=$((${slice_offset_11} > 0 ? ${slice_offset_11} : 0)) + local slice_length_12="$(( slice_upper_10 - slice_offset_11 ))" + local slice_length_12=$((${slice_length_12} > 0 ? ${slice_length_12} : 0)) + eval "local array_279_deref_89=(\"\${${array_279[0]}[@]:\${slice_offset_11}:\${slice_length_12}}\")" + eval "${array_279}=(\"\${array_279_deref_89[@]}\")" + ret_array_shift78_v0="${element_281}" return 0 } -is_command__93_v0() { - local command=$1 - [ -x "$(command -v ${command})" ] ; - __AS=$?; -if [ $__AS != 0 ]; then - __AF_is_command93_v0=0; + +env_var_test__119_v0() { + local name_2752="${1}" + [[ ! -z ${!name_2752+z} ]] + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_test119_v0=0 return 0 -fi - __AF_is_command93_v0=1; + fi + ret_env_var_test119_v0=1 return 0 } -printf__99_v0() { - local format=$1 - local args=("${!2}") - args=("${format}" "${args[@]}") ; - __AS=$? - printf "${args[@]}" ; - __AS=$? -} -echo_warning__108_v0() { - local message=$1 - __AMBER_ARRAY_8=("${message}"); - printf__99_v0 "\x1b[1;3;97;43m%s\x1b[0m -" __AMBER_ARRAY_8[@]; - __AF_printf99_v0__157_5="$__AF_printf99_v0"; - echo "$__AF_printf99_v0__157_5" > /dev/null 2>&1 -} -echo_error__109_v0() { - local message=$1 - local exit_code=$2 - __AMBER_ARRAY_9=("${message}"); - printf__99_v0 "\x1b[1;3;97;41m%s\x1b[0m -" __AMBER_ARRAY_9[@]; - __AF_printf99_v0__162_5="$__AF_printf99_v0"; - echo "$__AF_printf99_v0__162_5" > /dev/null 2>&1 - if [ $(echo ${exit_code} '>' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - exit ${exit_code} -fi + +env_var_set__121_v0() { + local name_272="${1}" + local val_273="${2}" + export $name_272="$val_273" 2> /dev/null + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_set121_v0='' + return "${__status}" + fi } -array_last__116_v0() { - local array=("${!1}") - local index=$(echo "${#array[@]}" '-' 1 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') - __AF_array_last116_v0="${array[${index}]}"; + +env_var_get__122_v0() { + local name_16="${1}" + local command_13 + command_13="$(printf "%s +" "${!name_16}")" + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_get122_v0='' + return "${__status}" + fi + ret_env_var_get122_v0="${command_13}" return 0 } -array_pop__119_v0() { - local __AMBER_ARRAY_array="$1[@]" - local array=$1 - __AMBER_LEN=("${!__AMBER_ARRAY_array}"); - local length="${#__AMBER_LEN[@]}" - local index=$(echo ${length} '-' 1 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') - eval "local __AMBER_ARRAY_GET_10_array=\"\${$array[${index}]}\""; - local element=$__AMBER_ARRAY_GET_10_array - local __SLICE_UPPER_12=${index}; - local __SLICE_OFFSET_13=0; - __SLICE_OFFSET_13=$((__SLICE_OFFSET_13 > 0 ? __SLICE_OFFSET_13 : 0)); - local __SLICE_LENGTH_14=$(eval "echo ${index} '-' $__SLICE_OFFSET_13 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//'"); - __SLICE_LENGTH_14=$((__SLICE_LENGTH_14 > 0 ? __SLICE_LENGTH_14 : 0)); - eval "local __AMBER_ARRAY_GET_11_array=\"\${$array[@]:$__SLICE_OFFSET_13:$__SLICE_LENGTH_14}\""; - eval "${array}=($__AMBER_ARRAY_GET_11_array)" - __AF_array_pop119_v0="${element}"; + +is_command__124_v0() { + local command_66="${1}" + [ -x "$(command -v "${command_66}")" ] + __status=$? + if [ "${__status}" != 0 ]; then + ret_is_command124_v0=0 + return 0 + fi + ret_is_command124_v0=1 return 0 } -array_shift__120_v0() { - local __AMBER_ARRAY_array="$1[@]" - local array=$1 - __AMBER_LEN=("${!__AMBER_ARRAY_array}"); - local length="${#__AMBER_LEN[@]}" - eval "local __AMBER_ARRAY_GET_15_array=\"\${$array[0]}\""; - local element=$__AMBER_ARRAY_GET_15_array - local __SLICE_UPPER_17=${length}; - local __SLICE_OFFSET_18=1; - __SLICE_OFFSET_18=$((__SLICE_OFFSET_18 > 0 ? __SLICE_OFFSET_18 : 0)); - local __SLICE_LENGTH_19=$(eval "echo ${length} '-' $__SLICE_OFFSET_18 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//'"); - __SLICE_LENGTH_19=$((__SLICE_LENGTH_19 > 0 ? __SLICE_LENGTH_19 : 0)); - eval "local __AMBER_ARRAY_GET_16_array=\"\${$array[@]:$__SLICE_OFFSET_18:$__SLICE_LENGTH_19}\""; - eval "${array}=($__AMBER_ARRAY_GET_16_array)" - __AF_array_shift120_v0="${element}"; - return 0 + +printf__130_v0() { + local format_38="${1}" + local args_39=("${!2}") + args_39=("${format_38}" "${args_39[@]}") + __status=$? + printf "${args_39[@]}" + __status=$? } -__AMBER_VAL_20=$(tput tsl); -__AS=$?; -__8_tsl="${__AMBER_VAL_20}" -__AMBER_VAL_21=$(tput fsl); -__AS=$?; -__9_fsl="${__AMBER_VAL_21}" -__AMBER_VAL_22=$(tput smcup); -__AS=$?; -__10_smcup="${__AMBER_VAL_22}" -__AMBER_VAL_23=$(tput rmcup); -__AS=$?; -__11_rmcup="${__AMBER_VAL_23}" -env_var_get__91_v0 "TERM"; -__AS=$?; -__AF_env_var_get91_v0__13_18="${__AF_env_var_get91_v0}"; -__12_TERM="${__AF_env_var_get91_v0__13_18}" -can_set_title__132_v0() { - local has_statusline=1 - tput hs; - __AS=$?; -if [ $__AS != 0 ]; then - starts_with__20_v0 "${__12_TERM}" "xterm"; - __AF_starts_with20_v0__22_12="$__AF_starts_with20_v0"; - if [ "$__AF_starts_with20_v0__22_12" != 0 ]; then - TERM=xterm+sl tput hs; - __AS=$? - if [ $(echo $__AS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_VAL_24=$(TERM=xterm+sl tput tsl); - __AS=$?; - __8_tsl="${__AMBER_VAL_24}" - __AMBER_VAL_25=$(TERM=xterm+sl tput fsl); - __AS=$?; - __9_fsl="${__AMBER_VAL_25}" -else - has_statusline=0 -fi -else - has_statusline=0 -fi -fi - __AF_can_set_title132_v0=${has_statusline}; + +echo_warning__139_v0() { + local message_270="${1}" + local array_14=("${message_270}") + printf__130_v0 "\\x1b[1;3;97;43m%s\\x1b[0m +" array_14[@] +} + +echo_error__140_v0() { + local message_36="${1}" + local exit_code_37="${2}" + local array_15=("${message_36}") + printf__130_v0 "\\x1b[1;3;97;41m%s\\x1b[0m +" array_15[@] + if [ "$(( exit_code_37 > 0 ))" != 0 ]; then + exit "${exit_code_37}" + fi +} + +command_16="$(tput tsl)" +__status=$? +tsl_11="${command_16}" +command_17="$(tput fsl)" +__status=$? +fsl_12="${command_17}" +command_18="$(tput smcup)" +__status=$? +smcup_13="${command_18}" +command_19="$(tput rmcup)" +__status=$? +rmcup_14="${command_19}" +env_var_get__122_v0 "TERM" +__status=$? +__TERM_17="${ret_env_var_get122_v0}" +can_set_title__173_v0() { + local has_statusline_118=1 + tput hs + __status=$? + if [ "${__status}" != 0 ]; then + starts_with__23_v0 "${__TERM_17}" "xterm" + local ret_starts_with23_v0__22_12="${ret_starts_with23_v0}" + if [ "${ret_starts_with23_v0__22_12}" != 0 ]; then + TERM=xterm+sl tput hs + __status=$? + if [ "$(( __status == 0 ))" != 0 ]; then + local command_20 + command_20="$(TERM=xterm+sl tput tsl)" + __status=$? + tsl_11="${command_20}" + local command_21 + command_21="$(TERM=xterm+sl tput fsl)" + __status=$? + fsl_12="${command_21}" + else + has_statusline_118=0 + fi + else + has_statusline_118=0 + fi + fi + ret_can_set_title173_v0="${has_statusline_118}" return 0 } -set_title__133_v0() { - local title=$1 - can_set_title__132_v0 ; - __AF_can_set_title132_v0__43_8="$__AF_can_set_title132_v0"; - if [ "$__AF_can_set_title132_v0__43_8" != 0 ]; then - echo "${__8_tsl}""${title}""${__9_fsl}" -fi + +set_title__174_v0() { + local title_117="${1}" + can_set_title__173_v0 + local ret_can_set_title173_v0__43_8="${ret_can_set_title173_v0}" + if [ "${ret_can_set_title173_v0__43_8}" != 0 ]; then + printf '%s\n' "${tsl_11}""${title_117}""${fsl_12}" + fi } -enter_alt_buffer__134_v0() { - echo "${__10_smcup}" + +enter_alt_buffer__175_v0() { + printf '%s\n' "${smcup_13}" } -exit_alt_buffer__135_v0() { - echo "${__11_rmcup}" + +exit_alt_buffer__176_v0() { + printf '%s\n' "${rmcup_14}" } -teardown__136_v0() { - local failure=$1 - if [ ${failure} != 0 ]; then + +teardown__177_v0() { + local failure_348="${1}" + if [ "${failure_348}" != 0 ]; then echo "Press any key to continue..." - read -n 1; - __AS=$? -fi - set_title__133_v0 ""; - __AF_set_title133_v0__66_5="$__AF_set_title133_v0"; - echo "$__AF_set_title133_v0__66_5" > /dev/null 2>&1 - exit_alt_buffer__135_v0 ; - __AF_exit_alt_buffer135_v0__67_5="$__AF_exit_alt_buffer135_v0"; - echo "$__AF_exit_alt_buffer135_v0__67_5" > /dev/null 2>&1 -} -__13_SELF="" -env_var_get__91_v0 "0"; -__AS=$?; -__AF_env_var_get91_v0__12_16="${__AF_env_var_get91_v0}"; -__14_me="${__AF_env_var_get91_v0__12_16}" -text_contains__14_v0 "${__14_me}" "/"; -__AF_text_contains14_v0__15_4="$__AF_text_contains14_v0"; -if [ "$__AF_text_contains14_v0__15_4" != 0 ]; then - starts_with__20_v0 "${__14_me}" "/"; - __AF_starts_with20_v0__16_12="$__AF_starts_with20_v0"; - if [ $(echo '!' "$__AF_starts_with20_v0__16_12" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - env_var_get__91_v0 "PWD"; - __AS=$?; - __AF_env_var_get91_v0__17_25="${__AF_env_var_get91_v0}"; - PWD="${__AF_env_var_get91_v0__17_25}" - __AMBER_VAL_26=$(readlink ${__14_me}); - __AS=$?; -if [ $__AS != 0 ]; then - __13_SELF="${PWD}/${__14_me}" -fi; - rl="${__AMBER_VAL_26}" - starts_with__20_v0 "${rl}" "/"; - __AF_starts_with20_v0__25_17="$__AF_starts_with20_v0"; - if [ $([ "_${rl}" != "_" ]; echo $?) != 0 ]; then - __13_SELF="${__13_SELF}" -elif [ $(echo '!' "$__AF_starts_with20_v0__25_17" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __13_SELF="${PWD}/${rl}" -else - __13_SELF="${rl}" -fi -fi + read -n 1 + __status=$? + fi + set_title__174_v0 "" + exit_alt_buffer__176_v0 +} + +__SELF_18="" +env_var_get__122_v0 "0" +__status=$? +me_19="${ret_env_var_get122_v0}" +text_contains__17_v0 "${me_19}" "/" +ret_text_contains17_v0__15_4="${ret_text_contains17_v0}" +if [ "${ret_text_contains17_v0__15_4}" != 0 ]; then + starts_with__23_v0 "${me_19}" "/" + ret_starts_with23_v0__16_12="${ret_starts_with23_v0}" + if [ "$(( ! ret_starts_with23_v0__16_12 ))" != 0 ]; then + env_var_get__122_v0 "PWD" + __status=$? + __PWD_28="${ret_env_var_get122_v0}" + command_22="$(readlink ${me_19})" + __status=$? + if [ "${__status}" != 0 ]; then + __SELF_18="${__PWD_28}/${me_19}" + fi + rl_29="${command_22}" + starts_with__23_v0 "${rl_29}" "/" + ret_starts_with23_v0__25_17="${ret_starts_with23_v0}" + if [ "$([ "_${rl_29}" != "_" ]; echo $?)" != 0 ]; then + __SELF_18="${__SELF_18}" + elif [ "$(( ! ret_starts_with23_v0__25_17 ))" != 0 ]; then + __SELF_18="${__PWD_28}/${rl_29}" + else + __SELF_18="${rl_29}" + fi + fi else - echo_error__109_v0 "This script must be run from an absolute or relative path." 1; - __AF_echo_error109_v0__30_5="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__30_5" > /dev/null 2>&1 -fi -exists_newer__139_v0() { - local left=$1 - local right=$2 - __AMBER_VAL_27=$(stat -c %W ${left}); - __AS=$?; - parse_number__12_v0 "${__AMBER_VAL_27}"; - __AS=$?; -if [ $__AS != 0 ]; then - __AF_exists_newer139_v0=0; + echo_error__140_v0 "This script must be run from an absolute or relative path." 1 +fi +exists_newer__180_v0() { + local left_2758="${1}" + local right_2759="${2}" + local command_23 + command_23="$(stat -c %W ${left_2758})" + __status=$? + parse_int__14_v0 "${command_23}" + __status=$? + if [ "${__status}" != 0 ]; then + ret_exists_newer180_v0=0 return 0 -fi; - __AF_parse_number12_v0__37_21="$__AF_parse_number12_v0"; - local left_time="$__AF_parse_number12_v0__37_21" - __AMBER_VAL_28=$(stat -c %W ${right}); - __AS=$?; - parse_number__12_v0 "${__AMBER_VAL_28}"; - __AS=$?; -if [ $__AS != 0 ]; then - __AF_exists_newer139_v0=0; + fi + local left_time_2761="${ret_parse_int14_v0}" + local command_24 + command_24="$(stat -c %W ${right_2759})" + __status=$? + parse_int__14_v0 "${command_24}" + __status=$? + if [ "${__status}" != 0 ]; then + ret_exists_newer180_v0=0 return 0 -fi; - __AF_parse_number12_v0__40_22="$__AF_parse_number12_v0"; - local right_time="$__AF_parse_number12_v0__40_22" - __AF_exists_newer139_v0=$(echo ${left_time} '>=' ${right_time} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//'); + fi + local right_time_2762="${ret_parse_int14_v0}" + ret_exists_newer180_v0="$(( left_time_2761 >= right_time_2762 ))" return 0 } -bail__140_v0() { - local message=$1 - local archive=$2 - exit_alt_buffer__135_v0 ; - __AF_exit_alt_buffer135_v0__56_5="$__AF_exit_alt_buffer135_v0"; - echo "$__AF_exit_alt_buffer135_v0__56_5" > /dev/null 2>&1 - set_title__133_v0 ""; - __AF_set_title133_v0__57_5="$__AF_set_title133_v0"; - echo "$__AF_set_title133_v0__57_5" > /dev/null 2>&1 - echo_error__109_v0 "${message}" 0; - __AF_echo_error109_v0__59_5="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__59_5" > /dev/null 2>&1 - if [ ${archive} != 0 ]; then - echo_error__109_v0 "This script can be rebuilt using the nixie tool." 0; - __AF_echo_error109_v0__61_9="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__61_9" > /dev/null 2>&1 -fi + +bail__181_v0() { + local message_115="${1}" + local archive_116="${2}" + exit_alt_buffer__176_v0 + set_title__174_v0 "" + echo_error__140_v0 "${message_115}" 0 + if [ "${archive_116}" != 0 ]; then + echo_error__140_v0 "This script can be rebuilt using the nixie tool." 0 + fi exit 1 - kill -ABRT $$; - __AS=$? + kill -ABRT $$ + __status=$? } -get_self__141_v0() { - __AF_get_self141_v0="${__13_SELF}"; + +get_self__182_v0() { + ret_get_self182_v0="${__SELF_18}" return 0 } -dump_archive__142_v0() { - __AMBER_VAL_29=$(mktemp -t nixie_XXXXXXXX.tar); - __AS=$?; - local dest="${__AMBER_VAL_29}" - cat ${__13_SELF} | ( + +dump_archive__183_v0() { + local command_25 + command_25="$(mktemp -t nixie_XXXXXXXX.tar)" + __status=$? + local dest_114="${command_25}" + cat ${__SELF_18} | ( read -r M while ! [[ "$M" =~ ^-----BEGIN\ ARCHIVE\ SECTION----- ]] do read -r M || return 1 done - gzip -d -c 2>/dev/null > ${dest} - ); - __AS=$?; -if [ $__AS != 0 ]; then - if [ $(echo $__AS '!=' 2 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - bail__140_v0 "Could not find the script's resource archive." 1; - __AF_bail140_v0__92_13="$__AF_bail140_v0"; - echo "$__AF_bail140_v0__92_13" > /dev/null 2>&1 -fi -fi - __AF_dump_archive142_v0="${dest}"; + gzip -d -c 2>/dev/null > ${dest_114} + ) + __status=$? + if [ "${__status}" != 0 ]; then + if [ "$(( __status != 2 ))" != 0 ]; then + bail__181_v0 "Could not find the script's resource archive." 1 + fi + fi + ret_dump_archive183_v0="${dest_114}" return 0 } -untar__143_v0() { - local member=$1 - local dump=$2 - dump_archive__142_v0 ; - __AF_dump_archive142_v0__109_19="${__AF_dump_archive142_v0}"; - local archive="${__AF_dump_archive142_v0__109_19}" - local tar_cmd="tar -x ${member} -f ${archive}" - if [ ${dump} != 0 ]; then - tar_cmd="tar -x -O ${member} -f ${archive}" -fi - __AMBER_VAL_30=$(${tar_cmd}); - __AS=$?; -if [ $__AS != 0 ]; then - local tar_status=$__AS - rm ${archive}; - __AS=$? - __AF_untar143_v0=''; - return ${tar_status} -fi; - local tar_out="${__AMBER_VAL_30}" - rm ${archive}; - __AS=$? - __AF_untar143_v0="${tar_out}"; + +untar__184_v0() { + local member_112="${1}" + local dump_113="${2}" + dump_archive__183_v0 + local archive_119="${ret_dump_archive183_v0}" + local tar_cmd_120="tar -x ${member_112} -f ${archive_119}" + if [ "${dump_113}" != 0 ]; then + tar_cmd_120="tar -x -O ${member_112} -f ${archive_119}" + fi + local command_26 + command_26="$(${tar_cmd_120})" + __status=$? + if [ "${__status}" != 0 ]; then + local tar_status_121="${__status}" + rm ${archive_119} + __status=$? + ret_untar184_v0='' + return "${tar_status_121}" + fi + local tar_out_122="${command_26}" + rm ${archive_119} + __status=$? + ret_untar184_v0="${tar_out_122}" return 0 } -check_deps__144_v0() { - local deps=("${!1}") - __AMBER_ARRAY_31=(); - local missing=("${__AMBER_ARRAY_31[@]}") - for dep in "${deps[@]}"; do - is_command__93_v0 "${dep}"; - __AF_is_command93_v0__136_16="$__AF_is_command93_v0"; - if [ $(echo '!' "$__AF_is_command93_v0__136_16" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_ARRAY_32=("${dep}"); - missing+=("${__AMBER_ARRAY_32[@]}") -fi -done - if [ $(echo "${#missing[@]}" '>' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - echo_error__109_v0 "The following commands are missing:" 0; - __AF_echo_error109_v0__142_9="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__142_9" > /dev/null 2>&1 - for cmd in "${missing[@]}"; do - echo_error__109_v0 "- ${cmd}" 0; - __AF_echo_error109_v0__144_13="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__144_13" > /dev/null 2>&1 -done - echo_error__109_v0 "Use your distribution's package manager to install them, then try again." 0; - __AF_echo_error109_v0__146_9="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__146_9" > /dev/null 2>&1 - __AF_check_deps144_v0=''; + +check_deps__185_v0() { + local deps_63=("${!1}") + local missing_64=() + for dep_65 in "${deps_63[@]}"; do + is_command__124_v0 "${dep_65}" + local ret_is_command124_v0__136_16="${ret_is_command124_v0}" + if [ "$(( ! ret_is_command124_v0__136_16 ))" != 0 ]; then + missing_64+=("${dep_65}") + fi + done + local __length_29=("${missing_64[@]}") + if [ "$(( ${#__length_29[@]} > 0 ))" != 0 ]; then + echo_error__140_v0 "The following commands are missing:" 0 + for cmd_67 in "${missing_64[@]}"; do + echo_error__140_v0 "- ${cmd_67}" 0 + done + echo_error__140_v0 "Use your distribution's package manager to install them, then try again." 0 + ret_check_deps185_v0='' return 1 -fi + fi } -get_osname__154_v0() { - __AMBER_VAL_33=$(uname -s); - __AS=$?; - __AF_get_osname154_v0="${__AMBER_VAL_33}"; + +get_osname__195_v0() { + local command_30 + command_30="$(uname -s)" + __status=$? + ret_get_osname195_v0="${command_30}" return 0 } -get_machine__155_v0() { - __AMBER_VAL_34=$(uname -m); - __AS=$?; - local machine="${__AMBER_VAL_34}" - if [ $([ "_${machine}" != "_arm64" ]; echo $?) != 0 ]; then - __AF_get_machine155_v0="aarch64"; + +get_machine__196_v0() { + local command_31 + command_31="$(uname -m)" + __status=$? + local machine_2768="${command_31}" + if [ "$([ "_${machine_2768}" != "_arm64" ]; echo $?)" != 0 ]; then + ret_get_machine196_v0="aarch64" return 0 -fi - __AF_get_machine155_v0="${machine}"; + fi + ret_get_machine196_v0="${machine_2768}" return 0 } -get_system__156_v0() { - get_osname__154_v0 ; - __AF_get_osname154_v0__33_18="${__AF_get_osname154_v0}"; - local osname="${__AF_get_osname154_v0__33_18}" - get_machine__155_v0 ; - __AF_get_machine155_v0__34_19="${__AF_get_machine155_v0}"; - local machine="${__AF_get_machine155_v0__34_19}" - __AF_get_system156_v0="${osname}.${machine}"; + +get_system__197_v0() { + get_osname__195_v0 + local osname_2767="${ret_get_osname195_v0}" + get_machine__196_v0 + local machine_2769="${ret_get_machine196_v0}" + ret_get_system197_v0="${osname_2767}.${machine_2769}" return 0 } -get_nix_root__158_v0() { - env_var_get__91_v0 "HOME"; - __AS=$?; - __AF_env_var_get91_v0__52_26="${__AF_env_var_get91_v0}"; - local userhome="${__AF_env_var_get91_v0__52_26}" - get_osname__154_v0 ; - __AF_get_osname154_v0__53_18="${__AF_get_osname154_v0}"; - local osname="${__AF_get_osname154_v0__53_18}" - if [ $([ "_${osname}" != "_Darwin" ]; echo $?) != 0 ]; then - __AF_get_nix_root158_v0="${userhome}/Library/Nix"; + +get_nix_root__199_v0() { + env_var_get__122_v0 "HOME" + __status=$? + local userhome_253="${ret_env_var_get122_v0}" + get_osname__195_v0 + local osname_254="${ret_get_osname195_v0}" + if [ "$([ "_${osname_254}" != "_Darwin" ]; echo $?)" != 0 ]; then + ret_get_nix_root199_v0="${userhome_253}/Library/Nix" return 0 -else - __AF_get_nix_root158_v0="${userhome}/.local/share/nix/root"; + else + ret_get_nix_root199_v0="${userhome_253}/.local/share/nix/root" return 0 -fi + fi } -get_cache_root__159_v0() { - env_var_get__91_v0 "HOME"; - __AS=$?; - __AF_env_var_get91_v0__63_26="${__AF_env_var_get91_v0}"; - local userhome="${__AF_env_var_get91_v0__63_26}" - get_osname__154_v0 ; - __AF_get_osname154_v0__64_18="${__AF_get_osname154_v0}"; - local osname="${__AF_get_osname154_v0__64_18}" - if [ $([ "_${osname}" != "_Darwin" ]; echo $?) != 0 ]; then - __AF_get_cache_root159_v0="${userhome}/Library/Caches"; + +get_cache_root__200_v0() { + env_var_get__122_v0 "HOME" + __status=$? + local userhome_256="${ret_env_var_get122_v0}" + get_osname__195_v0 + local osname_257="${ret_get_osname195_v0}" + if [ "$([ "_${osname_257}" != "_Darwin" ]; echo $?)" != 0 ]; then + ret_get_cache_root200_v0="${userhome_256}/Library/Caches" return 0 -else - __AF_get_cache_root159_v0="${userhome}/.cache"; + else + ret_get_cache_root200_v0="${userhome_256}/.cache" return 0 -fi + fi } -get_repo_root__160_v0() { - get_self__141_v0 ; - __AF_get_self141_v0__77_24="${__AF_get_self141_v0}"; - split__3_v0 "${__AF_get_self141_v0__77_24}" "/"; - __AF_split3_v0__77_18=("${__AF_split3_v0[@]}"); - local self_a=("${__AF_split3_v0__77_18[@]}") - array_pop__119_v0 self_a; - __AF_array_pop119_v0__78_5="${__AF_array_pop119_v0}"; - echo "${__AF_array_pop119_v0__78_5}" > /dev/null 2>&1 - join__6_v0 self_a[@] "/"; - __AF_join6_v0__80_26="${__AF_join6_v0}"; - local self_dir="/""${__AF_join6_v0__80_26}" - __AMBER_VAL_35=$(git -C ${self_dir} rev-parse --show-toplevel); - __AS=$?; -if [ $__AS != 0 ]; then - echo_warning__108_v0 "Failed to find current Git repository, using script parent directory."; - __AF_echo_warning108_v0__83_9="$__AF_echo_warning108_v0"; - echo "$__AF_echo_warning108_v0__83_9" > /dev/null 2>&1 - __AF_get_repo_root160_v0="${self_dir}"; + +get_repo_root__201_v0() { + get_self__182_v0 + local ret_get_self182_v0__77_24="${ret_get_self182_v0}" + split__5_v0 "${ret_get_self182_v0__77_24}" "/" + local self_a_262=("${ret_split5_v0[@]}") + array_pop__77_v0 "self_a_262" + __status=$? + join__8_v0 self_a_262[@] "/" + local ret_join8_v0__80_26="${ret_join8_v0}" + local self_dir_269="/""${ret_join8_v0__80_26}" + local command_32 + command_32="$(git -C ${self_dir_269} rev-parse --show-toplevel)" + __status=$? + if [ "${__status}" != 0 ]; then + echo_warning__139_v0 "Failed to find current Git repository, using script parent directory." + ret_get_repo_root201_v0="${self_dir_269}" return 0 -fi; - __AF_get_repo_root160_v0="${__AMBER_VAL_35}"; + fi + ret_get_repo_root201_v0="${command_32}" return 0 } -cmd_help__174_v0() { - env_var_get__91_v0 "NIXIE_VERSION"; - __AS=$?; - __AF_env_var_get91_v0__15_31="${__AF_env_var_get91_v0}"; - local NIXIE_VERSION="${__AF_env_var_get91_v0__15_31}" - echo "Nix wrapper script, generated by Nixie ${NIXIE_VERSION}" - echo "" + +cmd_help__215_v0() { + env_var_get__122_v0 "NIXIE_VERSION" + __status=$? + local __NIXIE_VERSION_250="${ret_env_var_get122_v0}" + echo "Nix wrapper script, generated by Nixie ${__NIXIE_VERSION_250}" + printf '%s\n' "" echo "Available --nixie- options:" echo " --nixie-help Show this help message and exit." echo " --nixie-print-config Print this script's configuration." @@ -575,1650 +578,1381 @@ cmd_help__174_v0() { echo " --nixie-ignore-system Behave as if Nix was not installed." exit 0 } -cmd_print_config__175_v0() { - untar__143_v0 "features" 1; - __AS=$?; - __AF_untar143_v0__32_16="${__AF_untar143_v0}"; - echo "${__AF_untar143_v0__32_16}" + +cmd_print_config__216_v0() { + untar__184_v0 "features" 1 + __status=$? + local ret_untar184_v0__32_16="${ret_untar184_v0}" + printf '%s\n' "${ret_untar184_v0__32_16}" exit 0 } -cmd_extract__176_v0() { - dir_create__38_v0 "nixie"; - __AF_dir_create38_v0__38_5="$__AF_dir_create38_v0"; - echo "$__AF_dir_create38_v0__38_5" > /dev/null 2>&1 + +cmd_extract__217_v0() { + dir_create__47_v0 "nixie" + __status=$? cd "nixie" || exit - untar__143_v0 "" 0; - __AS=$?; - __AF_untar143_v0__40_11="${__AF_untar143_v0}"; - echo "${__AF_untar143_v0__40_11}" > /dev/null 2>&1 + untar__184_v0 "" 0 + __status=$? exit 0 } -cmd_cleanup__177_v0() { - get_nix_root__158_v0 ; - __AF_get_nix_root158_v0__46_20="${__AF_get_nix_root158_v0}"; - local nix_root="${__AF_get_nix_root158_v0__46_20}" - get_cache_root__159_v0 ; - __AF_get_cache_root159_v0__47_22="${__AF_get_cache_root159_v0}"; - local cache_root="${__AF_get_cache_root159_v0__47_22}" - get_repo_root__160_v0 ; - __AF_get_repo_root160_v0__48_21="${__AF_get_repo_root160_v0}"; - local repo_root="${__AF_get_repo_root160_v0__48_21}" + +cmd_cleanup__218_v0() { + get_nix_root__199_v0 + local nix_root_255="${ret_get_nix_root199_v0}" + get_cache_root__200_v0 + local cache_root_258="${ret_get_cache_root200_v0}" + get_repo_root__201_v0 + local repo_root_271="${ret_get_repo_root201_v0}" echo "Removing local Nix channels and build files..." - chmod -R +wx ${repo_root}/.nixie 2>/dev/null; - __AS=$? - rm -rf ${repo_root}/.nixie; - __AS=$? + chmod -R +wx ${repo_root_271}/.nixie 2>/dev/null + __status=$? + rm -rf ${repo_root_271}/.nixie + __status=$? echo "Removing user Nix store..." - chmod -R +wx ${nix_root} 2>/dev/null; - __AS=$? - rm -rf ${nix_root}; - __AS=$? + chmod -R +wx ${nix_root_255} 2>/dev/null + __status=$? + rm -rf ${nix_root_255} + __status=$? echo "Removing retrieved Nix binaries..." - rm -rf ${cache_root}/nix-static ${cache_root}/nix-lib ${cache_root}/nix-deps; - __AS=$? + rm -rf ${cache_root_258}/nix-static ${cache_root_258}/nix-lib ${cache_root_258}/nix-deps + __status=$? exit 0 } -opt_ignore_system__178_v0() { - echo_warning__108_v0 "Ignoring system-wide Nix for testing purposes."; - __AF_echo_warning108_v0__66_5="$__AF_echo_warning108_v0"; - echo "$__AF_echo_warning108_v0__66_5" > /dev/null 2>&1 - echo_warning__108_v0 "Re-run without the --nixie-ignore-system flag to import the single-user"; - __AF_echo_warning108_v0__67_5="$__AF_echo_warning108_v0"; - echo "$__AF_echo_warning108_v0__67_5" > /dev/null 2>&1 - echo_warning__108_v0 "Nix store into the system store."; - __AF_echo_warning108_v0__68_5="$__AF_echo_warning108_v0"; - echo "$__AF_echo_warning108_v0__68_5" > /dev/null 2>&1 - env_var_set__90_v0 "nosystem" "1"; - __AS=$?; - __AF_env_var_set90_v0__69_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__69_11" > /dev/null 2>&1 -} -opt_no_precompiled__179_v0() { - echo_warning__108_v0 "Ignoring precompiled binaries for testing purposes."; - __AF_echo_warning108_v0__74_5="$__AF_echo_warning108_v0"; - echo "$__AF_echo_warning108_v0__74_5" > /dev/null 2>&1 - echo_warning__108_v0 "This implies --nixie-ignore-system."; - __AF_echo_warning108_v0__75_5="$__AF_echo_warning108_v0"; - echo "$__AF_echo_warning108_v0__75_5" > /dev/null 2>&1 - env_var_set__90_v0 "nobins" "1"; - __AS=$?; - __AF_env_var_set90_v0__76_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__76_11" > /dev/null 2>&1 - env_var_set__90_v0 "nosystem" "1"; - __AS=$?; - __AF_env_var_set90_v0__77_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__77_11" > /dev/null 2>&1 -} -notfound__180_v0() { - local cmd=$1 - env_var_get__91_v0 "0"; - __AS=$?; - __AF_env_var_get91_v0__82_22="${__AF_env_var_get91_v0}"; - local self="${__AF_env_var_get91_v0__82_22}" - echo_error__109_v0 "No such option: --nixie-${cmd}. Run '${self} --nixie-help' for available options." 1; - __AF_echo_error109_v0__84_5="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__84_5" > /dev/null 2>&1 -} -eval_cmd__181_v0() { - local cmd=$1 - if [ $([ "_${cmd}" != "_help" ]; echo $?) != 0 ]; then - cmd_help__174_v0 ; - __AF_cmd_help174_v0__90_34="$__AF_cmd_help174_v0"; - echo "$__AF_cmd_help174_v0__90_34" > /dev/null 2>&1 -elif [ $([ "_${cmd}" != "_print-config" ]; echo $?) != 0 ]; then - cmd_print_config__175_v0 ; - __AF_cmd_print_config175_v0__91_34="$__AF_cmd_print_config175_v0"; - echo "$__AF_cmd_print_config175_v0__91_34" > /dev/null 2>&1 -elif [ $([ "_${cmd}" != "_extract" ]; echo $?) != 0 ]; then - cmd_extract__176_v0 ; - __AF_cmd_extract176_v0__92_34="$__AF_cmd_extract176_v0"; - echo "$__AF_cmd_extract176_v0__92_34" > /dev/null 2>&1 -elif [ $([ "_${cmd}" != "_cleanup" ]; echo $?) != 0 ]; then - cmd_cleanup__177_v0 ; - __AF_cmd_cleanup177_v0__93_34="$__AF_cmd_cleanup177_v0"; - echo "$__AF_cmd_cleanup177_v0__93_34" > /dev/null 2>&1 -elif [ $([ "_${cmd}" != "_ignore-system" ]; echo $?) != 0 ]; then - opt_ignore_system__178_v0 ; - __AF_opt_ignore_system178_v0__94_34="$__AF_opt_ignore_system178_v0"; - echo "$__AF_opt_ignore_system178_v0__94_34" > /dev/null 2>&1 -elif [ $([ "_${cmd}" != "_no-precompiled" ]; echo $?) != 0 ]; then - opt_no_precompiled__179_v0 ; - __AF_opt_no_precompiled179_v0__95_34="$__AF_opt_no_precompiled179_v0"; - echo "$__AF_opt_no_precompiled179_v0__95_34" > /dev/null 2>&1 -else - notfound__180_v0 "${cmd}"; - __AF_notfound180_v0__96_15="$__AF_notfound180_v0"; - echo "$__AF_notfound180_v0__96_15" > /dev/null 2>&1 -fi + +opt_ignore_system__219_v0() { + echo_warning__139_v0 "Ignoring system-wide Nix for testing purposes." + echo_warning__139_v0 "Re-run without the --nixie-ignore-system flag to import the single-user" + echo_warning__139_v0 "Nix store into the system store." + env_var_set__121_v0 "nosystem" "1" + __status=$? } -catch_args__182_v0() { - local __AMBER_ARRAY_args="$1[@]" - local args=$1 - local local_args=("${!__AMBER_ARRAY_args}") - __AMBER_ARRAY_36=(); - eval "${args}=(\"\${__AMBER_ARRAY_36[@]}\")" - for arg in "${local_args[@]}"; do - local cmd="" - starts_with__20_v0 "${arg}" "--nixie-"; - __AF_starts_with20_v0__110_12="$__AF_starts_with20_v0"; - if [ "$__AF_starts_with20_v0__110_12" != 0 ]; then - __AMBER_LEN="--nixie-"; - slice__22_v0 "${arg}" "${#__AMBER_LEN}" 0; - __AF_slice22_v0__111_19="${__AF_slice22_v0}"; - cmd="${__AF_slice22_v0__111_19}" - eval_cmd__181_v0 "${cmd}"; - __AF_eval_cmd181_v0__112_13="$__AF_eval_cmd181_v0"; - echo "$__AF_eval_cmd181_v0__112_13" > /dev/null 2>&1 -else - __AMBER_ARRAY_37=("${arg}"); - eval "${args}+=(\"\${__AMBER_ARRAY_37[@]}\")" -fi -done -} -file_download__233_v0() { - local url=$1 - local path=$2 - is_command__93_v0 "curl"; - __AF_is_command93_v0__9_9="$__AF_is_command93_v0"; - is_command__93_v0 "wget"; - __AF_is_command93_v0__12_9="$__AF_is_command93_v0"; - is_command__93_v0 "aria2c"; - __AF_is_command93_v0__15_9="$__AF_is_command93_v0"; - if [ "$__AF_is_command93_v0__9_9" != 0 ]; then - curl -L -o "${path}" "${url}" ; - __AS=$? -elif [ "$__AF_is_command93_v0__12_9" != 0 ]; then - wget "${url}" -P "${path}" ; - __AS=$? -elif [ "$__AF_is_command93_v0__15_9" != 0 ]; then - aria2c "${url}" -d "${path}" ; - __AS=$? -else - __AF_file_download233_v0=0; - return 0 -fi - __AF_file_download233_v0=1; - return 0 + +opt_no_precompiled__220_v0() { + echo_warning__139_v0 "Ignoring precompiled binaries for testing purposes." + echo_warning__139_v0 "This implies --nixie-ignore-system." + env_var_set__121_v0 "nobins" "1" + __status=$? + env_var_set__121_v0 "nosystem" "1" + __status=$? +} + +notfound__221_v0() { + local cmd_274="${1}" + env_var_get__122_v0 "0" + __status=$? + local self_275="${ret_env_var_get122_v0}" + echo_error__140_v0 "No such option: --nixie-${cmd_274}. Run '${self_275} --nixie-help' for available options." 1 } -cachix_url__239_v0() { - local derivation=$1 - local member=$2 - env_var_get__91_v0 "SOURCE_CACHE"; - __AS=$?; - __AF_env_var_get91_v0__13_30="${__AF_env_var_get91_v0}"; - local SOURCE_CACHE="${__AF_env_var_get91_v0__13_30}" - __AF_cachix_url239_v0="https://${SOURCE_CACHE}/serve/${derivation}/${member}"; + +eval_cmd__222_v0() { + local cmd_249="${1}" + if [ "$([ "_${cmd_249}" != "_help" ]; echo $?)" != 0 ]; then + cmd_help__215_v0 + elif [ "$([ "_${cmd_249}" != "_print-config" ]; echo $?)" != 0 ]; then + cmd_print_config__216_v0 + elif [ "$([ "_${cmd_249}" != "_extract" ]; echo $?)" != 0 ]; then + cmd_extract__217_v0 + elif [ "$([ "_${cmd_249}" != "_cleanup" ]; echo $?)" != 0 ]; then + cmd_cleanup__218_v0 + elif [ "$([ "_${cmd_249}" != "_ignore-system" ]; echo $?)" != 0 ]; then + opt_ignore_system__219_v0 + elif [ "$([ "_${cmd_249}" != "_no-precompiled" ]; echo $?)" != 0 ]; then + opt_no_precompiled__220_v0 + else + notfound__221_v0 "${cmd_249}" + fi +} + +catch_args__223_v0() { + local args_241=("${1}") + eval "local args_241_deref_90=(\"\${${args_241[0]}[@]}\")" + local local_args_242=("${args_241_deref_90[@]}") + eval "${args_241}=()" + for arg_243 in "${local_args_242[@]}"; do + local cmd_244="" + starts_with__23_v0 "${arg_243}" "--nixie-" + local ret_starts_with23_v0__110_12="${ret_starts_with23_v0}" + if [ "${ret_starts_with23_v0__110_12}" != 0 ]; then + local __length_34="--nixie-" + slice__25_v0 "${arg_243}" "${#__length_34}" 0 + cmd_244="${ret_slice25_v0}" + eval_cmd__222_v0 "${cmd_244}" + else + eval "${args_241}+=(\"\${arg_243}\")" + fi + done +} + +file_download__327_v0() { + local url_2781="${1}" + local path_2782="${2}" + is_command__124_v0 "curl" + local ret_is_command124_v0__15_9="${ret_is_command124_v0}" + is_command__124_v0 "wget" + local ret_is_command124_v0__18_9="${ret_is_command124_v0}" + is_command__124_v0 "aria2c" + local ret_is_command124_v0__21_9="${ret_is_command124_v0}" + if [ "${ret_is_command124_v0__15_9}" != 0 ]; then + curl -L -o "${path_2782}" "${url_2781}">/dev/null 2>&1 + __status=$? + elif [ "${ret_is_command124_v0__18_9}" != 0 ]; then + wget "${url_2781}" -P "${path_2782}">/dev/null 2>&1 + __status=$? + elif [ "${ret_is_command124_v0__21_9}" != 0 ]; then + aria2c "${url_2781}" -d "${path_2782}">/dev/null 2>&1 + __status=$? + else + ret_file_download327_v0='' + return 1 + fi +} + +cachix_url__334_v0() { + local derivation_2778="${1}" + local member_2779="${2}" + env_var_get__122_v0 "SOURCE_CACHE" + __status=$? + local __SOURCE_CACHE_2780="${ret_env_var_get122_v0}" + ret_cachix_url334_v0="https://${__SOURCE_CACHE_2780}/serve/${derivation_2778}/${member_2779}" return 0 } -pull_binary__241_v0() { - local member=$1 - local dest=$2 - env_var_get__91_v0 "NIX_BINS_DERIVATION"; - __AS=$?; - __AF_env_var_get91_v0__84_37="${__AF_env_var_get91_v0}"; - local NIX_BINS_DERIVATION="${__AF_env_var_get91_v0__84_37}" - untar__143_v0 "${member}" 0; - __AS=$?; - __AF_untar143_v0__86_23="${__AF_untar143_v0}"; - local where="${__AF_untar143_v0__86_23}" - if [ $(echo $__AS '!=' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_VAL_38=$(mktemp -t nixie_${member}_XXXXXXXX); - __AS=$?; - local tmpf="${__AMBER_VAL_38}" - cachix_url__239_v0 "${NIX_BINS_DERIVATION}" "${member}"; - __AF_cachix_url239_v0__90_30="${__AF_cachix_url239_v0}"; - file_download__233_v0 "${__AF_cachix_url239_v0__90_30}" "${tmpf}"; - __AF_file_download233_v0__90_16="$__AF_file_download233_v0"; - if [ $(echo '!' "$__AF_file_download233_v0__90_16" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AF_pull_binary241_v0=''; - return 1 -fi - where="${tmpf}" -fi - mv "${where}" "${dest}" -__AS=$? -} -__AMBER_VAL_39=$(tput tsl); -__AS=$?; -__15_tsl="${__AMBER_VAL_39}" -__AMBER_VAL_40=$(tput fsl); -__AS=$?; -__16_fsl="${__AMBER_VAL_40}" -__AMBER_VAL_41=$(tput smcup); -__AS=$?; -__17_smcup="${__AMBER_VAL_41}" -__AMBER_VAL_42=$(tput rmcup); -__AS=$?; -__18_rmcup="${__AMBER_VAL_42}" -env_var_get__91_v0 "TERM"; -__AS=$?; -__AF_env_var_get91_v0__13_18="${__AF_env_var_get91_v0}"; -__19_TERM="${__AF_env_var_get91_v0__13_18}" -can_set_title__258_v0() { - local has_statusline=1 - tput hs; - __AS=$?; -if [ $__AS != 0 ]; then - starts_with__20_v0 "${__19_TERM}" "xterm"; - __AF_starts_with20_v0__22_12="$__AF_starts_with20_v0"; - if [ "$__AF_starts_with20_v0__22_12" != 0 ]; then - TERM=xterm+sl tput hs; - __AS=$? - if [ $(echo $__AS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_VAL_43=$(TERM=xterm+sl tput tsl); - __AS=$?; - __15_tsl="${__AMBER_VAL_43}" - __AMBER_VAL_44=$(TERM=xterm+sl tput fsl); - __AS=$?; - __16_fsl="${__AMBER_VAL_44}" -else - has_statusline=0 -fi -else - has_statusline=0 -fi -fi - __AF_can_set_title258_v0=${has_statusline}; + +pull_binary__336_v0() { + local member_2773="${1}" + local dest_2774="${2}" + env_var_get__122_v0 "NIX_BINS_DERIVATION" + __status=$? + local __NIX_BINS_DERIVATION_2775="${ret_env_var_get122_v0}" + untar__184_v0 "${member_2773}" 0 + __status=$? + local where_2776="${ret_untar184_v0}" + if [ "$(( __status != 0 ))" != 0 ]; then + local command_36 + command_36="$(mktemp -t nixie_${member_2773}_XXXXXXXX)" + __status=$? + local tmpf_2777="${command_36}" + cachix_url__334_v0 "${__NIX_BINS_DERIVATION_2775}" "${member_2773}" + local ret_cachix_url334_v0__89_23="${ret_cachix_url334_v0}" + file_download__327_v0 "${ret_cachix_url334_v0__89_23}" "${tmpf_2777}" + __status=$? + if [ "${__status}" != 0 ]; then + ret_pull_binary336_v0='' + return "${__status}" + fi + where_2776="${tmpf_2777}" + fi + mv "${where_2776}" "${dest_2774}" + __status=$? +} + +command_37="$(tput tsl)" +__status=$? +tsl_40="${command_37}" +command_38="$(tput fsl)" +__status=$? +fsl_41="${command_38}" +command_39="$(tput smcup)" +__status=$? +command_40="$(tput rmcup)" +__status=$? +env_var_get__122_v0 "TERM" +__status=$? +__TERM_44="${ret_env_var_get122_v0}" +can_set_title__353_v0() { + local has_statusline_2798=1 + tput hs + __status=$? + if [ "${__status}" != 0 ]; then + starts_with__23_v0 "${__TERM_44}" "xterm" + local ret_starts_with23_v0__22_12="${ret_starts_with23_v0}" + if [ "${ret_starts_with23_v0__22_12}" != 0 ]; then + TERM=xterm+sl tput hs + __status=$? + if [ "$(( __status == 0 ))" != 0 ]; then + local command_41 + command_41="$(TERM=xterm+sl tput tsl)" + __status=$? + tsl_40="${command_41}" + local command_42 + command_42="$(TERM=xterm+sl tput fsl)" + __status=$? + fsl_41="${command_42}" + else + has_statusline_2798=0 + fi + else + has_statusline_2798=0 + fi + fi + ret_can_set_title353_v0="${has_statusline_2798}" return 0 } -set_title__259_v0() { - local title=$1 - can_set_title__258_v0 ; - __AF_can_set_title258_v0__43_8="$__AF_can_set_title258_v0"; - if [ "$__AF_can_set_title258_v0__43_8" != 0 ]; then - echo "${__15_tsl}""${title}""${__16_fsl}" -fi + +set_title__354_v0() { + local title_2797="${1}" + can_set_title__353_v0 + local ret_can_set_title353_v0__43_8="${ret_can_set_title353_v0}" + if [ "${ret_can_set_title353_v0__43_8}" != 0 ]; then + printf '%s\n' "${tsl_40}""${title_2797}""${fsl_41}" + fi } -__AMBER_VAL_45=$(tput tsl); -__AS=$?; -__20_tsl="${__AMBER_VAL_45}" -__AMBER_VAL_46=$(tput fsl); -__AS=$?; -__21_fsl="${__AMBER_VAL_46}" -__AMBER_VAL_47=$(tput smcup); -__AS=$?; -__22_smcup="${__AMBER_VAL_47}" -__AMBER_VAL_48=$(tput rmcup); -__AS=$?; -__23_rmcup="${__AMBER_VAL_48}" -env_var_get__91_v0 "TERM"; -__AS=$?; -__AF_env_var_get91_v0__13_18="${__AF_env_var_get91_v0}"; -__24_TERM="${__AF_env_var_get91_v0__13_18}" -can_set_title__278_v0() { - local has_statusline=1 - tput hs; - __AS=$?; -if [ $__AS != 0 ]; then - starts_with__20_v0 "${__24_TERM}" "xterm"; - __AF_starts_with20_v0__22_12="$__AF_starts_with20_v0"; - if [ "$__AF_starts_with20_v0__22_12" != 0 ]; then - TERM=xterm+sl tput hs; - __AS=$? - if [ $(echo $__AS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_VAL_49=$(TERM=xterm+sl tput tsl); - __AS=$?; - __20_tsl="${__AMBER_VAL_49}" - __AMBER_VAL_50=$(TERM=xterm+sl tput fsl); - __AS=$?; - __21_fsl="${__AMBER_VAL_50}" -else - has_statusline=0 -fi -else - has_statusline=0 -fi -fi - __AF_can_set_title278_v0=${has_statusline}; + +command_43="$(tput tsl)" +__status=$? +tsl_45="${command_43}" +command_44="$(tput fsl)" +__status=$? +fsl_46="${command_44}" +command_45="$(tput smcup)" +__status=$? +command_46="$(tput rmcup)" +__status=$? +rmcup_48="${command_46}" +env_var_get__122_v0 "TERM" +__status=$? +__TERM_49="${ret_env_var_get122_v0}" +can_set_title__373_v0() { + local has_statusline_2811=1 + tput hs + __status=$? + if [ "${__status}" != 0 ]; then + starts_with__23_v0 "${__TERM_49}" "xterm" + local ret_starts_with23_v0__22_12="${ret_starts_with23_v0}" + if [ "${ret_starts_with23_v0__22_12}" != 0 ]; then + TERM=xterm+sl tput hs + __status=$? + if [ "$(( __status == 0 ))" != 0 ]; then + local command_47 + command_47="$(TERM=xterm+sl tput tsl)" + __status=$? + tsl_45="${command_47}" + local command_48 + command_48="$(TERM=xterm+sl tput fsl)" + __status=$? + fsl_46="${command_48}" + else + has_statusline_2811=0 + fi + else + has_statusline_2811=0 + fi + fi + ret_can_set_title373_v0="${has_statusline_2811}" return 0 } -set_title__279_v0() { - local title=$1 - can_set_title__278_v0 ; - __AF_can_set_title278_v0__43_8="$__AF_can_set_title278_v0"; - if [ "$__AF_can_set_title278_v0__43_8" != 0 ]; then - echo "${__20_tsl}""${title}""${__21_fsl}" -fi + +set_title__374_v0() { + local title_2810="${1}" + can_set_title__373_v0 + local ret_can_set_title373_v0__43_8="${ret_can_set_title373_v0}" + if [ "${ret_can_set_title373_v0__43_8}" != 0 ]; then + printf '%s\n' "${tsl_45}""${title_2810}""${fsl_46}" + fi } -exit_alt_buffer__281_v0() { - echo "${__23_rmcup}" -} -__25_SELF="" -env_var_get__91_v0 "0"; -__AS=$?; -__AF_env_var_get91_v0__12_16="${__AF_env_var_get91_v0}"; -__26_me="${__AF_env_var_get91_v0__12_16}" -text_contains__14_v0 "${__26_me}" "/"; -__AF_text_contains14_v0__15_4="$__AF_text_contains14_v0"; -if [ "$__AF_text_contains14_v0__15_4" != 0 ]; then - starts_with__20_v0 "${__26_me}" "/"; - __AF_starts_with20_v0__16_12="$__AF_starts_with20_v0"; - if [ $(echo '!' "$__AF_starts_with20_v0__16_12" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - env_var_get__91_v0 "PWD"; - __AS=$?; - __AF_env_var_get91_v0__17_25="${__AF_env_var_get91_v0}"; - PWD="${__AF_env_var_get91_v0__17_25}" - __AMBER_VAL_51=$(readlink ${__26_me}); - __AS=$?; -if [ $__AS != 0 ]; then - __25_SELF="${PWD}/${__26_me}" -fi; - rl="${__AMBER_VAL_51}" - starts_with__20_v0 "${rl}" "/"; - __AF_starts_with20_v0__25_17="$__AF_starts_with20_v0"; - if [ $([ "_${rl}" != "_" ]; echo $?) != 0 ]; then - __25_SELF="${__25_SELF}" -elif [ $(echo '!' "$__AF_starts_with20_v0__25_17" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __25_SELF="${PWD}/${rl}" -else - __25_SELF="${rl}" -fi -fi + +exit_alt_buffer__376_v0() { + printf '%s\n' "${rmcup_48}" +} + +__SELF_50="" +env_var_get__122_v0 "0" +__status=$? +me_51="${ret_env_var_get122_v0}" +text_contains__17_v0 "${me_51}" "/" +ret_text_contains17_v0__15_4="${ret_text_contains17_v0}" +if [ "${ret_text_contains17_v0__15_4}" != 0 ]; then + starts_with__23_v0 "${me_51}" "/" + ret_starts_with23_v0__16_12="${ret_starts_with23_v0}" + if [ "$(( ! ret_starts_with23_v0__16_12 ))" != 0 ]; then + env_var_get__122_v0 "PWD" + __status=$? + __PWD_52="${ret_env_var_get122_v0}" + command_49="$(readlink ${me_51})" + __status=$? + if [ "${__status}" != 0 ]; then + __SELF_50="${__PWD_52}/${me_51}" + fi + rl_53="${command_49}" + starts_with__23_v0 "${rl_53}" "/" + ret_starts_with23_v0__25_17="${ret_starts_with23_v0}" + if [ "$([ "_${rl_53}" != "_" ]; echo $?)" != 0 ]; then + __SELF_50="${__SELF_50}" + elif [ "$(( ! ret_starts_with23_v0__25_17 ))" != 0 ]; then + __SELF_50="${__PWD_52}/${rl_53}" + else + __SELF_50="${rl_53}" + fi + fi else - echo_error__109_v0 "This script must be run from an absolute or relative path." 1; - __AF_echo_error109_v0__30_5="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__30_5" > /dev/null 2>&1 -fi -bail__286_v0() { - local message=$1 - local archive=$2 - exit_alt_buffer__281_v0 ; - __AF_exit_alt_buffer281_v0__56_5="$__AF_exit_alt_buffer281_v0"; - echo "$__AF_exit_alt_buffer281_v0__56_5" > /dev/null 2>&1 - set_title__279_v0 ""; - __AF_set_title279_v0__57_5="$__AF_set_title279_v0"; - echo "$__AF_set_title279_v0__57_5" > /dev/null 2>&1 - echo_error__109_v0 "${message}" 0; - __AF_echo_error109_v0__59_5="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__59_5" > /dev/null 2>&1 - if [ ${archive} != 0 ]; then - echo_error__109_v0 "This script can be rebuilt using the nixie tool." 0; - __AF_echo_error109_v0__61_9="$__AF_echo_error109_v0"; - echo "$__AF_echo_error109_v0__61_9" > /dev/null 2>&1 -fi + echo_error__140_v0 "This script must be run from an absolute or relative path." 1 +fi +bail__381_v0() { + local message_2808="${1}" + local archive_2809="${2}" + exit_alt_buffer__376_v0 + set_title__374_v0 "" + echo_error__140_v0 "${message_2808}" 0 + if [ "${archive_2809}" != 0 ]; then + echo_error__140_v0 "This script can be rebuilt using the nixie tool." 0 + fi exit 1 - kill -ABRT $$; - __AS=$? + kill -ABRT $$ + __status=$? } -get_self__287_v0() { - __AF_get_self287_v0="${__25_SELF}"; + +get_self__382_v0() { + ret_get_self382_v0="${__SELF_50}" return 0 } -dump_archive__288_v0() { - __AMBER_VAL_52=$(mktemp -t nixie_XXXXXXXX.tar); - __AS=$?; - local dest="${__AMBER_VAL_52}" - cat ${__25_SELF} | ( + +dump_archive__383_v0() { + local command_50 + command_50="$(mktemp -t nixie_XXXXXXXX.tar)" + __status=$? + local dest_2807="${command_50}" + cat ${__SELF_50} | ( read -r M while ! [[ "$M" =~ ^-----BEGIN\ ARCHIVE\ SECTION----- ]] do read -r M || return 1 done - gzip -d -c 2>/dev/null > ${dest} - ); - __AS=$?; -if [ $__AS != 0 ]; then - if [ $(echo $__AS '!=' 2 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - bail__286_v0 "Could not find the script's resource archive." 1; - __AF_bail286_v0__92_13="$__AF_bail286_v0"; - echo "$__AF_bail286_v0__92_13" > /dev/null 2>&1 -fi -fi - __AF_dump_archive288_v0="${dest}"; + gzip -d -c 2>/dev/null > ${dest_2807} + ) + __status=$? + if [ "${__status}" != 0 ]; then + if [ "$(( __status != 2 ))" != 0 ]; then + bail__381_v0 "Could not find the script's resource archive." 1 + fi + fi + ret_dump_archive383_v0="${dest_2807}" return 0 } -untar__289_v0() { - local member=$1 - local dump=$2 - dump_archive__288_v0 ; - __AF_dump_archive288_v0__109_19="${__AF_dump_archive288_v0}"; - local archive="${__AF_dump_archive288_v0__109_19}" - local tar_cmd="tar -x ${member} -f ${archive}" - if [ ${dump} != 0 ]; then - tar_cmd="tar -x -O ${member} -f ${archive}" -fi - __AMBER_VAL_53=$(${tar_cmd}); - __AS=$?; -if [ $__AS != 0 ]; then - local tar_status=$__AS - rm ${archive}; - __AS=$? - __AF_untar289_v0=''; - return ${tar_status} -fi; - local tar_out="${__AMBER_VAL_53}" - rm ${archive}; - __AS=$? - __AF_untar289_v0="${tar_out}"; + +untar__384_v0() { + local member_2805="${1}" + local dump_2806="${2}" + dump_archive__383_v0 + local archive_2812="${ret_dump_archive383_v0}" + local tar_cmd_2813="tar -x ${member_2805} -f ${archive_2812}" + if [ "${dump_2806}" != 0 ]; then + tar_cmd_2813="tar -x -O ${member_2805} -f ${archive_2812}" + fi + local command_51 + command_51="$(${tar_cmd_2813})" + __status=$? + if [ "${__status}" != 0 ]; then + local tar_status_2814="${__status}" + rm ${archive_2812} + __status=$? + ret_untar384_v0='' + return "${tar_status_2814}" + fi + local tar_out_2815="${command_51}" + rm ${archive_2812} + __status=$? + ret_untar384_v0="${tar_out_2815}" return 0 } -get_osname__292_v0() { - __AMBER_VAL_54=$(uname -s); - __AS=$?; - __AF_get_osname292_v0="${__AMBER_VAL_54}"; + +get_osname__387_v0() { + local command_52 + command_52="$(uname -s)" + __status=$? + ret_get_osname387_v0="${command_52}" return 0 } -get_dll_ext__295_v0() { - get_osname__292_v0 ; - __AF_get_osname292_v0__42_18="${__AF_get_osname292_v0}"; - local osname="${__AF_get_osname292_v0__42_18}" - if [ $([ "_${osname}" != "_Darwin" ]; echo $?) != 0 ]; then - __AF_get_dll_ext295_v0="dylib"; - return 0 -else - __AF_get_dll_ext295_v0="so"; - return 0 -fi -} -get_cache_root__297_v0() { - env_var_get__91_v0 "HOME"; - __AS=$?; - __AF_env_var_get91_v0__63_26="${__AF_env_var_get91_v0}"; - local userhome="${__AF_env_var_get91_v0__63_26}" - get_osname__292_v0 ; - __AF_get_osname292_v0__64_18="${__AF_get_osname292_v0}"; - local osname="${__AF_get_osname292_v0__64_18}" - if [ $([ "_${osname}" != "_Darwin" ]; echo $?) != 0 ]; then - __AF_get_cache_root297_v0="${userhome}/Library/Caches"; + +get_cache_root__392_v0() { + env_var_get__122_v0 "HOME" + __status=$? + local userhome_2792="${ret_env_var_get122_v0}" + get_osname__387_v0 + local osname_2793="${ret_get_osname387_v0}" + if [ "$([ "_${osname_2793}" != "_Darwin" ]; echo $?)" != 0 ]; then + ret_get_cache_root392_v0="${userhome_2792}/Library/Caches" return 0 -else - __AF_get_cache_root297_v0="${userhome}/.cache"; + else + ret_get_cache_root392_v0="${userhome_2792}/.cache" return 0 -fi + fi } -get_repo_root__298_v0() { - get_self__287_v0 ; - __AF_get_self287_v0__77_24="${__AF_get_self287_v0}"; - split__3_v0 "${__AF_get_self287_v0__77_24}" "/"; - __AF_split3_v0__77_18=("${__AF_split3_v0[@]}"); - local self_a=("${__AF_split3_v0__77_18[@]}") - array_pop__119_v0 self_a; - __AF_array_pop119_v0__78_5="${__AF_array_pop119_v0}"; - echo "${__AF_array_pop119_v0__78_5}" > /dev/null 2>&1 - join__6_v0 self_a[@] "/"; - __AF_join6_v0__80_26="${__AF_join6_v0}"; - local self_dir="/""${__AF_join6_v0__80_26}" - __AMBER_VAL_55=$(git -C ${self_dir} rev-parse --show-toplevel); - __AS=$?; -if [ $__AS != 0 ]; then - echo_warning__108_v0 "Failed to find current Git repository, using script parent directory."; - __AF_echo_warning108_v0__83_9="$__AF_echo_warning108_v0"; - echo "$__AF_echo_warning108_v0__83_9" > /dev/null 2>&1 - __AF_get_repo_root298_v0="${self_dir}"; + +get_repo_root__393_v0() { + get_self__382_v0 + local ret_get_self382_v0__77_24="${ret_get_self382_v0}" + split__5_v0 "${ret_get_self382_v0__77_24}" "/" + local self_a_2787=("${ret_split5_v0[@]}") + array_pop__77_v0 "self_a_2787" + __status=$? + join__8_v0 self_a_2787[@] "/" + local ret_join8_v0__80_26="${ret_join8_v0}" + local self_dir_2788="/""${ret_join8_v0__80_26}" + local command_53 + command_53="$(git -C ${self_dir_2788} rev-parse --show-toplevel)" + __status=$? + if [ "${__status}" != 0 ]; then + echo_warning__139_v0 "Failed to find current Git repository, using script parent directory." + ret_get_repo_root393_v0="${self_dir_2788}" return 0 -fi; - __AF_get_repo_root298_v0="${__AMBER_VAL_55}"; + fi + ret_get_repo_root393_v0="${command_53}" return 0 } -__27_step_current=1 -get_source_root__302_v0() { - get_repo_root__298_v0 ; - __AF_get_repo_root298_v0__38_21="${__AF_get_repo_root298_v0}"; - local repo_root="${__AF_get_repo_root298_v0__38_21}" - __AF_get_source_root302_v0="${repo_root}/.nixie/sources"; + +get_source_root__397_v0() { + get_repo_root__393_v0 + local repo_root_2789="${ret_get_repo_root393_v0}" + ret_get_source_root397_v0="${repo_root_2789}/.nixie/sources" return 0 } -cachix_url__312_v0() { - local derivation=$1 - local member=$2 - env_var_get__91_v0 "SOURCE_CACHE"; - __AS=$?; - __AF_env_var_get91_v0__13_30="${__AF_env_var_get91_v0}"; - local SOURCE_CACHE="${__AF_env_var_get91_v0__13_30}" - __AF_cachix_url312_v0="https://${SOURCE_CACHE}/serve/${derivation}/${member}"; + +cachix_url__407_v0() { + local derivation_2820="${1}" + local member_2821="${2}" + env_var_get__122_v0 "SOURCE_CACHE" + __status=$? + local __SOURCE_CACHE_2822="${ret_env_var_get122_v0}" + ret_cachix_url407_v0="https://${__SOURCE_CACHE_2822}/serve/${derivation_2820}/${member_2821}" return 0 } -pull_source_file__313_v0() { - local member=$1 - local dest=$2 - env_var_get__91_v0 "SOURCE_DERIVATION"; - __AS=$?; - __AF_env_var_get91_v0__30_35="${__AF_env_var_get91_v0}"; - local SOURCE_DERIVATION="${__AF_env_var_get91_v0__30_35}" - local where="" - local my_status=1 - env_var_test__87_v0 "_NIXIE_TESTING_SKIP_TARBALL"; - __AF_env_var_test87_v0__36_12="$__AF_env_var_test87_v0"; - if [ $(echo '!' "$__AF_env_var_test87_v0__36_12" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - untar__289_v0 "sources/${member}" 0; - __AS=$?; - __AF_untar289_v0__37_23="${__AF_untar289_v0}"; - where="${__AF_untar289_v0__37_23}" - my_status=$__AS -fi - env_var_test__87_v0 "_NIXIE_TESTING_SOURCES_DIR"; - __AF_env_var_test87_v0__41_8="$__AF_env_var_test87_v0"; - if [ $(echo "$__AF_env_var_test87_v0__41_8" '&&' $(echo ${my_status} '!=' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - env_var_get__91_v0 "_NIXIE_TESTING_SOURCES_DIR"; - __AS=$?; - __AF_env_var_get91_v0__42_28="${__AF_env_var_get91_v0}"; - local srcdir="${__AF_env_var_get91_v0__42_28}" - __AMBER_VAL_56=$(mktemp -t -d nixie_${member}_XXXXXXXX); - __AS=$?; - local tmpd="${__AMBER_VAL_56}" - file_exists__33_v0 "${srcdir}/${member}.tar.gz"; - __AF_file_exists33_v0__45_12="$__AF_file_exists33_v0"; - if [ "$__AF_file_exists33_v0__45_12" != 0 ]; then - gzip -d -c ${srcdir}/${member}.tar.gz | tar -x -C ${tmpd}; - __AS=$? - my_status=$__AS - where="${tmpd}/${member}" -else - my_status=1 -fi -fi - if [ $(echo ${my_status} '!=' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_VAL_57=$(mktemp -t nixie_src_XXXXXXXX.tgz); - __AS=$?; - local tmpf="${__AMBER_VAL_57}" - __AMBER_VAL_58=$(mktemp -t -d nixie_${member}_XXXXXXXX); - __AS=$?; - local tmpd="${__AMBER_VAL_58}" - cachix_url__312_v0 "${SOURCE_DERIVATION}" "${member}.tar.gz"; - __AF_cachix_url312_v0__58_30="${__AF_cachix_url312_v0}"; - file_download__233_v0 "${__AF_cachix_url312_v0__58_30}" "${tmpf}"; - __AF_file_download233_v0__58_16="$__AF_file_download233_v0"; - if [ $(echo '!' "$__AF_file_download233_v0__58_16" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AF_pull_source_file313_v0=''; - return 1 -fi - gzip -d -c ${tmpf} | tar -x -C ${tmpd}; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_pull_source_file313_v0='' -return $__AS -fi - rm -f ${tmpf}; - __AS=$? - where="${tmpd}/${member}" -fi - rm -rf ${dest}; - __AS=$? - mv "${where}" "${dest}" -__AS=$? -} -__28_step_current=1 -pkg_exists__322_v0() { - local package=$1 - pkg-config ${package}; - __AS=$?; -if [ $__AS != 0 ]; then - __AF_pkg_exists322_v0=0; + +pull_source_file__408_v0() { + local member_2800="${1}" + local dest_2801="${2}" + env_var_get__122_v0 "SOURCE_DERIVATION" + __status=$? + local __SOURCE_DERIVATION_2802="${ret_env_var_get122_v0}" + local where_2803="" + local my_status_2804=1 + env_var_test__119_v0 "_NIXIE_TESTING_SKIP_TARBALL" + local ret_env_var_test119_v0__36_12="${ret_env_var_test119_v0}" + if [ "$(( ! ret_env_var_test119_v0__36_12 ))" != 0 ]; then + untar__384_v0 "sources/${member_2800}" 0 + __status=$? + where_2803="${ret_untar384_v0}" + my_status_2804="${__status}" + fi + env_var_test__119_v0 "_NIXIE_TESTING_SOURCES_DIR" + local ret_env_var_test119_v0__41_8="${ret_env_var_test119_v0}" + if [ "$(( ret_env_var_test119_v0__41_8 && $(( my_status_2804 != 0 )) ))" != 0 ]; then + env_var_get__122_v0 "_NIXIE_TESTING_SOURCES_DIR" + __status=$? + local srcdir_2816="${ret_env_var_get122_v0}" + local command_54 + command_54="$(mktemp -t -d nixie_${member_2800}_XXXXXXXX)" + __status=$? + local tmpd_2817="${command_54}" + file_exists__42_v0 "${srcdir_2816}/${member_2800}.tar.gz" + local ret_file_exists42_v0__45_12="${ret_file_exists42_v0}" + if [ "${ret_file_exists42_v0__45_12}" != 0 ]; then + gzip -d -c ${srcdir_2816}/${member_2800}.tar.gz | tar -x -C ${tmpd_2817} + __status=$? + my_status_2804="${__status}" + where_2803="${tmpd_2817}/${member_2800}" + else + my_status_2804=1 + fi + fi + if [ "$(( my_status_2804 != 0 ))" != 0 ]; then + local command_55 + command_55="$(mktemp -t nixie_src_XXXXXXXX.tgz)" + __status=$? + local tmpf_2818="${command_55}" + local command_56 + command_56="$(mktemp -t -d nixie_${member_2800}_XXXXXXXX)" + __status=$? + local tmpd_2819="${command_56}" + cachix_url__407_v0 "${__SOURCE_DERIVATION_2802}" "${member_2800}.tar.gz" + local ret_cachix_url407_v0__58_23="${ret_cachix_url407_v0}" + file_download__327_v0 "${ret_cachix_url407_v0__58_23}" "${tmpf_2818}" + __status=$? + if [ "${__status}" != 0 ]; then + ret_pull_source_file408_v0='' + return "${__status}" + fi + gzip -d -c ${tmpf_2818} | tar -x -C ${tmpd_2819} + __status=$? + if [ "${__status}" != 0 ]; then + ret_pull_source_file408_v0='' + return "${__status}" + fi + rm -f ${tmpf_2818} + __status=$? + where_2803="${tmpd_2819}/${member_2800}" + fi + rm -rf ${dest_2801} + __status=$? + mv "${where_2803}" "${dest_2801}" + __status=$? +} + +step_current_55=1 +pkg_exists__417_v0() { + local package_2799="${1}" + pkg-config ${package_2799} + __status=$? + if [ "${__status}" != 0 ]; then + ret_pkg_exists417_v0=0 return 0 -fi - __AF_pkg_exists322_v0=1; + fi + ret_pkg_exists417_v0=1 return 0 } -step_title__323_v0() { - local name=$1 - env_var_get__91_v0 "step_total"; - __AS=$?; - __AF_env_var_get91_v0__26_28="${__AF_env_var_get91_v0}"; - local step_total="${__AF_env_var_get91_v0__26_28}" - clear; - __AS=$? - set_title__259_v0 "Building Nix: ${name} (${__28_step_current}/${step_total})"; - __AF_set_title259_v0__30_5="$__AF_set_title259_v0"; - echo "$__AF_set_title259_v0__30_5" > /dev/null 2>&1 - __28_step_current=$(echo ${__28_step_current} '+' 1 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') -} -get_source_root__324_v0() { - get_repo_root__298_v0 ; - __AF_get_repo_root298_v0__38_21="${__AF_get_repo_root298_v0}"; - local repo_root="${__AF_get_repo_root298_v0__38_21}" - __AF_get_source_root324_v0="${repo_root}/.nixie/sources"; + +step_title__418_v0() { + local name_2795="${1}" + env_var_get__122_v0 "step_total" + __status=$? + local step_total_2796="${ret_env_var_get122_v0}" + clear + __status=$? + set_title__354_v0 "Building Nix: ${name_2795} (${step_current_55}/${step_total_2796})" + step_current_55="$(( step_current_55 + 1 ))" +} + +get_source_root__419_v0() { + get_repo_root__393_v0 + local repo_root_2790="${ret_get_repo_root393_v0}" + ret_get_source_root419_v0="${repo_root_2790}/.nixie/sources" return 0 } -make_headers__328_v0() { - __AMBER_VAL_59=$(grep ".*\.h:" ./Makefile | cut -f 1 -d :); - __AS=$?; - split_lines__4_v0 "${__AMBER_VAL_59}"; - __AF_split_lines4_v0__19_19=("${__AF_split_lines4_v0[@]}"); - for header in "${__AF_split_lines4_v0__19_19[@]}"; do - make ${header}; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_make_headers328_v0='' -return $__AS -fi -done -} -build_openssl_inner__329_v0() { - get_dll_ext__295_v0 ; - __AF_get_dll_ext295_v0__27_19="${__AF_get_dll_ext295_v0}"; - local dll_ext="${__AF_get_dll_ext295_v0__27_19}" - get_cache_root__297_v0 ; - __AF_get_cache_root297_v0__28_22="${__AF_get_cache_root297_v0}"; - local cache_root="${__AF_get_cache_root297_v0__28_22}" - chmod +x ./config; - __AS=$? - ./config; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_openssl_inner329_v0='' -return $__AS -fi - make_headers__328_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_openssl_inner329_v0='' -return $__AS -fi; - __AF_make_headers328_v0__33_5="$__AF_make_headers328_v0"; - echo "$__AF_make_headers328_v0__33_5" > /dev/null 2>&1 - make libcrypto.${dll_ext} libcrypto.pc; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_openssl_inner329_v0='' -return $__AS -fi - cp ./libcrypto.* ${cache_root}/nix-deps/lib/; - __AS=$? - cp ./libcrypto.pc ${cache_root}/nix-deps/lib/pkgconfig; - __AS=$? - cp -r ./include ${cache_root}/nix-deps/; - __AS=$? -} -build_openssl__330_v0() { - get_source_root__324_v0 ; - __AF_get_source_root324_v0__51_23="${__AF_get_source_root324_v0}"; - local source_root="${__AF_get_source_root324_v0__51_23}" - get_cache_root__297_v0 ; - __AF_get_cache_root297_v0__52_22="${__AF_get_cache_root297_v0}"; - local cache_root="${__AF_get_cache_root297_v0__52_22}" - step_title__323_v0 "libcrypto"; - __AF_step_title323_v0__54_5="$__AF_step_title323_v0"; - echo "$__AF_step_title323_v0__54_5" > /dev/null 2>&1 - pkg_exists__322_v0 "libcrypto"; - __AF_pkg_exists322_v0__56_8="$__AF_pkg_exists322_v0"; - if [ "$__AF_pkg_exists322_v0__56_8" != 0 ]; then - __AF_build_openssl330_v0=0; + +build_openssl_inner__424_v0() { + get_dll_ext__390_v0 + local dll_ext_516="${ret_get_dll_ext390_v0}" + get_cache_root__392_v0 + local cache_root_519="${ret_get_cache_root392_v0}" + chmod +x ./config + __status=$? + ./config + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_openssl_inner424_v0='' + return "${__status}" + fi + make_headers__423_v0 + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_openssl_inner424_v0='' + return "${__status}" + fi + make libcrypto.${dll_ext_516} libcrypto.pc + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_openssl_inner424_v0='' + return "${__status}" + fi + cp ./libcrypto.* ${cache_root_519}/nix-deps/lib/ + __status=$? + cp ./libcrypto.pc ${cache_root_519}/nix-deps/lib/pkgconfig + __status=$? + cp -r ./include ${cache_root_519}/nix-deps/ + __status=$? +} + +build_openssl__425_v0() { + get_source_root__419_v0 + local source_root_2791="${ret_get_source_root419_v0}" + get_cache_root__392_v0 + step_title__418_v0 "libcrypto" + pkg_exists__417_v0 "libcrypto" + local ret_pkg_exists417_v0__56_8="${ret_pkg_exists417_v0}" + if [ "${ret_pkg_exists417_v0__56_8}" != 0 ]; then + ret_build_openssl425_v0=0 return 0 -fi - env_var_test__87_v0 "OPENSSL_LIBS"; - __AF_env_var_test87_v0__58_8="$__AF_env_var_test87_v0"; - env_var_test__87_v0 "OPENSSL_CFLAGS"; - __AF_env_var_test87_v0__58_41="$__AF_env_var_test87_v0"; - if [ $(echo "$__AF_env_var_test87_v0__58_8" '&&' "$__AF_env_var_test87_v0__58_41" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AF_build_openssl330_v0=0; + fi + env_var_test__119_v0 "OPENSSL_LIBS" + local ret_env_var_test119_v0__58_8="${ret_env_var_test119_v0}" + env_var_test__119_v0 "OPENSSL_CFLAGS" + local ret_env_var_test119_v0__58_41="${ret_env_var_test119_v0}" + if [ "$(( ret_env_var_test119_v0__58_8 && ret_env_var_test119_v0__58_41 ))" != 0 ]; then + ret_build_openssl425_v0=0 return 0 -fi - pull_source_file__313_v0 "openssl" "${source_root}/openssl"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_openssl330_v0='' -return $__AS -fi; - __AF_pull_source_file313_v0__61_5="$__AF_pull_source_file313_v0"; - echo "$__AF_pull_source_file313_v0__61_5" > /dev/null 2>&1 - (cd ${source_root}/openssl && build_openssl_inner__329_v0); - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_openssl330_v0='' -return $__AS -fi -} -macos_build_post__339_v0() { - cc -shared -o liblowdown.1.dylib *.o; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_macos_build_post339_v0='' -return $__AS -fi + fi + pull_source_file__408_v0 "openssl" "${source_root_2791}/openssl" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_openssl425_v0='' + return "${__status}" + fi + (cd ${source_root_2791}/openssl && build_openssl_inner__424_v0) + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_openssl425_v0='' + return "${__status}" + fi } -build_lowdown_inner__340_v0() { - get_cache_root__297_v0 ; - __AF_get_cache_root297_v0__21_22="${__AF_get_cache_root297_v0}"; - local cache_root="${__AF_get_cache_root297_v0__21_22}" - ./configure PREFIX=${cache_root}/nix-deps; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_lowdown_inner340_v0='' -return $__AS -fi - make; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_lowdown_inner340_v0='' -return $__AS -fi - get_osname__292_v0 ; - __AF_get_osname292_v0__26_8="${__AF_get_osname292_v0}"; - if [ $([ "_${__AF_get_osname292_v0__26_8}" != "_Darwin" ]; echo $?) != 0 ]; then - macos_build_post__339_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_lowdown_inner340_v0='' -return $__AS -fi; - __AF_macos_build_post339_v0__27_9="$__AF_macos_build_post339_v0"; - echo "$__AF_macos_build_post339_v0__27_9" > /dev/null 2>&1 -fi - make install_shared; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_lowdown_inner340_v0='' -return $__AS -fi + +build_lowdown_inner__435_v0() { + get_cache_root__392_v0 + local cache_root_774="${ret_get_cache_root392_v0}" + ./configure PREFIX=${cache_root_774}/nix-deps + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_lowdown_inner435_v0='' + return "${__status}" + fi + make + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_lowdown_inner435_v0='' + return "${__status}" + fi + get_osname__387_v0 + local ret_get_osname387_v0__26_8="${ret_get_osname387_v0}" + if [ "$([ "_${ret_get_osname387_v0__26_8}" != "_Darwin" ]; echo $?)" != 0 ]; then + macos_build_post__434_v0 + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_lowdown_inner435_v0='' + return "${__status}" + fi + fi + make install_shared + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_lowdown_inner435_v0='' + return "${__status}" + fi } -build_lowdown__341_v0() { - get_source_root__324_v0 ; - __AF_get_source_root324_v0__36_23="${__AF_get_source_root324_v0}"; - local source_root="${__AF_get_source_root324_v0__36_23}" - get_cache_root__297_v0 ; - __AF_get_cache_root297_v0__37_22="${__AF_get_cache_root297_v0}"; - local cache_root="${__AF_get_cache_root297_v0__37_22}" - step_title__323_v0 "lowdown"; - __AF_step_title323_v0__39_5="$__AF_step_title323_v0"; - echo "$__AF_step_title323_v0__39_5" > /dev/null 2>&1 - pkg_exists__322_v0 "lowdown"; - __AF_pkg_exists322_v0__41_8="$__AF_pkg_exists322_v0"; - if [ "$__AF_pkg_exists322_v0__41_8" != 0 ]; then - __AF_build_lowdown341_v0=0; + +build_lowdown__436_v0() { + get_source_root__419_v0 + local source_root_2832="${ret_get_source_root419_v0}" + get_cache_root__392_v0 + step_title__418_v0 "lowdown" + pkg_exists__417_v0 "lowdown" + local ret_pkg_exists417_v0__41_8="${ret_pkg_exists417_v0}" + if [ "${ret_pkg_exists417_v0__41_8}" != 0 ]; then + ret_build_lowdown436_v0=0 return 0 -fi - pull_source_file__313_v0 "lowdown" "${source_root}/lowdown"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_lowdown341_v0='' -return $__AS -fi; - __AF_pull_source_file313_v0__44_5="$__AF_pull_source_file313_v0"; - echo "$__AF_pull_source_file313_v0__44_5" > /dev/null 2>&1 - (cd ${source_root}/lowdown && build_lowdown_inner__340_v0); - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_lowdown341_v0='' -return $__AS -fi + fi + pull_source_file__408_v0 "lowdown" "${source_root_2832}/lowdown" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_lowdown436_v0='' + return "${__status}" + fi + (cd ${source_root_2832}/lowdown && build_lowdown_inner__435_v0) + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_lowdown436_v0='' + return "${__status}" + fi } -build_nlohmann_json__350_v0() { - get_source_root__324_v0 ; - __AF_get_source_root324_v0__16_23="${__AF_get_source_root324_v0}"; - local source_root="${__AF_get_source_root324_v0__16_23}" - get_cache_root__297_v0 ; - __AF_get_cache_root297_v0__17_22="${__AF_get_cache_root297_v0}"; - local cache_root="${__AF_get_cache_root297_v0__17_22}" - step_title__323_v0 "nlohmann_json"; - __AF_step_title323_v0__19_5="$__AF_step_title323_v0"; - echo "$__AF_step_title323_v0__19_5" > /dev/null 2>&1 - pkg_exists__322_v0 "nlohmann_json"; - __AF_pkg_exists322_v0__21_8="$__AF_pkg_exists322_v0"; - if [ "$__AF_pkg_exists322_v0__21_8" != 0 ]; then - __AF_build_nlohmann_json350_v0=0; + +build_nlohmann_json__445_v0() { + get_source_root__419_v0 + local source_root_2827="${ret_get_source_root419_v0}" + get_cache_root__392_v0 + local cache_root_2828="${ret_get_cache_root392_v0}" + step_title__418_v0 "nlohmann_json" + pkg_exists__417_v0 "nlohmann_json" + local ret_pkg_exists417_v0__21_8="${ret_pkg_exists417_v0}" + if [ "${ret_pkg_exists417_v0__21_8}" != 0 ]; then + ret_build_nlohmann_json445_v0=0 return 0 -fi - pull_source_file__313_v0 "nlohmann_json" "${source_root}/nlohmann_json"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nlohmann_json350_v0='' -return $__AS -fi; - __AF_pull_source_file313_v0__24_5="$__AF_pull_source_file313_v0"; - echo "$__AF_pull_source_file313_v0__24_5" > /dev/null 2>&1 - __AMBER_VAL_60=$(grep "^version:" ${source_root}/nlohmann_json/wsjcpp.yml | cut -d '"' -f 2 | cut -d 'v' -f 2); - __AS=$?; - local version="${__AMBER_VAL_60}" - file_write__35_v0 "${cache_root}/nix-deps/lib/pkgconfig/nlohmann_json.pc" "Name: nlohmann_json -Version: ${version} + fi + pull_source_file__408_v0 "nlohmann_json" "${source_root_2827}/nlohmann_json" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nlohmann_json445_v0='' + return "${__status}" + fi + local command_57 + command_57="$(grep "^version:" ${source_root_2827}/nlohmann_json/wsjcpp.yml | cut -d '"' -f 2 | cut -d 'v' -f 2)" + __status=$? + local version_2829="${command_57}" + file_write__44_v0 "${cache_root_2828}/nix-deps/lib/pkgconfig/nlohmann_json.pc" "Name: nlohmann_json +Version: ${version_2829} Description: JSON for Modern C++ -Cflags: -I${source_root}/nlohmann_json/include"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nlohmann_json350_v0='' -return $__AS -fi; - __AF_file_write35_v0__28_5="${__AF_file_write35_v0}"; - echo "${__AF_file_write35_v0__28_5}" > /dev/null 2>&1 -} -__AMBER_ARRAY_61=("predef" "chrono" "container" "context" "coroutine" "system" "thread"); -__29_modules=("${__AMBER_ARRAY_61[@]}") -find_boost_libs__359_v0() { - local libs=("${!1}") - for lib in "${libs[@]}"; do - local libname="libboost_${lib}*" - file_exists__33_v0 "/usr/lib/${libname}"; - __AF_file_exists33_v0__23_20="$__AF_file_exists33_v0"; - file_exists__33_v0 "/usr/local/lib/${libname}"; - __AF_file_exists33_v0__24_20="$__AF_file_exists33_v0"; - if [ $(echo '!' $(echo "$__AF_file_exists33_v0__23_20" '||' "$__AF_file_exists33_v0__24_20" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AF_find_boost_libs359_v0=0; +Cflags: -I${source_root_2827}/nlohmann_json/include" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nlohmann_json445_v0='' + return "${__status}" + fi +} + +modules_56=("predef" "chrono" "container" "context" "coroutine" "system" "thread") +find_boost_libs__454_v0() { + local libs_2824=("${!1}") + for lib_2825 in "${libs_2824[@]}"; do + local libname_2826="libboost_${lib_2825}*" + file_exists__42_v0 "/usr/lib/${libname_2826}" + local ret_file_exists42_v0__23_20="${ret_file_exists42_v0}" + file_exists__42_v0 "/usr/local/lib/${libname_2826}" + local ret_file_exists42_v0__24_20="${ret_file_exists42_v0}" + if [ "$(( ! $(( ret_file_exists42_v0__23_20 || ret_file_exists42_v0__24_20 )) ))" != 0 ]; then + ret_find_boost_libs454_v0=0 return 0 -fi - dir_exists__32_v0 "/usr/include/boost/${lib}"; - __AF_dir_exists32_v0__26_20="$__AF_dir_exists32_v0"; - dir_exists__32_v0 "/usr/local/include/boost/${lib}"; - __AF_dir_exists32_v0__27_20="$__AF_dir_exists32_v0"; - if [ $(echo '!' $(echo "$__AF_dir_exists32_v0__26_20" '||' "$__AF_dir_exists32_v0__27_20" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AF_find_boost_libs359_v0=0; + fi + dir_exists__41_v0 "/usr/include/boost/${lib_2825}" + local ret_dir_exists41_v0__26_20="${ret_dir_exists41_v0}" + dir_exists__41_v0 "/usr/local/include/boost/${lib_2825}" + local ret_dir_exists41_v0__27_20="${ret_dir_exists41_v0}" + if [ "$(( ! $(( ret_dir_exists41_v0__26_20 || ret_dir_exists41_v0__27_20 )) ))" != 0 ]; then + ret_find_boost_libs454_v0=0 return 0 -fi -done - __AF_find_boost_libs359_v0=1; + fi + done + ret_find_boost_libs454_v0=1 return 0 } -build_boost_inner__360_v0() { - __AMBER_ARRAY_62=("variant=release" "link=static" "--stagedir=."); - local args=("${__AMBER_ARRAY_62[@]}") - for mod in "${__29_modules[@]}"; do - __AMBER_ARRAY_63=("--with-${mod}"); - args+=("${__AMBER_ARRAY_63[@]}") -done - ./bootstrap.sh; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_boost_inner360_v0='' -return $__AS -fi - ./b2 "${args[@]}"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_boost_inner360_v0='' -return $__AS -fi + +build_boost_inner__455_v0() { + local args_607=("variant=release" "link=static" "--stagedir=.") + for mod_608 in "${modules_56[@]}"; do + args_607+=("--with-${mod_608}") + done + ./bootstrap.sh + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_boost_inner455_v0='' + return "${__status}" + fi + ./b2 "${args_607[@]}" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_boost_inner455_v0='' + return "${__status}" + fi } -build_boost__361_v0() { - get_source_root__324_v0 ; - __AF_get_source_root324_v0__52_23="${__AF_get_source_root324_v0}"; - local source_root="${__AF_get_source_root324_v0__52_23}" - step_title__323_v0 "boost"; - __AF_step_title323_v0__54_5="$__AF_step_title323_v0"; - echo "$__AF_step_title323_v0__54_5" > /dev/null 2>&1 - __AMBER_ARRAY_64=("atomic"); - __AMBER_ARRAY_ADD_65=("${__AMBER_ARRAY_64[@]}" "${__29_modules[@]}"); - find_boost_libs__359_v0 __AMBER_ARRAY_ADD_65[@]; - __AF_find_boost_libs359_v0__56_8="$__AF_find_boost_libs359_v0"; - if [ "$__AF_find_boost_libs359_v0__56_8" != 0 ]; then - __AF_build_boost361_v0=0; + +build_boost__456_v0() { + get_source_root__419_v0 + local source_root_2823="${ret_get_source_root419_v0}" + step_title__418_v0 "boost" + local array_61=("atomic") + local array_add_62=("${array_61[@]}" "${modules_56[@]}") + find_boost_libs__454_v0 array_add_62[@] + local ret_find_boost_libs454_v0__56_8="${ret_find_boost_libs454_v0}" + if [ "${ret_find_boost_libs454_v0__56_8}" != 0 ]; then + ret_build_boost456_v0=0 return 0 -fi - pull_source_file__313_v0 "boost" "${source_root}/boost"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_boost361_v0='' -return $__AS -fi; - __AF_pull_source_file313_v0__59_5="$__AF_pull_source_file313_v0"; - echo "$__AF_pull_source_file313_v0__59_5" > /dev/null 2>&1 - (cd ${source_root}/boost && build_boost_inner__360_v0); - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_boost361_v0='' -return $__AS -fi - env_var_set__90_v0 "BOOST_ROOT" "${source_root}/boost"; - __AS=$?; - __AF_env_var_set90_v0__63_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__63_11" > /dev/null 2>&1 - export BOOST_ROOT; - __AS=$? -} -build_autoconf_dep__369_v0() { - local lib_name=$1 - local inc_prefix=$2 - get_source_root__324_v0 ; - __AF_get_source_root324_v0__19_23="${__AF_get_source_root324_v0}"; - local source_root="${__AF_get_source_root324_v0__19_23}" - get_cache_root__297_v0 ; - __AF_get_cache_root297_v0__20_22="${__AF_get_cache_root297_v0}"; - local cache_root="${__AF_get_cache_root297_v0__20_22}" - local my_source="${source_root}/${lib_name}" - step_title__323_v0 "${lib_name}"; - __AF_step_title323_v0__24_5="$__AF_step_title323_v0"; - echo "$__AF_step_title323_v0__24_5" > /dev/null 2>&1 - pkg_exists__322_v0 "${lib_name}"; - __AF_pkg_exists322_v0__26_8="$__AF_pkg_exists322_v0"; - if [ "$__AF_pkg_exists322_v0__26_8" != 0 ]; then - __AF_build_autoconf_dep369_v0=''; + fi + pull_source_file__408_v0 "boost" "${source_root_2823}/boost" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_boost456_v0='' + return "${__status}" + fi + (cd ${source_root_2823}/boost && build_boost_inner__455_v0) + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_boost456_v0='' + return "${__status}" + fi + env_var_set__121_v0 "BOOST_ROOT" "${source_root_2823}/boost" + __status=$? + export BOOST_ROOT + __status=$? +} + +build_autoconf_dep__464_v0() { + local lib_name_2834="${1}" + local inc_prefix_2835="${2}" + get_source_root__419_v0 + local source_root_2836="${ret_get_source_root419_v0}" + get_cache_root__392_v0 + local cache_root_2837="${ret_get_cache_root392_v0}" + local my_source_2838="${source_root_2836}/${lib_name_2834}" + step_title__418_v0 "${lib_name_2834}" + pkg_exists__417_v0 "${lib_name_2834}" + local ret_pkg_exists417_v0__26_8="${ret_pkg_exists417_v0}" + if [ "${ret_pkg_exists417_v0__26_8}" != 0 ]; then + ret_build_autoconf_dep464_v0='' return 0 -fi - pull_source_file__313_v0 "${lib_name}" "${my_source}"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_autoconf_dep369_v0='' -return $__AS -fi; - __AF_pull_source_file313_v0__29_5="$__AF_pull_source_file313_v0"; - echo "$__AF_pull_source_file313_v0__29_5" > /dev/null 2>&1 - ( unset C_INCLUDE_PATH CPLUS_INCLUDE_PATH && cd ${my_source} && ./configure --prefix=${cache_root}/nix-deps && make && make install ); - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_autoconf_dep369_v0='' -return $__AS -fi + fi + pull_source_file__408_v0 "${lib_name_2834}" "${my_source_2838}" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_autoconf_dep464_v0='' + return "${__status}" + fi + ( unset C_INCLUDE_PATH CPLUS_INCLUDE_PATH && cd ${my_source_2838} && ./configure --prefix=${cache_root_2837}/nix-deps && make && make install ) + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_autoconf_dep464_v0='' + return "${__status}" + fi } -build_nix_inner__379_v0() { - get_source_root__324_v0 ; - __AF_get_source_root324_v0__16_23="${__AF_get_source_root324_v0}"; - local source_root="${__AF_get_source_root324_v0__16_23}" - local venv="${source_root}/nix/venv" - mkdir build && cd build; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nix_inner379_v0='' -return $__AS -fi - ${venv}/bin/meson setup -Dlibstore:seccomp-sandboxing=disabled -Dlibcmd:readline-flavor=editline -Dlibexpr:gc=disabled -Dlibutil:cpuid=disabled -Ddoc-gen=false -Dunit-tests=false -Dbindings=false ..; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nix_inner379_v0='' -return $__AS -fi - ${venv}/bin/ninja; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nix_inner379_v0='' -return $__AS -fi + +build_nix_inner__474_v0() { + get_source_root__419_v0 + local source_root_1066="${ret_get_source_root419_v0}" + local venv_1067="${source_root_1066}/nix/venv" + mkdir build && cd build + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nix_inner474_v0='' + return "${__status}" + fi + ${venv_1067}/bin/meson setup -Dlibstore:seccomp-sandboxing=disabled -Dlibcmd:readline-flavor=editline -Dlibexpr:gc=disabled -Dlibutil:cpuid=disabled -Ddoc-gen=false -Dunit-tests=false -Dbindings=false .. + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nix_inner474_v0='' + return "${__status}" + fi + ${venv_1067}/bin/ninja + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nix_inner474_v0='' + return "${__status}" + fi } -build_nix__380_v0() { - get_source_root__324_v0 ; - __AF_get_source_root324_v0__39_23="${__AF_get_source_root324_v0}"; - local source_root="${__AF_get_source_root324_v0__39_23}" - get_cache_root__297_v0 ; - __AF_get_cache_root297_v0__40_22="${__AF_get_cache_root297_v0}"; - local cache_root="${__AF_get_cache_root297_v0__40_22}" - local venv="${source_root}/nix/venv" - step_title__323_v0 "nix"; - __AF_step_title323_v0__44_5="$__AF_step_title323_v0"; - echo "$__AF_step_title323_v0__44_5" > /dev/null 2>&1 - pull_source_file__313_v0 "nix" "${source_root}/nix"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nix380_v0='' -return $__AS -fi; - __AF_pull_source_file313_v0__46_5="$__AF_pull_source_file313_v0"; - echo "$__AF_pull_source_file313_v0__46_5" > /dev/null 2>&1 - python3 -m venv --system-site-packages "${venv}"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nix380_v0='' -return $__AS -fi - export LIBRARY_PATH=${cache_root}/nix-deps/lib:$LIBRARY_PATH; - __AS=$? - export PKG_CONFIG_PATH=${cache_root}/nix-deps/lib/pkgconfig:${cache_root}/nix-deps/share/pkgconfig:$PKG_CONFIG_PATH; - __AS=$? - ${venv}/bin/pip install meson ninja; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nix380_v0='' -return $__AS -fi - (cd ${source_root}/nix && build_nix_inner__379_v0); - __AS=$?; -if [ $__AS != 0 ]; then -__AF_build_nix380_v0='' -return $__AS -fi - mv "${source_root}/nix/src/nix/nix" "${cache_root}/nix-static" -__AS=$? -} -darwin_export_sdk__382_v0() { - __AMBER_VAL_66=$(xcrun --show-sdk-path); - __AS=$?; - local sdk_path="${__AMBER_VAL_66}" - dir_exists__32_v0 "${sdk_path}"; - __AF_dir_exists32_v0__30_12="$__AF_dir_exists32_v0"; - if [ $(echo '!' "$__AF_dir_exists32_v0__30_12" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - bail__140_v0 "The macOS SDK from Xcode or CommandLineTools is required to build Nix." 0; - __AF_bail140_v0__31_9="$__AF_bail140_v0"; - echo "$__AF_bail140_v0__31_9" > /dev/null 2>&1 -fi - local sdk_libs="${sdk_path}/usr/lib" - local sdk_cflags="-I${sdk_path}/usr/include" - env_var_set__90_v0 "LIBCURL_LIBS" "${sdk_libs}"; - __AS=$?; - __AF_env_var_set90_v0__36_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__36_11" > /dev/null 2>&1 - env_var_set__90_v0 "LIBCURL_CFLAGS" "${sdk_cflags}"; - __AS=$?; - __AF_env_var_set90_v0__37_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__37_11" > /dev/null 2>&1 - env_var_set__90_v0 "LIBARCHIVE_LIBS" "${sdk_libs}"; - __AS=$?; - __AF_env_var_set90_v0__38_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__38_11" > /dev/null 2>&1 - env_var_set__90_v0 "LIBARCHIVE_CFLAGS" "${sdk_cflags}"; - __AS=$?; - __AF_env_var_set90_v0__39_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__39_11" > /dev/null 2>&1 - env_var_set__90_v0 "OPENSSL_LIBS" "${sdk_libs}"; - __AS=$?; - __AF_env_var_set90_v0__40_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__40_11" > /dev/null 2>&1 - env_var_set__90_v0 "OPENSSL_CFLAGS" "${sdk_cflags}"; - __AS=$?; - __AF_env_var_set90_v0__41_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__41_11" > /dev/null 2>&1 - export LIBCURL_LIBS LIBCURL_CFLAGS LIBARCHIVE_LIBS LIBARCHIVE_CFLAGS OPENSSL_LIBS OPENSSL_CFLAGS; - __AS=$? -} -try_build_nix__383_v0() { - get_cache_root__159_v0 ; - __AF_get_cache_root159_v0__55_22="${__AF_get_cache_root159_v0}"; - local cache_root="${__AF_get_cache_root159_v0__55_22}" - __AMBER_ARRAY_67=("cc" "c++" "pkg-config" "make" "flex" "bison" "perl"); - check_deps__144_v0 __AMBER_ARRAY_67[@]; - __AS=$?; -if [ $__AS != 0 ]; then - bail__140_v0 "Missing required dependencies to build from source." 0; - __AF_bail140_v0__58_18="$__AF_bail140_v0"; - echo "$__AF_bail140_v0__58_18" > /dev/null 2>&1 -fi; - __AF_check_deps144_v0__57_5="$__AF_check_deps144_v0"; - echo "$__AF_check_deps144_v0__57_5" > /dev/null 2>&1 - get_osname__154_v0 ; - __AF_get_osname154_v0__60_8="${__AF_get_osname154_v0}"; - if [ $([ "_${__AF_get_osname154_v0__60_8}" != "_Darwin" ]; echo $?) != 0 ]; then - darwin_export_sdk__382_v0 ; - __AF_darwin_export_sdk382_v0__61_9="$__AF_darwin_export_sdk382_v0"; - echo "$__AF_darwin_export_sdk382_v0__61_9" > /dev/null 2>&1 -fi - env_var_set__90_v0 "step_total" "9"; - __AS=$?; - __AF_env_var_set90_v0__63_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__63_11" > /dev/null 2>&1 - get_source_root__302_v0 ; - __AF_get_source_root302_v0__65_16="${__AF_get_source_root302_v0}"; - dir_create__38_v0 "${__AF_get_source_root302_v0__65_16}"; - __AF_dir_create38_v0__65_5="$__AF_dir_create38_v0"; - echo "$__AF_dir_create38_v0__65_5" > /dev/null 2>&1 - dir_create__38_v0 "${cache_root}/nix-deps/lib/pkgconfig"; - __AF_dir_create38_v0__66_5="$__AF_dir_create38_v0"; - echo "$__AF_dir_create38_v0__66_5" > /dev/null 2>&1 - build_openssl__330_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_openssl330_v0__68_5="$__AF_build_openssl330_v0"; - echo "$__AF_build_openssl330_v0__68_5" > /dev/null 2>&1 - build_boost__361_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_boost361_v0__69_5="$__AF_build_boost361_v0"; - echo "$__AF_build_boost361_v0__69_5" > /dev/null 2>&1 - build_nlohmann_json__350_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_nlohmann_json350_v0__70_5="$__AF_build_nlohmann_json350_v0"; - echo "$__AF_build_nlohmann_json350_v0__70_5" > /dev/null 2>&1 - build_lowdown__341_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_lowdown341_v0__71_5="$__AF_build_lowdown341_v0"; - echo "$__AF_build_lowdown341_v0__71_5" > /dev/null 2>&1 - build_autoconf_dep__369_v0 "libbrotlicommon" "c/include"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_autoconf_dep369_v0__73_5="$__AF_build_autoconf_dep369_v0"; - echo "$__AF_build_autoconf_dep369_v0__73_5" > /dev/null 2>&1 - build_autoconf_dep__369_v0 "libsodium" "src/libsodium/include"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_autoconf_dep369_v0__74_5="$__AF_build_autoconf_dep369_v0"; - echo "$__AF_build_autoconf_dep369_v0__74_5" > /dev/null 2>&1 - build_autoconf_dep__369_v0 "libeditline" "include"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_autoconf_dep369_v0__75_5="$__AF_build_autoconf_dep369_v0"; - echo "$__AF_build_autoconf_dep369_v0__75_5" > /dev/null 2>&1 - build_autoconf_dep__369_v0 "libarchive" "libarchive"; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_autoconf_dep369_v0__76_5="$__AF_build_autoconf_dep369_v0"; - echo "$__AF_build_autoconf_dep369_v0__76_5" > /dev/null 2>&1 - build_nix__380_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then -__AF_try_build_nix383_v0='' -return $__AS -fi; - __AF_build_nix380_v0__77_5="$__AF_build_nix380_v0"; - echo "$__AF_build_nix380_v0__77_5" > /dev/null 2>&1 -} -is_nix_installed__385_v0() { - env_var_test__87_v0 "nosystem"; - __AF_env_var_test87_v0__24_8="$__AF_env_var_test87_v0"; - if [ "$__AF_env_var_test87_v0__24_8" != 0 ]; then - __AF_is_nix_installed385_v0=0; + +build_nix__475_v0() { + get_source_root__419_v0 + local source_root_2839="${ret_get_source_root419_v0}" + get_cache_root__392_v0 + local cache_root_2840="${ret_get_cache_root392_v0}" + local venv_2841="${source_root_2839}/nix/venv" + step_title__418_v0 "nix" + pull_source_file__408_v0 "nix" "${source_root_2839}/nix" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nix475_v0='' + return "${__status}" + fi + python3 -m venv --system-site-packages "${venv_2841}" + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nix475_v0='' + return "${__status}" + fi + export LIBRARY_PATH=${cache_root_2840}/nix-deps/lib:$LIBRARY_PATH + __status=$? + export PKG_CONFIG_PATH=${cache_root_2840}/nix-deps/lib/pkgconfig:${cache_root_2840}/nix-deps/share/pkgconfig:$PKG_CONFIG_PATH + __status=$? + ${venv_2841}/bin/pip install meson ninja + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nix475_v0='' + return "${__status}" + fi + (cd ${source_root_2839}/nix && build_nix_inner__474_v0) + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_nix475_v0='' + return "${__status}" + fi + mv "${source_root_2839}/nix/src/nix/nix" "${cache_root_2840}/nix-static" + __status=$? +} + +darwin_export_sdk__477_v0() { + local command_63 + command_63="$(xcrun --show-sdk-path)" + __status=$? + local sdk_path_2784="${command_63}" + dir_exists__41_v0 "${sdk_path_2784}" + local ret_dir_exists41_v0__30_12="${ret_dir_exists41_v0}" + if [ "$(( ! ret_dir_exists41_v0__30_12 ))" != 0 ]; then + bail__181_v0 "The macOS SDK from Xcode or CommandLineTools is required to build Nix." 0 + fi + local sdk_libs_2785="${sdk_path_2784}/usr/lib" + local sdk_cflags_2786="-I${sdk_path_2784}/usr/include" + env_var_set__121_v0 "LIBCURL_LIBS" "${sdk_libs_2785}" + __status=$? + env_var_set__121_v0 "LIBCURL_CFLAGS" "${sdk_cflags_2786}" + __status=$? + env_var_set__121_v0 "LIBARCHIVE_LIBS" "${sdk_libs_2785}" + __status=$? + env_var_set__121_v0 "LIBARCHIVE_CFLAGS" "${sdk_cflags_2786}" + __status=$? + env_var_set__121_v0 "OPENSSL_LIBS" "${sdk_libs_2785}" + __status=$? + env_var_set__121_v0 "OPENSSL_CFLAGS" "${sdk_cflags_2786}" + __status=$? + export LIBCURL_LIBS LIBCURL_CFLAGS LIBARCHIVE_LIBS LIBARCHIVE_CFLAGS OPENSSL_LIBS OPENSSL_CFLAGS + __status=$? +} + +try_build_nix__478_v0() { + get_cache_root__200_v0 + local cache_root_2783="${ret_get_cache_root200_v0}" + local array_64=("cc" "c++" "pkg-config" "make" "flex" "bison" "perl") + check_deps__185_v0 array_64[@] + __status=$? + if [ "${__status}" != 0 ]; then + bail__181_v0 "Missing required dependencies to build from source." 0 + fi + get_osname__195_v0 + local ret_get_osname195_v0__60_8="${ret_get_osname195_v0}" + if [ "$([ "_${ret_get_osname195_v0__60_8}" != "_Darwin" ]; echo $?)" != 0 ]; then + darwin_export_sdk__477_v0 + fi + env_var_set__121_v0 "step_total" "9" + __status=$? + get_source_root__397_v0 + local ret_get_source_root397_v0__65_22="${ret_get_source_root397_v0}" + dir_create__47_v0 "${ret_get_source_root397_v0__65_22}" + __status=$? + dir_create__47_v0 "${cache_root_2783}/nix-deps/lib/pkgconfig" + __status=$? + build_openssl__425_v0 + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi + build_boost__456_v0 + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi + build_nlohmann_json__445_v0 + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi + build_lowdown__436_v0 + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi + build_autoconf_dep__464_v0 "libbrotlicommon" "c/include" + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi + build_autoconf_dep__464_v0 "libsodium" "src/libsodium/include" + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi + build_autoconf_dep__464_v0 "libeditline" "include" + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi + build_autoconf_dep__464_v0 "libarchive" "libarchive" + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi + build_nix__475_v0 + __status=$? + if [ "${__status}" != 0 ]; then + ret_try_build_nix478_v0='' + return "${__status}" + fi +} + +is_nix_installed__480_v0() { + env_var_test__119_v0 "nosystem" + local ret_env_var_test119_v0__24_8="${ret_env_var_test119_v0}" + if [ "${ret_env_var_test119_v0__24_8}" != 0 ]; then + ret_is_nix_installed480_v0=0 return 0 -fi - dir_exists__32_v0 "/nix/store"; - __AF_dir_exists32_v0__29_8="$__AF_dir_exists32_v0"; - if [ "$__AF_dir_exists32_v0__29_8" != 0 ]; then - __AF_is_nix_installed385_v0=1; + fi + dir_exists__41_v0 "/nix/store" + local ret_dir_exists41_v0__29_8="${ret_dir_exists41_v0}" + if [ "${ret_dir_exists41_v0__29_8}" != 0 ]; then + ret_is_nix_installed480_v0=1 return 0 -fi - __AF_is_nix_installed385_v0=0; + fi + ret_is_nix_installed480_v0=0 return 0 } -get_nix__386_v0() { - get_cache_root__159_v0 ; - __AF_get_cache_root159_v0__44_22="${__AF_get_cache_root159_v0}"; - local cache_root="${__AF_get_cache_root159_v0__44_22}" - get_osname__154_v0 ; - __AF_get_osname154_v0__45_18="${__AF_get_osname154_v0}"; - local osname="${__AF_get_osname154_v0__45_18}" - get_system__156_v0 ; - __AF_get_system156_v0__46_18="${__AF_get_system156_v0}"; - local system="${__AF_get_system156_v0__46_18}" - local nix_path="${cache_root}/nix-static" - local fakedir_path="${cache_root}/nix-deps/lib/libfakedir.dylib" - enter_alt_buffer__134_v0 ; - __AF_enter_alt_buffer134_v0__51_5="$__AF_enter_alt_buffer134_v0"; - echo "$__AF_enter_alt_buffer134_v0__51_5" > /dev/null 2>&1 - set_title__133_v0 "Building Nix..."; - __AF_set_title133_v0__52_5="$__AF_set_title133_v0"; - echo "$__AF_set_title133_v0__52_5" > /dev/null 2>&1 - trap "teardown__136_v0; exit 1" SIGKILL SIGTERM SIGINT SIGABRT; - __AS=$? - file_exists__33_v0 "${fakedir_path}"; - __AF_file_exists33_v0__58_35="$__AF_file_exists33_v0"; - if [ $(echo $([ "_${osname}" != "_Darwin" ]; echo $?) '&&' $(echo '!' "$__AF_file_exists33_v0__58_35" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - dir_create__38_v0 "${cache_root}/nix-deps/lib"; - __AF_dir_create38_v0__59_9="$__AF_dir_create38_v0"; - echo "$__AF_dir_create38_v0__59_9" > /dev/null 2>&1 - pull_binary__241_v0 "libfakedir.dylib" "${fakedir_path}"; - __AS=$?; -if [ $__AS != 0 ]; then - teardown__136_v0 1; - __AF_teardown136_v0__61_13="$__AF_teardown136_v0"; - echo "$__AF_teardown136_v0__61_13" > /dev/null 2>&1 - __AF_get_nix386_v0=''; + +get_nix__481_v0() { + get_cache_root__200_v0 + local cache_root_2765="${ret_get_cache_root200_v0}" + get_osname__195_v0 + local osname_2766="${ret_get_osname195_v0}" + get_system__197_v0 + local system_2770="${ret_get_system197_v0}" + local nix_path_2771="${cache_root_2765}/nix-static" + local fakedir_path_2772="${cache_root_2765}/nix-deps/lib/libfakedir.dylib" + enter_alt_buffer__175_v0 + set_title__174_v0 "Building Nix..." + trap "teardown__177_v0; exit 1" SIGKILL SIGTERM SIGINT SIGABRT + __status=$? + file_exists__42_v0 "${fakedir_path_2772}" + local ret_file_exists42_v0__58_35="${ret_file_exists42_v0}" + if [ "$(( $([ "_${osname_2766}" != "_Darwin" ]; echo $?) && $(( ! ret_file_exists42_v0__58_35 )) ))" != 0 ]; then + dir_create__47_v0 "${cache_root_2765}/nix-deps/lib" + __status=$? + pull_binary__336_v0 "libfakedir.dylib" "${fakedir_path_2772}" + __status=$? + if [ "${__status}" != 0 ]; then + teardown__177_v0 1 + ret_get_nix481_v0='' return 1 -fi; - __AF_pull_binary241_v0__60_9="$__AF_pull_binary241_v0"; - echo "$__AF_pull_binary241_v0__60_9" > /dev/null 2>&1 -fi - get_self__141_v0 ; - __AF_get_self141_v0__67_62="${__AF_get_self141_v0}"; - exists_newer__139_v0 "${fakedir_path}" "${__AF_get_self141_v0__67_62}"; - __AF_exists_newer139_v0__67_35="$__AF_exists_newer139_v0"; - if [ $(echo $([ "_${osname}" != "_Darwin" ]; echo $?) '&&' $(echo '!' "$__AF_exists_newer139_v0__67_35" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - pull_binary__241_v0 "libfakedir.dylib" "${fakedir_path}"; - __AS=$?; - __AF_pull_binary241_v0__68_15="$__AF_pull_binary241_v0"; - echo "$__AF_pull_binary241_v0__68_15" > /dev/null 2>&1 -fi - file_exists__33_v0 "${nix_path}"; - __AF_file_exists33_v0__71_8="$__AF_file_exists33_v0"; - if [ "$__AF_file_exists33_v0__71_8" != 0 ]; then - teardown__136_v0 0; - __AF_teardown136_v0__72_9="$__AF_teardown136_v0"; - echo "$__AF_teardown136_v0__72_9" > /dev/null 2>&1 - __AF_get_nix386_v0=0; + fi + fi + get_self__182_v0 + local ret_get_self182_v0__67_62="${ret_get_self182_v0}" + exists_newer__180_v0 "${fakedir_path_2772}" "${ret_get_self182_v0__67_62}" + local ret_exists_newer180_v0__67_35="${ret_exists_newer180_v0}" + if [ "$(( $([ "_${osname_2766}" != "_Darwin" ]; echo $?) && $(( ! ret_exists_newer180_v0__67_35 )) ))" != 0 ]; then + pull_binary__336_v0 "libfakedir.dylib" "${fakedir_path_2772}" + __status=$? + fi + file_exists__42_v0 "${nix_path_2771}" + local ret_file_exists42_v0__71_8="${ret_file_exists42_v0}" + if [ "${ret_file_exists42_v0__71_8}" != 0 ]; then + teardown__177_v0 0 + ret_get_nix481_v0=0 return 0 -fi - env_var_test__87_v0 "nobins"; - __AF_env_var_test87_v0__76_8="$__AF_env_var_test87_v0"; - if [ "$__AF_env_var_test87_v0__76_8" != 0 ]; then - try_build_nix__383_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then - teardown__136_v0 1; - __AF_teardown136_v0__78_13="$__AF_teardown136_v0"; - echo "$__AF_teardown136_v0__78_13" > /dev/null 2>&1 - __AF_get_nix386_v0=''; + fi + env_var_test__119_v0 "nobins" + local ret_env_var_test119_v0__76_8="${ret_env_var_test119_v0}" + if [ "${ret_env_var_test119_v0__76_8}" != 0 ]; then + try_build_nix__478_v0 + __status=$? + if [ "${__status}" != 0 ]; then + teardown__177_v0 1 + ret_get_nix481_v0='' return 1 -fi; - __AF_try_build_nix383_v0__77_9="$__AF_try_build_nix383_v0"; - echo "$__AF_try_build_nix383_v0__77_9" > /dev/null 2>&1 -fi - pull_binary__241_v0 "nix.${system}" "${nix_path}"; - __AS=$?; -if [ $__AS != 0 ]; then - try_build_nix__383_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then - teardown__136_v0 1; - __AF_teardown136_v0__86_13="$__AF_teardown136_v0"; - echo "$__AF_teardown136_v0__86_13" > /dev/null 2>&1 - __AF_get_nix386_v0=''; + fi + fi + pull_binary__336_v0 "nix.${system_2770}" "${nix_path_2771}" + __status=$? + if [ "${__status}" != 0 ]; then + try_build_nix__478_v0 + __status=$? + if [ "${__status}" != 0 ]; then + teardown__177_v0 1 + ret_get_nix481_v0='' return 1 -fi; - __AF_try_build_nix383_v0__85_9="$__AF_try_build_nix383_v0"; - echo "$__AF_try_build_nix383_v0__85_9" > /dev/null 2>&1 -fi; - __AF_pull_binary241_v0__84_5="$__AF_pull_binary241_v0"; - echo "$__AF_pull_binary241_v0__84_5" > /dev/null 2>&1 - chmod +x ${nix_path}; - __AS=$? - teardown__136_v0 0; - __AF_teardown136_v0__93_5="$__AF_teardown136_v0"; - echo "$__AF_teardown136_v0__93_5" > /dev/null 2>&1 - __AF_get_nix386_v0=0; + fi + fi + chmod +x ${nix_path_2771} + __status=$? + teardown__177_v0 0 + ret_get_nix481_v0=0 return 0 } -migrate_nix_store__387_v0() { - local nix_root="" - get_nix_root__158_v0 ; - __AF_get_nix_root158_v0__105_30="${__AF_get_nix_root158_v0}"; - __AMBER_VAL_68=$(readlink -f ${__AF_get_nix_root158_v0__105_30}); - __AS=$?; -if [ $__AS != 0 ]; then - get_nix_root__158_v0 ; - __AF_get_nix_root158_v0__106_20="${__AF_get_nix_root158_v0}"; - nix_root="${__AF_get_nix_root158_v0__106_20}" -fi; - nix_root="${__AMBER_VAL_68}" - dir_exists__32_v0 "${nix_root}/nix/store"; - __AF_dir_exists32_v0__109_12="$__AF_dir_exists32_v0"; - if [ $(echo '!' "$__AF_dir_exists32_v0__109_12" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AF_migrate_nix_store387_v0=0; + +migrate_nix_store__482_v0() { + get_nix_root__199_v0 + local ret_get_nix_root199_v0__105_30="${ret_get_nix_root199_v0}" + local command_65 + command_65="$(readlink -f ${ret_get_nix_root199_v0__105_30})" + __status=$? + if [ "${__status}" != 0 ]; then + get_nix_root__199_v0 + fi + nix_root_2764="${command_65}" + dir_exists__41_v0 "${nix_root_2764}/nix/store" + local ret_dir_exists41_v0__109_12="${ret_dir_exists41_v0}" + if [ "$(( ! ret_dir_exists41_v0__109_12 ))" != 0 ]; then + ret_migrate_nix_store482_v0=0 return 0 -fi + fi echo "Migrating Nix store to system-wide install..." - nix copy --from ${nix_root} --all --no-check-sigs; - __AS=$? - if [ $(echo $__AS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - chmod -R +wx ${nix_root} && rm -rf ${nix_root}; - __AS=$? -fi + nix copy --from ${nix_root_2764} --all --no-check-sigs + __status=$? + if [ "$(( __status == 0 ))" != 0 ]; then + chmod -R +wx ${nix_root_2764} && rm -rf ${nix_root_2764} + __status=$? + fi } -unpack_channels__388_v0() { - get_repo_root__160_v0 ; - __AF_get_repo_root160_v0__123_21="${__AF_get_repo_root160_v0}"; - local repo_root="${__AF_get_repo_root160_v0__123_21}" - get_self__141_v0 ; - __AF_get_self141_v0__125_52="${__AF_get_self141_v0}"; - exists_newer__139_v0 "${repo_root}/.nixie/channels" "${__AF_get_self141_v0__125_52}"; - __AF_exists_newer139_v0__125_8="$__AF_exists_newer139_v0"; - if [ "$__AF_exists_newer139_v0__125_8" != 0 ]; then - env_var_get__91_v0 "NIX_PATH"; - __AS=$?; - __AF_env_var_get91_v0__126_30="${__AF_env_var_get91_v0}"; - local NIX_PATH="${__AF_env_var_get91_v0__126_30}" - env_var_set__90_v0 "NIX_PATH" "${repo_root}/.nixie/channels:${NIX_PATH}"; - __AS=$?; - __AF_env_var_set90_v0__127_15="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__127_15" > /dev/null 2>&1 - export NIX_PATH; - __AS=$? - __AF_unpack_channels388_v0=0; + +unpack_channels__483_v0() { + get_repo_root__201_v0 + local repo_root_2757="${ret_get_repo_root201_v0}" + get_self__182_v0 + local ret_get_self182_v0__125_52="${ret_get_self182_v0}" + exists_newer__180_v0 "${repo_root_2757}/.nixie/channels" "${ret_get_self182_v0__125_52}" + local ret_exists_newer180_v0__125_8="${ret_exists_newer180_v0}" + if [ "${ret_exists_newer180_v0__125_8}" != 0 ]; then + env_var_get__122_v0 "NIX_PATH" + __status=$? + local __NIX_PATH_2763="${ret_env_var_get122_v0}" + env_var_set__121_v0 "NIX_PATH" "${repo_root_2757}/.nixie/channels:${__NIX_PATH_2763}" + __status=$? + export NIX_PATH + __status=$? + ret_unpack_channels483_v0=0 return 0 -fi + fi echo "Unpacking Nix channels, hang tight..." - dir_create__38_v0 "${repo_root}/.nixie"; - __AF_dir_create38_v0__133_5="$__AF_dir_create38_v0"; - echo "$__AF_dir_create38_v0__133_5" > /dev/null 2>&1 - untar__143_v0 "channels -C ${repo_root}/.nixie" 0; - __AS=$?; -if [ $__AS != 0 ]; then - mkdir ${repo_root}/.nixie/channels; - __AS=$? -fi; - __AF_untar143_v0__134_5="${__AF_untar143_v0}"; - echo "${__AF_untar143_v0__134_5}" > /dev/null 2>&1 -} -populate_extras__389_v0() { - __AMBER_ARRAY_69=(); - local args=("${__AMBER_ARRAY_69[@]}") - env_var_get__91_v0 "EXTRA_FEATURES"; - __AS=$?; - __AF_env_var_get91_v0__146_43="${__AF_env_var_get91_v0}"; - local EXTRA_FEATURES="${__AF_env_var_get91_v0__146_43}" - env_var_get__91_v0 "EXTRA_SUBSTITUTERS"; - __AS=$?; - __AF_env_var_get91_v0__147_43="${__AF_env_var_get91_v0}"; - local EXTRA_SUBSTITUTERS="${__AF_env_var_get91_v0__147_43}" - env_var_get__91_v0 "EXTRA_TRUSTED_PUBLIC_KEYS"; - __AS=$?; - __AF_env_var_get91_v0__148_43="${__AF_env_var_get91_v0}"; - local EXTRA_TRUSTED_PUBLIC_KEYS="${__AF_env_var_get91_v0__148_43}" - get_nix_root__158_v0 ; - __AF_get_nix_root158_v0__150_20="${__AF_get_nix_root158_v0}"; - local nix_root="${__AF_get_nix_root158_v0__150_20}" - if [ $([ "_${EXTRA_FEATURES}" == "_" ]; echo $?) != 0 ]; then - __AMBER_ARRAY_70=("--extra-experimental-features" "${EXTRA_FEATURES}"); - args+=("${__AMBER_ARRAY_70[@]}") -fi - if [ $([ "_${EXTRA_SUBSTITUTERS}" == "_" ]; echo $?) != 0 ]; then - __AMBER_ARRAY_71=("--extra-substituters" "${EXTRA_SUBSTITUTERS}"); - args+=("${__AMBER_ARRAY_71[@]}") -fi - if [ $([ "_${EXTRA_TRUSTED_PUBLIC_KEYS}" == "_" ]; echo $?) != 0 ]; then - __AMBER_ARRAY_72=("--extra-trusted-public-keys" "${EXTRA_TRUSTED_PUBLIC_KEYS}"); - args+=("${__AMBER_ARRAY_72[@]}") -fi - get_osname__154_v0 ; - __AF_get_osname154_v0__161_8="${__AF_get_osname154_v0}"; - is_nix_installed__385_v0 ; - __AF_is_nix_installed385_v0__161_41="$__AF_is_nix_installed385_v0"; - if [ $(echo $([ "_${__AF_get_osname154_v0__161_8}" == "_Darwin" ]; echo $?) '&&' $(echo '!' "$__AF_is_nix_installed385_v0__161_41" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_VAL_74=$(readlink -f ${nix_root}); - __AS=$?; - __AMBER_ARRAY_73=("--store" "${__AMBER_VAL_74}"); - args+=("${__AMBER_ARRAY_73[@]}") -fi - __AF_populate_extras389_v0=("${args[@]}"); + dir_create__47_v0 "${repo_root_2757}/.nixie" + __status=$? + untar__184_v0 "channels -C ${repo_root_2757}/.nixie" 0 + __status=$? + if [ "${__status}" != 0 ]; then + mkdir ${repo_root_2757}/.nixie/channels + __status=$? + fi +} + +populate_extras__484_v0() { + local args_2747=() + env_var_get__122_v0 "EXTRA_FEATURES" + __status=$? + local __EXTRA_FEATURES_2748="${ret_env_var_get122_v0}" + env_var_get__122_v0 "EXTRA_SUBSTITUTERS" + __status=$? + local __EXTRA_SUBSTITUTERS_2749="${ret_env_var_get122_v0}" + env_var_get__122_v0 "EXTRA_TRUSTED_PUBLIC_KEYS" + __status=$? + local __EXTRA_TRUSTED_PUBLIC_KEYS_2750="${ret_env_var_get122_v0}" + get_nix_root__199_v0 + local nix_root_2751="${ret_get_nix_root199_v0}" + if [ "$([ "_${__EXTRA_FEATURES_2748}" == "_" ]; echo $?)" != 0 ]; then + args_2747+=("--extra-experimental-features" "${__EXTRA_FEATURES_2748}") + fi + if [ "$([ "_${__EXTRA_SUBSTITUTERS_2749}" == "_" ]; echo $?)" != 0 ]; then + args_2747+=("--extra-substituters" "${__EXTRA_SUBSTITUTERS_2749}") + fi + if [ "$([ "_${__EXTRA_TRUSTED_PUBLIC_KEYS_2750}" == "_" ]; echo $?)" != 0 ]; then + args_2747+=("--extra-trusted-public-keys" "${__EXTRA_TRUSTED_PUBLIC_KEYS_2750}") + fi + get_osname__195_v0 + local ret_get_osname195_v0__161_8="${ret_get_osname195_v0}" + is_nix_installed__480_v0 + local ret_is_nix_installed480_v0__161_41="${ret_is_nix_installed480_v0}" + if [ "$(( $([ "_${ret_get_osname195_v0__161_8}" == "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed480_v0__161_41 )) ))" != 0 ]; then + local command_71 + command_71="$(readlink -f ${nix_root_2751})" + __status=$? + args_2747+=("--store" "${command_71}") + fi + ret_populate_extras484_v0=("${args_2747[@]}") return 0 } -launch_darwin_workaround__390_v0() { - local name=$1 - local nix_path=$2 - local args=("${!3}") - get_cache_root__159_v0 ; - __AF_get_cache_root159_v0__176_22="${__AF_get_cache_root159_v0}"; - local cache_root="${__AF_get_cache_root159_v0__176_22}" - get_nix_root__158_v0 ; - __AF_get_nix_root158_v0__177_20="${__AF_get_nix_root158_v0}"; - local nix_root="${__AF_get_nix_root158_v0__177_20}" - local fakedir_path="${cache_root}/nix-deps/lib/libfakedir.dylib" - env_var_set__90_v0 "FAKEDIR_PATTERN" "/nix"; - __AS=$?; - __AF_env_var_set90_v0__181_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__181_11" > /dev/null 2>&1 - env_var_set__90_v0 "FAKEDIR_TARGET" "${nix_root}/nix"; - __AS=$?; - __AF_env_var_set90_v0__182_11="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__182_11" > /dev/null 2>&1 - export FAKEDIR_PATTERN FAKEDIR_TARGET; - __AS=$? - _NIX_TEST_NO_SANDBOX=1 DYLD_INSERT_LIBRARIES="${fakedir_path}" DYLD_LIBRARY_PATH="${cache_root}/nix-deps/lib" exec -a ${name} ${nix_path} "${args[@]}"; - __AS=$? -} -launch_shell_command__391_v0() { - local nix_path=$1 - local cmd=$2 - local extras=("${!3}") - local args=("${!4}") - get_repo_root__160_v0 ; - __AF_get_repo_root160_v0__205_21="${__AF_get_repo_root160_v0}"; - local repo_root="${__AF_get_repo_root160_v0__205_21}" - env_var_get__91_v0 "PWD"; - __AS=$?; - __AF_env_var_get91_v0__206_21="${__AF_env_var_get91_v0}"; - local pwd="${__AF_env_var_get91_v0__206_21}" - local name="nix-shell" - __AMBER_ARRAY_75=("${repo_root}/shell.nix" "--command" "${cmd} ${args[@]}"); - local shell_cmd=("${__AMBER_ARRAY_75[@]}") - file_exists__33_v0 "${pwd}/flake.nix"; - __AF_file_exists33_v0__210_8="$__AF_file_exists33_v0"; - if [ "$__AF_file_exists33_v0__210_8" != 0 ]; then - name="nix" - __AMBER_ARRAY_76=("develop" "${pwd}" "-c" "${cmd}"); - __AMBER_ARRAY_ADD_77=("${__AMBER_ARRAY_76[@]}" "${args[@]}"); - shell_cmd=("${__AMBER_ARRAY_ADD_77[@]}") -else - file_exists__33_v0 "${repo_root}/flake.nix"; - __AF_file_exists33_v0__213_16="$__AF_file_exists33_v0"; - if [ "$__AF_file_exists33_v0__213_16" != 0 ]; then - name="nix" - __AMBER_ARRAY_78=("develop" "${repo_root}" "-c" "${cmd}"); - __AMBER_ARRAY_ADD_79=("${__AMBER_ARRAY_78[@]}" "${args[@]}"); - shell_cmd=("${__AMBER_ARRAY_ADD_79[@]}") -else - file_exists__33_v0 "${pwd}/shell.nix"; - __AF_file_exists33_v0__216_16="$__AF_file_exists33_v0"; - if [ "$__AF_file_exists33_v0__216_16" != 0 ]; then - __AMBER_ARRAY_80=("${pwd}/shell.nix" "--command" "${cmd} ${args[@]}"); - shell_cmd=("${__AMBER_ARRAY_80[@]}") -fi -fi -fi - get_osname__154_v0 ; - __AF_get_osname154_v0__220_8="${__AF_get_osname154_v0}"; - is_nix_installed__385_v0 ; - __AF_is_nix_installed385_v0__220_41="$__AF_is_nix_installed385_v0"; - if [ $(echo $([ "_${__AF_get_osname154_v0__220_8}" != "_Darwin" ]; echo $?) '&&' $(echo '!' "$__AF_is_nix_installed385_v0__220_41" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_ARRAY_ADD_81=("${extras[@]}" "${shell_cmd[@]}"); - launch_darwin_workaround__390_v0 "${name}" "${nix_path}" __AMBER_ARRAY_ADD_81[@]; - __AF_launch_darwin_workaround390_v0__221_9="$__AF_launch_darwin_workaround390_v0"; - echo "$__AF_launch_darwin_workaround390_v0__221_9" > /dev/null 2>&1 -else - exec -a ${name} ${nix_path} "${extras[@]}" "${shell_cmd[@]}"; - __AS=$? -fi + +launch_darwin_workaround__485_v0() { + local name_2856="${1}" + local nix_path_2857="${2}" + local args_2858=("${!3}") + get_cache_root__200_v0 + local cache_root_2859="${ret_get_cache_root200_v0}" + get_nix_root__199_v0 + local nix_root_2860="${ret_get_nix_root199_v0}" + local fakedir_path_2861="${cache_root_2859}/nix-deps/lib/libfakedir.dylib" + env_var_set__121_v0 "FAKEDIR_PATTERN" "/nix" + __status=$? + env_var_set__121_v0 "FAKEDIR_TARGET" "${nix_root_2860}/nix" + __status=$? + export FAKEDIR_PATTERN FAKEDIR_TARGET + __status=$? + _NIX_TEST_NO_SANDBOX=1 DYLD_INSERT_LIBRARIES="${fakedir_path_2861}" DYLD_LIBRARY_PATH="${cache_root_2859}/nix-deps/lib" exec -a ${name_2856} "${nix_path_2857}" "${args_2858[@]}" + __status=$? } -launch_nix_shebang__392_v0() { - local nix_path=$1 - local file=$2 - local extras=("${!3}") - local args=("${!4}") - local shebang="" - i=0; -while IFS= read -r line; do - if [ $(echo ${i} '==' 1 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - shebang="${line}" + +launch_shell_command__486_v0() { + local nix_path_2862="${1}" + local cmd_2863="${2}" + local extras_2864=("${!3}") + local args_2865=("${!4}") + get_repo_root__201_v0 + local repo_root_2866="${ret_get_repo_root201_v0}" + env_var_get__122_v0 "PWD" + __status=$? + local pwd_2867="${ret_env_var_get122_v0}" + local name_2868="nix-shell" + local shell_cmd_2869=("${repo_root_2866}/shell.nix" "--command" "${cmd_2863} ${args_2865[@]}") + file_exists__42_v0 "${pwd_2867}/flake.nix" + local ret_file_exists42_v0__210_8="${ret_file_exists42_v0}" + if [ "${ret_file_exists42_v0__210_8}" != 0 ]; then + name_2868="nix" + local array_73=("develop" "${pwd_2867}" "-c" "${cmd_2863}") + shell_cmd_2869=("${array_73[@]}" "${args_2865[@]}") + else + file_exists__42_v0 "${repo_root_2866}/flake.nix" + local ret_file_exists42_v0__213_16="${ret_file_exists42_v0}" + if [ "${ret_file_exists42_v0__213_16}" != 0 ]; then + name_2868="nix" + local array_75=("develop" "${repo_root_2866}" "-c" "${cmd_2863}") + shell_cmd_2869=("${array_75[@]}" "${args_2865[@]}") + else + file_exists__42_v0 "${pwd_2867}/shell.nix" + local ret_file_exists42_v0__216_16="${ret_file_exists42_v0}" + if [ "${ret_file_exists42_v0__216_16}" != 0 ]; then + shell_cmd_2869=("${pwd_2867}/shell.nix" "--command" "${cmd_2863} ${args_2865[@]}") + fi + fi + fi + get_osname__195_v0 + local ret_get_osname195_v0__220_8="${ret_get_osname195_v0}" + is_nix_installed__480_v0 + local ret_is_nix_installed480_v0__220_41="${ret_is_nix_installed480_v0}" + if [ "$(( $([ "_${ret_get_osname195_v0__220_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed480_v0__220_41 )) ))" != 0 ]; then + local array_add_78=("${extras_2864[@]}" "${shell_cmd_2869[@]}") + launch_darwin_workaround__485_v0 "${name_2868}" "${nix_path_2862}" array_add_78[@] + else + exec -a ${name_2868} ${nix_path_2862} "${extras_2864[@]}" "${shell_cmd_2869[@]}" + __status=$? + fi +} + +launch_nix_shebang__487_v0() { + local nix_path_2845="${1}" + local file_2846="${2}" + local extras_2847=("${!3}") + local args_2848=("${!4}") + local shebang_2849="" + i_2851=0; + while IFS= read -r line_2850 || [ -n "$line_2850" ]; do + if [ "$(( i_2851 == 1 ))" != 0 ]; then + shebang_2849="${line_2850}" break -fi - (( i++ )) || true -done <"${file}" - starts_with__20_v0 "${shebang}" "#"'!'""; - __AF_starts_with20_v0__247_12="$__AF_starts_with20_v0"; - if [ $(echo '!' "$__AF_starts_with20_v0__247_12" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AF_launch_nix_shebang392_v0=''; + fi + (( i_2851++ )) || true + done <"${file_2846}" + starts_with__23_v0 "${shebang_2849}" "#"'!'"" + local ret_starts_with23_v0__247_12="${ret_starts_with23_v0}" + if [ "$(( ! ret_starts_with23_v0__247_12 ))" != 0 ]; then + ret_launch_nix_shebang487_v0='' return 0 -fi - slice__22_v0 "${shebang}" 2 0; - __AF_slice22_v0__249_27="${__AF_slice22_v0}"; - split__3_v0 "${__AF_slice22_v0__249_27}" " "; - __AF_split3_v0__249_21=("${__AF_split3_v0[@]}"); - local bang_args=("${__AF_split3_v0__249_21[@]}") - array_shift__120_v0 bang_args; - __AF_array_shift120_v0__250_16="${__AF_array_shift120_v0}"; - local name="${__AF_array_shift120_v0__250_16}" - i=0; -for arg in "${bang_args[@]}"; do - if [ $([ "_${arg}" != "_-i" ]; echo $?) != 0 ]; then - bang_args[${i}]="--command" - bang_args[$(echo ${i} '+' 1 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//')]="${bang_args[$(echo ${i} '+' 1 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//')]} ${file} ${args[@]}" + fi + slice__25_v0 "${shebang_2849}" 2 0 + local ret_slice25_v0__249_27="${ret_slice25_v0}" + split__5_v0 "${ret_slice25_v0__249_27}" " " + local bang_args_2852=("${ret_split5_v0[@]}") + array_shift__78_v0 "bang_args_2852" + __status=$? + local name_2853="${ret_array_shift78_v0}" + i_2855=0; + for arg_2854 in "${bang_args_2852[@]}"; do + if [ "$([ "_${arg_2854}" != "_-i" ]; echo $?)" != 0 ]; then + bang_args_2852["${i_2855}"]="--command" + bang_args_2852["$(( i_2855 + 1 ))"]="${bang_args_2852[$(( i_2855 + 1 ))]} ${file_2846} ${args_2848[@]}" break -fi - (( i++ )) || true -done - get_osname__154_v0 ; - __AF_get_osname154_v0__261_8="${__AF_get_osname154_v0}"; - is_nix_installed__385_v0 ; - __AF_is_nix_installed385_v0__261_41="$__AF_is_nix_installed385_v0"; - if [ $(echo $([ "_${__AF_get_osname154_v0__261_8}" != "_Darwin" ]; echo $?) '&&' $(echo '!' "$__AF_is_nix_installed385_v0__261_41" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_ARRAY_ADD_82=("${extras[@]}" "${bang_args[@]}"); - launch_darwin_workaround__390_v0 "${name}" "${nix_path}" __AMBER_ARRAY_ADD_82[@]; - __AF_launch_darwin_workaround390_v0__262_9="$__AF_launch_darwin_workaround390_v0"; - echo "$__AF_launch_darwin_workaround390_v0__262_9" > /dev/null 2>&1 -else - exec -a ${name} ${nix_path} "${extras[@]}" "${bang_args[@]}"; - __AS=$? -fi + fi + (( i_2855++ )) || true + done + get_osname__195_v0 + local ret_get_osname195_v0__261_8="${ret_get_osname195_v0}" + is_nix_installed__480_v0 + local ret_is_nix_installed480_v0__261_41="${ret_is_nix_installed480_v0}" + if [ "$(( $([ "_${ret_get_osname195_v0__261_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed480_v0__261_41 )) ))" != 0 ]; then + local array_add_79=("${extras_2847[@]}" "${bang_args_2852[@]}") + launch_darwin_workaround__485_v0 "${name_2853}" "${nix_path_2845}" array_add_79[@] + else + exec -a ${name_2853} ${nix_path_2845} "${extras_2847[@]}" "${bang_args_2852[@]}" + __status=$? + fi } -launch_nix__393_v0() { - local self=$1 - local args=("${!2}") - get_cache_root__159_v0 ; - __AF_get_cache_root159_v0__272_22="${__AF_get_cache_root159_v0}"; - local cache_root="${__AF_get_cache_root159_v0__272_22}" - get_nix_root__158_v0 ; - __AF_get_nix_root158_v0__273_20="${__AF_get_nix_root158_v0}"; - local nix_root="${__AF_get_nix_root158_v0__273_20}" - local nix_path="${cache_root}/nix-static" - populate_extras__389_v0 ; - __AF_populate_extras389_v0__277_18=("${__AF_populate_extras389_v0[@]}"); - local extras=("${__AF_populate_extras389_v0__277_18[@]}") - split__3_v0 "${self}" "/"; - __AF_split3_v0__278_27=("${__AF_split3_v0[@]}"); - array_last__116_v0 __AF_split3_v0__278_27[@]; - __AF_array_last116_v0__278_16="${__AF_array_last116_v0}"; - local name="${__AF_array_last116_v0__278_16}" - starts_with__20_v0 "${name}" "nix-"; - __AF_starts_with20_v0__280_8="$__AF_starts_with20_v0"; - if [ "$__AF_starts_with20_v0__280_8" != 0 ]; then - unpack_channels__388_v0 ; - __AF_unpack_channels388_v0__281_15="$__AF_unpack_channels388_v0"; - echo "$__AF_unpack_channels388_v0__281_15" > /dev/null 2>&1 -fi - is_nix_installed__385_v0 ; - __AF_is_nix_installed385_v0__283_8="$__AF_is_nix_installed385_v0"; - if [ "$__AF_is_nix_installed385_v0__283_8" != 0 ]; then - migrate_nix_store__387_v0 ; - __AF_migrate_nix_store387_v0__284_9="$__AF_migrate_nix_store387_v0"; - echo "$__AF_migrate_nix_store387_v0__284_9" > /dev/null 2>&1 - nix_path="nix" -else - get_nix__386_v0 ; - __AS=$?; -if [ $__AS != 0 ]; then - bail__140_v0 "Failed to obtain Nix. Check your internet connection." 0; - __AF_bail140_v0__288_13="$__AF_bail140_v0"; - echo "$__AF_bail140_v0__288_13" > /dev/null 2>&1 -fi; - __AF_get_nix386_v0__287_9="$__AF_get_nix386_v0"; - echo "$__AF_get_nix386_v0__287_9" > /dev/null 2>&1 -fi - export NIX_SSL_CERT_FILE; - __AS=$? - file_exists__33_v0 "${args[0]}"; - __AF_file_exists33_v0__294_8="$__AF_file_exists33_v0"; - ends_with__21_v0 "${args[0]}" ".nix"; - __AF_ends_with21_v0__294_37="$__AF_ends_with21_v0"; - if [ $(echo "$__AF_file_exists33_v0__294_8" '&&' $(echo '!' "$__AF_ends_with21_v0__294_37" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - local args_shebang=("${args[@]}") - array_shift__120_v0 args_shebang; - __AF_array_shift120_v0__296_9="${__AF_array_shift120_v0}"; - echo "${__AF_array_shift120_v0__296_9}" > /dev/null 2>&1 - launch_nix_shebang__392_v0 "${nix_path}" "${args[0]}" extras[@] args_shebang[@]; - __AF_launch_nix_shebang392_v0__297_9="$__AF_launch_nix_shebang392_v0"; - echo "$__AF_launch_nix_shebang392_v0__297_9" > /dev/null 2>&1 -fi - starts_with__20_v0 "${name}" "nix"; - __AF_starts_with20_v0__300_12="$__AF_starts_with20_v0"; - if [ $(echo '!' "$__AF_starts_with20_v0__300_12" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - launch_shell_command__391_v0 "${nix_path}" "${name}" extras[@] args[@]; - __AF_launch_shell_command391_v0__301_9="$__AF_launch_shell_command391_v0"; - echo "$__AF_launch_shell_command391_v0__301_9" > /dev/null 2>&1 -fi - get_osname__154_v0 ; - __AF_get_osname154_v0__304_8="${__AF_get_osname154_v0}"; - is_nix_installed__385_v0 ; - __AF_is_nix_installed385_v0__304_41="$__AF_is_nix_installed385_v0"; - if [ $(echo $([ "_${__AF_get_osname154_v0__304_8}" != "_Darwin" ]; echo $?) '&&' $(echo '!' "$__AF_is_nix_installed385_v0__304_41" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then - __AMBER_ARRAY_ADD_83=("${extras[@]}" "${args[@]}"); - launch_darwin_workaround__390_v0 "${name}" "${nix_path}" __AMBER_ARRAY_ADD_83[@]; - __AF_launch_darwin_workaround390_v0__305_9="$__AF_launch_darwin_workaround390_v0"; - echo "$__AF_launch_darwin_workaround390_v0__305_9" > /dev/null 2>&1 -else - exec -a ${name} ${nix_path} "${extras[@]}" "${args[@]}"; - __AS=$? -fi + +launch_nix__488_v0() { + local self_2742="${1}" + local args_2743=("${!2}") + get_cache_root__200_v0 + local cache_root_2744="${ret_get_cache_root200_v0}" + get_nix_root__199_v0 + local nix_path_2746="${cache_root_2744}/nix-static" + populate_extras__484_v0 + local extras_2753=("${ret_populate_extras484_v0[@]}") + split__5_v0 "${self_2742}" "/" + local ret_split5_v0__278_33=("${ret_split5_v0[@]}") + array_last__74_v0 ret_split5_v0__278_33[@] + __status=$? + local name_2756="${ret_array_last74_v0}" + starts_with__23_v0 "${name_2756}" "nix-" + local ret_starts_with23_v0__280_8="${ret_starts_with23_v0}" + if [ "${ret_starts_with23_v0__280_8}" != 0 ]; then + unpack_channels__483_v0 + fi + is_nix_installed__480_v0 + local ret_is_nix_installed480_v0__283_8="${ret_is_nix_installed480_v0}" + if [ "${ret_is_nix_installed480_v0__283_8}" != 0 ]; then + migrate_nix_store__482_v0 + nix_path_2746="nix" + else + get_nix__481_v0 + __status=$? + if [ "${__status}" != 0 ]; then + bail__181_v0 "Failed to obtain Nix. Check your internet connection." 0 + fi + fi + export NIX_SSL_CERT_FILE + __status=$? + file_exists__42_v0 "${args_2743[0]}" + local ret_file_exists42_v0__294_8="${ret_file_exists42_v0}" + ends_with__24_v0 "${args_2743[0]}" ".nix" + local ret_ends_with24_v0__294_37="${ret_ends_with24_v0}" + if [ "$(( ret_file_exists42_v0__294_8 && $(( ! ret_ends_with24_v0__294_37 )) ))" != 0 ]; then + local args_shebang_2844=("${args_2743[@]}") + array_shift__78_v0 "args_shebang_2844" + __status=$? + launch_nix_shebang__487_v0 "${nix_path_2746}" "${args_2743[0]}" extras_2753[@] args_shebang_2844[@] + fi + starts_with__23_v0 "${name_2756}" "nix" + local ret_starts_with23_v0__300_12="${ret_starts_with23_v0}" + if [ "$(( ! ret_starts_with23_v0__300_12 ))" != 0 ]; then + launch_shell_command__486_v0 "${nix_path_2746}" "${name_2756}" extras_2753[@] args_2743[@] + fi + get_osname__195_v0 + local ret_get_osname195_v0__304_8="${ret_get_osname195_v0}" + is_nix_installed__480_v0 + local ret_is_nix_installed480_v0__304_41="${ret_is_nix_installed480_v0}" + if [ "$(( $([ "_${ret_get_osname195_v0__304_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed480_v0__304_41 )) ))" != 0 ]; then + local array_add_80=("${extras_2753[@]}" "${args_2743[@]}") + launch_darwin_workaround__485_v0 "${name_2756}" "${nix_path_2746}" array_add_80[@] + else + exec -a ${name_2756} ${nix_path_2746} "${extras_2753[@]}" "${args_2743[@]}" + __status=$? + fi } -__0_SOURCE_CACHE="" -__1_SOURCE_DERIVATION="" -__2_NIX_BINS_DERIVATION="" -__3_EXTRA_FEATURES="" -__4_EXTRA_SUBSTITUTERS="" -__5_EXTRA_TRUSTED_PUBLIC_KEYS="" -__6_NIXIE_VERSION="" -__AMBER_ARRAY_84=(); -__7_args=("${__AMBER_ARRAY_84[@]}") -__AMBER_ARRAY_85=("tar" "gzip" "uname"); -check_deps__144_v0 __AMBER_ARRAY_85[@]; -__AS=$?; -if [ $__AS != 0 ]; then + +array_82=("tar" "gzip" "uname") +check_deps__185_v0 array_82[@] +__status=$? +if [ "${__status}" != 0 ]; then exit 1 -fi; -__AF_check_deps144_v0__26_1="$__AF_check_deps144_v0"; -echo "$__AF_check_deps144_v0__26_1" > /dev/null 2>&1 -load_features__395_v0() { - untar__143_v0 "features" 1; - __AS=$?; -if [ $__AS != 0 ]; then - bail__140_v0 "The resource archive is missing or malformed." 1; - __AF_bail140_v0__39_9="$__AF_bail140_v0"; - echo "$__AF_bail140_v0__39_9" > /dev/null 2>&1 -fi; - __AF_untar143_v0__38_19="${__AF_untar143_v0}"; - local envfile="${__AF_untar143_v0__38_19}" - eval ${envfile}; - __AS=$?; -if [ $__AS != 0 ]; then - bail__140_v0 "The environment file in the resource archive is malformed." 1; - __AF_bail140_v0__43_9="$__AF_bail140_v0"; - echo "$__AF_bail140_v0__43_9" > /dev/null 2>&1 -fi - env_var_get__91_v0 "SOURCE_CACHE"; - __AS=$?; - __AF_env_var_get91_v0__46_33="${__AF_env_var_get91_v0}"; - __0_SOURCE_CACHE="${__AF_env_var_get91_v0__46_33}" - env_var_get__91_v0 "SOURCE_DERIVATION"; - __AS=$?; - __AF_env_var_get91_v0__47_33="${__AF_env_var_get91_v0}"; - __1_SOURCE_DERIVATION="${__AF_env_var_get91_v0__47_33}" - env_var_get__91_v0 "NIX_BINS_DERIVATION"; - __AS=$?; - __AF_env_var_get91_v0__48_33="${__AF_env_var_get91_v0}"; - __2_NIX_BINS_DERIVATION="${__AF_env_var_get91_v0__48_33}" - env_var_get__91_v0 "EXTRA_FEATURES"; - __AS=$?; - __AF_env_var_get91_v0__50_41="${__AF_env_var_get91_v0}"; - __3_EXTRA_FEATURES="${__AF_env_var_get91_v0__50_41}" - env_var_get__91_v0 "EXTRA_SUBSTITUTERS"; - __AS=$?; - __AF_env_var_get91_v0__51_41="${__AF_env_var_get91_v0}"; - __4_EXTRA_SUBSTITUTERS="${__AF_env_var_get91_v0__51_41}" - env_var_get__91_v0 "EXTRA_TRUSTED_PUBLIC_KEYS"; - __AS=$?; - __AF_env_var_get91_v0__52_41="${__AF_env_var_get91_v0}"; - __5_EXTRA_TRUSTED_PUBLIC_KEYS="${__AF_env_var_get91_v0__52_41}" - env_var_get__91_v0 "NIXIE_VERSION"; - __AS=$?; - __AF_env_var_get91_v0__54_27="${__AF_env_var_get91_v0}"; - __6_NIXIE_VERSION="${__AF_env_var_get91_v0__54_27}" -} -declare -r cmdl=("$0" "$@") - __7_args=("${cmdl[@]}") - load_features__395_v0 ; - __AF_load_features395_v0__62_5="$__AF_load_features395_v0"; - echo "$__AF_load_features395_v0__62_5" > /dev/null 2>&1 - catch_args__182_v0 __7_args; - __AF_catch_args182_v0__63_5="$__AF_catch_args182_v0"; - echo "$__AF_catch_args182_v0__63_5" > /dev/null 2>&1 - array_shift__120_v0 __7_args; - __AF_array_shift120_v0__65_16="${__AF_array_shift120_v0}"; - self="${__AF_array_shift120_v0__65_16}" - file_exists__33_v0 "/etc/pki/tls/certs/ca-bundle.crt"; - __AF_file_exists33_v0__69_5="$__AF_file_exists33_v0"; - get_osname__154_v0 ; - __AF_get_osname154_v0__71_5="${__AF_get_osname154_v0}"; - if [ "$__AF_file_exists33_v0__69_5" != 0 ]; then - env_var_set__90_v0 "NIX_SSL_CERT_FILE" "/etc/pki/tls/certs/ca-bundle.crt"; - __AS=$?; - __AF_env_var_set90_v0__70_15="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__70_15" > /dev/null 2>&1 -elif [ $([ "_${__AF_get_osname154_v0__71_5}" != "_Darwin" ]; echo $?) != 0 ]; then - env_var_set__90_v0 "NIX_SSL_CERT_FILE" "/etc/ssl/cert.pem"; - __AS=$?; - __AF_env_var_set90_v0__72_15="$__AF_env_var_set90_v0"; - echo "$__AF_env_var_set90_v0__72_15" > /dev/null 2>&1 fi - launch_nix__393_v0 "${self}" __7_args[@]; - __AF_launch_nix393_v0__75_5="$__AF_launch_nix393_v0"; - echo "$__AF_launch_nix393_v0__75_5" > /dev/null 2>&1 +load_features__490_v0() { + untar__184_v0 "features" 1 + __status=$? + if [ "${__status}" != 0 ]; then + bail__181_v0 "The resource archive is missing or malformed." 1 + fi + local envfile_123="${ret_untar184_v0}" + eval ${envfile_123} + __status=$? + if [ "${__status}" != 0 ]; then + bail__181_v0 "The environment file in the resource archive is malformed." 1 + fi + env_var_get__122_v0 "SOURCE_CACHE" + __status=$? + env_var_get__122_v0 "SOURCE_DERIVATION" + __status=$? + env_var_get__122_v0 "NIX_BINS_DERIVATION" + __status=$? + env_var_get__122_v0 "EXTRA_FEATURES" + __status=$? + env_var_get__122_v0 "EXTRA_SUBSTITUTERS" + __status=$? + env_var_get__122_v0 "EXTRA_TRUSTED_PUBLIC_KEYS" + __status=$? + env_var_get__122_v0 "NIXIE_VERSION" + __status=$? +} + +declare -r cmdl_68=("$0" "$@") +args_7=("${cmdl_68[@]}") +load_features__490_v0 +catch_args__223_v0 "args_7" +array_shift__78_v0 "args_7" +__status=$? +self_282="${ret_array_shift78_v0}" +file_exists__42_v0 "/etc/pki/tls/certs/ca-bundle.crt" +ret_file_exists42_v0__69_5="${ret_file_exists42_v0}" +get_osname__195_v0 +ret_get_osname195_v0__71_5="${ret_get_osname195_v0}" +if [ "${ret_file_exists42_v0__69_5}" != 0 ]; then + env_var_set__121_v0 "NIX_SSL_CERT_FILE" "/etc/pki/tls/certs/ca-bundle.crt" + __status=$? +elif [ "$([ "_${ret_get_osname195_v0__71_5}" != "_Darwin" ]; echo $?)" != 0 ]; then + env_var_set__121_v0 "NIX_SSL_CERT_FILE" "/etc/ssl/cert.pem" + __status=$? +fi +launch_nix__488_v0 "${self_282}" args_7[@] exit 0 cat <q!,\NIm`0vEFpтM}4=N{gZOźT~ivpt NQ͓Dܵ'jqߥޤǗ~2G]d]:mm3s6{4xW/v}סc9ϴ]Z0E/}yDe l)CTur٩coZ7(Hwfll}W%!yު ͝!FEk\%x@ԾP; -_ ˡ([?1049l # (tarball data) \ No newline at end of file +Nin@` {} }: -let - builder = pkgs.callPackage ./. {}; -in pkgs.mkShell { - name = "nixie"; - - nativeBuildInputs = - [ builder - ]; -} diff --git a/src/AMBER_HEADER b/src/AMBER_HEADER new file mode 100644 index 0000000..679b89f --- /dev/null +++ b/src/AMBER_HEADER @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# Nix wrapper script, generated by Nixie (https://github.com/nixie-dev/nixie) +# Nixie (c) Karim Vergnes +# Built using Amber {{ version }} (https://amber-lang.com) diff --git a/src/builders.ab b/src/builders.ab index 425deee..44c64b3 100644 --- a/src/builders.ab +++ b/src/builders.ab @@ -62,8 +62,8 @@ pub fun try_build_nix() trust env_var_set("step_total", "9") - dir_create(get_source_root()) - dir_create("{cache_root}/nix-deps/lib/pkgconfig") + trust dir_create(get_source_root()) + trust dir_create("{cache_root}/nix-deps/lib/pkgconfig") build_openssl()? build_boost()? diff --git a/src/cli.ab b/src/cli.ab index a66bbd3..25d51a7 100644 --- a/src/cli.ab +++ b/src/cli.ab @@ -35,7 +35,7 @@ fun cmd_print_config() fun cmd_extract() { - dir_create("nixie") + trust dir_create("nixie") cd "nixie" trust untar("") exit 0 diff --git a/src/common.ab b/src/common.ab index 2a9f7f4..68e0573 100644 --- a/src/common.ab +++ b/src/common.ab @@ -3,7 +3,7 @@ // Common utility functions import { echo_error, env_var_get, is_command } from "std/env" -import { starts_with, text_contains, parse_number } from "std/text" +import { starts_with, text_contains, parse_int } from "std/text" import { exit_alt_buffer, set_title } from "./term.ab" @@ -34,10 +34,10 @@ if text_contains(me, "/") { /// False otherwise. pub fun exists_newer(left: Text, right: Text): Bool { - let left_time = parse_number(trust $stat -c %W {left}$) failed { + let left_time = parse_int(trust $stat -c %W {left}$) failed { return false // Untrustworthy stat, assume worst } - let right_time = parse_number(trust $stat -c %W {right}$) failed { + let right_time = parse_int(trust $stat -c %W {right}$) failed { return false } diff --git a/src/main.ab b/src/main.ab index 9956eb2..7fbb79f 100644 --- a/src/main.ab +++ b/src/main.ab @@ -62,7 +62,7 @@ main(cmdl) load_features() catch_args(args) - let self = array_shift(args) + let self = trust array_shift(args) // Check for alternate OpenSSL/LibreSSL certificate paths (fixes #6) if { diff --git a/src/nix.ab b/src/nix.ab index aa566aa..8e79801 100644 --- a/src/nix.ab +++ b/src/nix.ab @@ -56,7 +56,7 @@ fun get_nix() // Unpack fakedir as needed if osname == "Darwin" and not file_exists(fakedir_path) { - dir_create("{cache_root}/nix-deps/lib") + trust dir_create("{cache_root}/nix-deps/lib") pull_binary("libfakedir.dylib", fakedir_path) failed { teardown(true) fail 1 @@ -130,7 +130,7 @@ fun unpack_channels() } echo "Unpacking Nix channels, hang tight..." - dir_create("{repo_root}/.nixie") + trust dir_create("{repo_root}/.nixie") untar("channels -C {repo_root}/.nixie") failed { // Leave an empty directory to trip the time check above trust $mkdir {repo_root}/.nixie/channels$ @@ -188,7 +188,7 @@ fun launch_darwin_workaround(name: Text, nix_path: Text, args: [Text]): Null trust $ _NIX_TEST_NO_SANDBOX=1 \ DYLD_INSERT_LIBRARIES="{fakedir_path}" \ DYLD_LIBRARY_PATH="{cache_root}/nix-deps/lib" \ - exec -a {name} {nix_path} "{args}"$ + exec -a {name} "{nix_path}" "{args}"$ } /// Launch the command referred to by name from within a Nix shell. @@ -247,7 +247,7 @@ fun launch_nix_shebang(nix_path: Text, file: Text, extras: [Text], args: [Text]) if not starts_with(shebang, "#!"): return null let bang_args = split(slice(shebang, 2), " ") - let name = array_shift(bang_args) + let name = trust array_shift(bang_args) // Find and inject script options into --command for i, arg in bang_args { @@ -275,7 +275,7 @@ pub fun launch_nix(self: Text, args: [Text]): Null let nix_path = "{cache_root}/nix-static" let extras = populate_extras() - let name = array_last(split(self, "/")) + let name = trust array_last(split(self, "/")) if starts_with(name, "nix-"): trust unpack_channels() @@ -293,7 +293,7 @@ pub fun launch_nix(self: Text, args: [Text]): Null if file_exists(args[0]) and not ends_with(args[0], ".nix") { let args_shebang = args - array_shift(args_shebang) + trust array_shift(args_shebang) launch_nix_shebang(nix_path, args[0], extras, args_shebang) } diff --git a/src/platform.ab b/src/platform.ab index 82a028e..0f2f1f4 100644 --- a/src/platform.ab +++ b/src/platform.ab @@ -75,7 +75,7 @@ pub fun get_cache_root(): Text pub fun get_repo_root(): Text { let self_a = split(get_self(), "/") - array_pop(self_a) + trust array_pop(self_a) let self_dir = "/" + join(self_a, "/") diff --git a/src/resources.ab b/src/resources.ab index 65cc3b1..c5fba91 100644 --- a/src/resources.ab +++ b/src/resources.ab @@ -55,8 +55,7 @@ pub fun pull_source_file(member: Text, dest: Text): Null? let tmpf = trust $mktemp -t nixie_src_XXXXXXXX.tgz$ let tmpd = trust $mktemp -t -d nixie_{member}_XXXXXXXX$ - if not file_download(cachix_url(SOURCE_DERIVATION, "{member}.tar.gz"), tmpf): - fail 1 + file_download(cachix_url(SOURCE_DERIVATION, "{member}.tar.gz"), tmpf)? $gzip -d -c {tmpf} | tar -x -C {tmpd}$? @@ -87,9 +86,7 @@ pub fun pull_binary(member: Text, dest: Text): Null? if status != 0 { let tmpf = trust $mktemp -t nixie_{member}_XXXXXXXX$ - if not file_download(cachix_url(NIX_BINS_DERIVATION, member), tmpf) { - fail 1 - } + file_download(cachix_url(NIX_BINS_DERIVATION, member), tmpf)? where = tmpf }