From 88cad011dd085afae0361fae3a147a87cff3a414 Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Wed, 4 Mar 2026 21:26:47 +0100 Subject: [PATCH 1/8] Test platform for Linux+macOS --- flake.lock | 37 ++++++++++++++++++++++- flake.nix | 28 ++++++++++-------- src/builders/openssl.ab | 26 ++++++++-------- tests/darwin/generation.nix | 15 ++++++++++ tests/default.nix | 30 +++++++++++++++++++ tests/linux/building.nix | 27 +++++++++++++++++ tests/{ => linux}/generation.nix | 2 +- tests/{ => linux}/migration.nix | 2 +- tests/{ => linux}/rootless.nix | 2 +- tests/makeDarwinTest.nix | 51 ++++++++++++++++++++++++++++++++ 10 files changed, 190 insertions(+), 30 deletions(-) create mode 100644 tests/darwin/generation.nix create mode 100644 tests/default.nix create mode 100644 tests/linux/building.nix rename tests/{ => linux}/generation.nix (92%) rename tests/{ => linux}/migration.nix (95%) rename tests/{ => linux}/rootless.nix (90%) create mode 100644 tests/makeDarwinTest.nix diff --git a/flake.lock b/flake.lock index 23ee4e8..93f637f 100644 --- a/flake.lock +++ b/flake.lock @@ -175,6 +175,24 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1772379624, + "narHash": "sha256-NG9LLTWlz4YiaTAiRGChbrzbVxBfX+Auq4Ab/SWmk4A=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "52d061516108769656a8bd9c6e811c677ec5b462", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1741037377, @@ -240,6 +258,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1765934234, + "narHash": "sha256-pJjWUzNnjbIAMIc5gRFUuKCDQ9S1cuh3b2hKgA7Mc4A=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "af84f9d270d404c17699522fab95bbf928a2d92f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1771520265, "narHash": "sha256-ZVfCQHlXPP6ju9u9UQ4RrmVCif3wJvo5Scm5RhtGEZw=", @@ -260,7 +294,8 @@ "fakedir": "fakedir", "flake-utils": "flake-utils", "nix": "nix", - "nixpkgs": "nixpkgs_3" + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs_4" } }, "rust-overlay": { diff --git a/flake.nix b/flake.nix index d8bc1d3..499c30f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,18 +1,23 @@ { description = "Put Nix in everything!"; - inputs.nixpkgs.url = github:nixos/nixpkgs; - inputs.amber.url = github:amber-lang/amber; - inputs.nix.url = github:nixos/nix/2.26.2; - inputs.fakedir = - { url = github:nixie-dev/fakedir; + inputs = { + nixpkgs.url = github:nixos/nixpkgs; + amber.url = github:amber-lang/amber; + nix.url = github:nixos/nix/2.26.2; + fakedir = { + url = github:nixie-dev/fakedir; inputs.nixpkgs.follows = "nixpkgs"; inputs.utils.follows = "flake-utils"; }; + # Only required for macOS unit tests + nix-darwin.url = github:nix-darwin/nix-darwin; + }; + nixConfig.extra-substituters = "https://nix-wrap.cachix.org"; nixConfig.extra-trusted-public-keys = "nix-wrap.cachix.org-1:FcfSb7e+LmXBZE/MdaFWcs4bW2OQQeBnB/kgWlkZmYI="; - outputs = { self, nix, nixpkgs, flake-utils, fakedir, amber, ... }: + outputs = { self, nix, nixpkgs, nix-darwin, flake-utils, fakedir, amber, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; @@ -35,13 +40,10 @@ libfakedir = fakedir.packages.${system}.fakedir; } else {}); - checks = - let callTest = f: pkgs.callPackage f { inherit (self.packages.${system}) nixie sources static-bins; }; - in { - generation = callTest ./tests/generation.nix; - rootless = callTest ./tests/rootless.nix; - migration = callTest ./tests/migration.nix; - }; + checks = import ./tests { + inherit nixpkgs system nix-darwin; + inherit (self.outputs.packages.${system}) nixie sources static-bins; + }; devShells = { default = pkgs.mkShell { diff --git a/src/builders/openssl.ab b/src/builders/openssl.ab index 409fd7e..1a2404b 100644 --- a/src/builders/openssl.ab +++ b/src/builders/openssl.ab @@ -5,22 +5,11 @@ import { env_var_test, env_var_set } from "std/env" import { split_lines } from "std/text" -import { pull_source_file } from "../resources.ab" import { get_dll_ext, get_cache_root } from "../platform.ab" +import { pull_source_file } from "../resources.ab" import { pkg_exists, step_title, get_source_root } from "./common.ab" -/// Scans through and builds generated headers required for building OpenSSL. -/// -/// For some reason the OpenSSL Makefile does not specify dependencies to those -/// targets, meaning we cannot simply `make libcrypto.so`. -fun make_headers() -{ - for header in split_lines(trust $grep ".*\\.h:" ./Makefile | cut -f 1 -d :$) { - $make {header}$? - } -} - /// This function runs within the source directory, in a subshell. fun build_openssl_inner() { @@ -30,7 +19,15 @@ fun build_openssl_inner() trust $chmod +x ./config$ $./config$? - make_headers()? + + // For some reason the OpenSSL Makefile does not specify dependencies to those + // targets, meaning we cannot simply `make libcrypto.so`. + for header in split_lines(trust $grep ".*\\.h:" ./Makefile | cut -f 1 -d :$) { + $make {header}$? + } + for hinc in split_lines(trust $grep ".*\\.inc:" ./Makefile | cut -f 1 -d :$) { + $make {hinc}$? + } $make libcrypto.{dll_ext} libcrypto.pc$? // Building libssl is: @@ -50,6 +47,9 @@ pub fun build_openssl() { let source_root = get_source_root() let cache_root = get_cache_root() + // Workaround for amber-lang/amber#1043 + let dll_ext = get_dll_ext() + let _ = split_lines("hello") step_title("libcrypto") diff --git a/tests/darwin/generation.nix b/tests/darwin/generation.nix new file mode 100644 index 0000000..a430352 --- /dev/null +++ b/tests/darwin/generation.nix @@ -0,0 +1,15 @@ +{ config, pkgs, nixie, sources, static-bins ... }: + +{ + environment.systemPackages = with pkgs; [ + nixie + git + ]; + + test = '' + git init + nixie init --sources-derivation ${sources} --binaries-derivation ${static-bins} --with-binaries + ./nix --nixie-extract + ls nixie | grep nix.Darwin.x86_64 + ''; +} diff --git a/tests/default.nix b/tests/default.nix new file mode 100644 index 0000000..223737e --- /dev/null +++ b/tests/default.nix @@ -0,0 +1,30 @@ +{ nixpkgs, nixie, sources, static-bins +, system ? builtins.currentSystem, nix-darwin ? {}, ... }@as: + +let + pkgs = import nixpkgs { inherit system; }; + + makeDarwinTest = import ./makeDarwinTest.nix as; + makeLinuxTest = f: pkgs.callPackage f as; + + makeTest = t: + if pkgs.stdenv.isLinux then makeLinuxTest ./linux/${t}.nix + else if pkgs.stdenv.isDarwin then makeDarwinTest ./darwin/${t}.nix + else throw "Unsupported platform: ${pkgs.stdenv.platform}"; +in { + + # Tests available on both platforms + building = makeTest "building"; + generation = makeTest "generation"; + migration = makeTest "migration"; + rootless = makeTest "rootless"; + +} // (if pkgs.stdenv.isLinux then { + + # Linux-specific tests go here + +} else if pkgs.stdenv.isDarwin then { + + # macOS-specific tests go here + +} else {}) diff --git a/tests/linux/building.nix b/tests/linux/building.nix new file mode 100644 index 0000000..1b2fc8e --- /dev/null +++ b/tests/linux/building.nix @@ -0,0 +1,27 @@ +{ pkgs, nixie, sources, static-bins, ... }: +pkgs.testers.nixosTest { + name = "nixie-builds-nix-from-source"; + nodes = { + machine = { + environment.systemPackages = with pkgs; [ + nixie + git + + gcc + pkg-config + gnumake + flex + bison + perl + ]; + }; + }; + + testScript = '' + start_all() + + machine.succeed("git init") + machine.succeed("nixie init --sources-derivation ${sources} --binaries-derivation ${static-bins} --with-sources") + machine.succeed("./nix --nixie-no-precompiled --version") + ''; +} diff --git a/tests/generation.nix b/tests/linux/generation.nix similarity index 92% rename from tests/generation.nix rename to tests/linux/generation.nix index 834cd81..1a1b5d0 100644 --- a/tests/generation.nix +++ b/tests/linux/generation.nix @@ -1,4 +1,4 @@ -{ pkgs, nixie, sources, static-bins }: +{ pkgs, nixie, sources, static-bins, ... }: pkgs.testers.nixosTest { name = "nixie-generates-offline-script"; nodes = { diff --git a/tests/migration.nix b/tests/linux/migration.nix similarity index 95% rename from tests/migration.nix rename to tests/linux/migration.nix index f19b678..7096d63 100644 --- a/tests/migration.nix +++ b/tests/linux/migration.nix @@ -1,4 +1,4 @@ -{ pkgs, nixie, sources, static-bins }: +{ pkgs, nixie, sources, static-bins, ... }: pkgs.testers.nixosTest { name = "nixie-migrates-rootless-paths"; nodes = { diff --git a/tests/rootless.nix b/tests/linux/rootless.nix similarity index 90% rename from tests/rootless.nix rename to tests/linux/rootless.nix index 76b8b82..c02dcf5 100644 --- a/tests/rootless.nix +++ b/tests/linux/rootless.nix @@ -1,4 +1,4 @@ -{ pkgs, nixie, sources, static-bins }: +{ pkgs, nixie, sources, static-bins, ... }: pkgs.testers.nixosTest { name = "nixie-runs-rootless"; nodes = { diff --git a/tests/makeDarwinTest.nix b/tests/makeDarwinTest.nix new file mode 100644 index 0000000..63c481c --- /dev/null +++ b/tests/makeDarwinTest.nix @@ -0,0 +1,51 @@ +{ nixpkgs, nixie, sources, static-bins +, system ? builtins.currentSystem, nix-darwin ? {}, ... }@as: + +let + buildFromConfig = configuration: sel: sel + (import ./. { inherit nixpkgs configuration system; }).config; +in + +test: + let + testName = + builtins.replaceStrings [ ".nix" ] [ "" ] + (builtins.baseNameOf test); + + configuration = + { config, lib, pkgs, ... }: + with lib; + { + imports = [ test ]; + + options = { + out = mkOption { + type = types.package; + }; + + test = mkOption { + type = types.lines; + }; + }; + + config = { + system.stateVersion = lib.mkDefault config.system.maxStateVersion; + + system.build.run-test = pkgs.runCommand "darwin-test-${testName}" + { allowSubstitutes = false; preferLocalBuild = true; } + '' + #! ${pkgs.stdenv.shell} + set -e + + echo >&2 "running tests for system ${config.out}" + echo >&2 + ${config.test} + echo >&2 ok + touch $out + ''; + + out = config.system.build.toplevel; + }; + }; + in + buildFromConfig configuration (config: config.system.build.run-test) From 1b956c2d7412c4b78bfce52a1c1ad2ee87b4b2b6 Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Wed, 27 May 2026 14:28:46 +0200 Subject: [PATCH 2/8] Migrated tests to Behave --- .gitignore | 1 - tests/darwin/generation.nix | 15 ------- tests/default.nix | 31 +++++++++----- tests/features/building.feature | 7 ++++ tests/features/environment.py | 7 ++++ tests/features/generation.feature | 29 +++++++++++++ tests/features/migration.feature | 8 ++++ tests/features/rootless.feature | 6 +++ tests/features/steps/common.py | 26 ++++++++++++ tests/features/steps/generation.py | 13 ++++++ tests/features/steps/launch.py | 14 +++++++ tests/linux/building.nix | 27 ------------- tests/linux/generation.nix | 22 ---------- tests/linux/migration.nix | 31 -------------- tests/linux/rootless.nix | 20 --------- tests/makeDarwinTest.nix | 51 ----------------------- tests/template-darwin.nix | 65 ++++++++++++++++++++++++++++++ tests/template-linux.nix | 28 +++++++++++++ 18 files changed, 225 insertions(+), 176 deletions(-) delete mode 100644 tests/darwin/generation.nix create mode 100644 tests/features/building.feature create mode 100644 tests/features/environment.py create mode 100644 tests/features/generation.feature create mode 100644 tests/features/migration.feature create mode 100644 tests/features/rootless.feature create mode 100644 tests/features/steps/common.py create mode 100644 tests/features/steps/generation.py create mode 100644 tests/features/steps/launch.py delete mode 100644 tests/linux/building.nix delete mode 100644 tests/linux/generation.nix delete mode 100644 tests/linux/migration.nix delete mode 100644 tests/linux/rootless.nix delete mode 100644 tests/makeDarwinTest.nix create mode 100644 tests/template-darwin.nix create mode 100644 tests/template-linux.nix diff --git a/.gitignore b/.gitignore index dfe7d36..91a9ecf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -features *.tgz *.tar.gz .nixie diff --git a/tests/darwin/generation.nix b/tests/darwin/generation.nix deleted file mode 100644 index a430352..0000000 --- a/tests/darwin/generation.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, pkgs, nixie, sources, static-bins ... }: - -{ - environment.systemPackages = with pkgs; [ - nixie - git - ]; - - test = '' - git init - nixie init --sources-derivation ${sources} --binaries-derivation ${static-bins} --with-binaries - ./nix --nixie-extract - ls nixie | grep nix.Darwin.x86_64 - ''; -} diff --git a/tests/default.nix b/tests/default.nix index 223737e..152e787 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -4,20 +4,33 @@ let pkgs = import nixpkgs { inherit system; }; - makeDarwinTest = import ./makeDarwinTest.nix as; - makeLinuxTest = f: pkgs.callPackage f as; + makeDarwinTest = featureName: configuration: import ./template-darwin.nix { inherit pkgs configuration featureName sources static-bins; }; + makeLinuxTest = featureName: configuration: import ./template-linux.nix { inherit pkgs configuration featureName sources static-bins; }; - makeTest = t: - if pkgs.stdenv.isLinux then makeLinuxTest ./linux/${t}.nix - else if pkgs.stdenv.isDarwin then makeDarwinTest ./darwin/${t}.nix + makeTest = + if pkgs.stdenv.isLinux then makeLinuxTest + else if pkgs.stdenv.isDarwin then makeDarwinTest else throw "Unsupported platform: ${pkgs.stdenv.platform}"; + + defaultConfig = { + environment.systemPackages = with pkgs; [ + nixie git + ]; + }; in { # Tests available on both platforms - building = makeTest "building"; - generation = makeTest "generation"; - migration = makeTest "migration"; - rootless = makeTest "rootless"; + building = makeTest "building" { + environment.systemPackages = with pkgs; [ + nixie git + gcc pkg-config gnumake flex bison perl + ]; + }; + generation = makeTest "generation" defaultConfig; + migration = makeTest "migration" (defaultConfig // { + virtualisation.writableStore = true; + }); + rootless = makeTest "rootless" defaultConfig; } // (if pkgs.stdenv.isLinux then { diff --git a/tests/features/building.feature b/tests/features/building.feature new file mode 100644 index 0000000..5245303 --- /dev/null +++ b/tests/features/building.feature @@ -0,0 +1,7 @@ +Feature: Nixie can build Nix from source code + + Scenario: From source + Given a Git repository + When the Nix wrapper is generated with offline sources + Then the Nix wrapper builds Nix from source + And the Nix wrapper launches Nix without root diff --git a/tests/features/environment.py b/tests/features/environment.py new file mode 100644 index 0000000..b3069a6 --- /dev/null +++ b/tests/features/environment.py @@ -0,0 +1,7 @@ +from types import SimpleNamespace +from behave import fixture, use_fixture + +def before_all(context): + ''' Populate the context with NixOS test objects + ''' + context.nixos = SimpleNamespace(context.config.userdata) diff --git a/tests/features/generation.feature b/tests/features/generation.feature new file mode 100644 index 0000000..320d319 --- /dev/null +++ b/tests/features/generation.feature @@ -0,0 +1,29 @@ +Feature: Nixie can generate a Nix script with offline resources + + Scenario: Offline binaries + Given a Git repository + When the Nix wrapper is generated with offline binaries + And the Nix wrapper is extracted + Then the Nix wrapper should contain these files + | filename | + | nix.Linux.x86_64 | + | nix.Darwin.x86_64 | + | nix.Linux.aarch64 | + | nix.Darwin.aarch64 | + | libfakedir.dylib | + + Scenario: Offline sources + Given a Git repository + When the Nix wrapper is generated with offline sources + And the Nix wrapper is extracted + Then the Nix wrapper should contain these files + | filename | + | libbrotlicommon | + | libsodium | + | libeditline | + | libarchive | + | boost | + | lowdown | + | nix | + | nlohmann_json | + | openssl | diff --git a/tests/features/migration.feature b/tests/features/migration.feature new file mode 100644 index 0000000..ebabf6d --- /dev/null +++ b/tests/features/migration.feature @@ -0,0 +1,8 @@ +Feature: Nixie migrates paths from the rootless Nix store to the system Nix store + + Scenario: Migrate a file + Given a Git repository + And a Nix wrapper generated with offline binaries + When a file is added to the rootless Nix store + And the Nix wrapper is launched with system Nix + Then the file should be in the system Nix store diff --git a/tests/features/rootless.feature b/tests/features/rootless.feature new file mode 100644 index 0000000..9e77fb5 --- /dev/null +++ b/tests/features/rootless.feature @@ -0,0 +1,6 @@ +Feature: Nixie can launch Nix without root privileges + + Scenario: Rootless + Given a Git repository + When the Nix wrapper is generated with offline binaries + Then the Nix wrapper launches Nix without root diff --git a/tests/features/steps/common.py b/tests/features/steps/common.py new file mode 100644 index 0000000..34ce03e --- /dev/null +++ b/tests/features/steps/common.py @@ -0,0 +1,26 @@ +from behave import given, when, then +from types import SimpleNamespace + +@given("a Git repository") +def init_git(context): + context.nixos.succeed("git init") + +@given("a Nix wrapper generated with offline {offline}") +@when("the Nix wrapper is generated with offline {offline}") +def gen_offline(context, offline): + cmdline = f"nixie init --sources-derivation {context.nixos.sources} --binaries-derivation {context.nixos.static_bins}" + if "binaries" in offline: + cmdline += " --with-binaries" + if "sources" in offline: + cmdline += " --with-sources" + context.nixos.succeed(cmdline) + +@when("a file is added to the rootless Nix store") +def add_store(context): + context.nixos.succeed("echo -n 'Nixie test file' > my-file") + context.storepath = context.nixos.succeed("./nix --nixie-ignore-system store add-file my-file") + +@then("the file should be in the system Nix store") +def check_store(context): + out = context.nixos.succeed(f"cat {context.storepath}") + assert "Nixie test file" == out diff --git a/tests/features/steps/generation.py b/tests/features/steps/generation.py new file mode 100644 index 0000000..97e6450 --- /dev/null +++ b/tests/features/steps/generation.py @@ -0,0 +1,13 @@ +from behave import given, when, then +from types import SimpleNamespace + +@when("the Nix wrapper is extracted") +def nixie_extract(context): + context.nixos.succeed("./nix --nixie-extract") + +@then("the Nix wrapper should contain these files") +def check_extracted(context): + filelist = context.nixos.succeed("ls nixie").split('\n') + for row in context.table.rows: + if row.cells[0] not in filelist: + raise AssertionError(f"Missing entry: {row.cells[0]}") diff --git a/tests/features/steps/launch.py b/tests/features/steps/launch.py new file mode 100644 index 0000000..c0f08bb --- /dev/null +++ b/tests/features/steps/launch.py @@ -0,0 +1,14 @@ +from behave import given, when, then +from types import SimpleNamespace + +@when("the Nix wrapper is launched with system Nix") +def system_nix(context): + context.nixos.succeed("./nix --version") + +@then("the Nix wrapper launches Nix without root") +def check_nix(context): + context.nixos.succeed("./nix --nixie-ignore-system --version") + +@then("the Nix wrapper builds Nix from source") +def build_nix(context): + context.nixos.succeed("./nix --nixie-no-precompiled --version") diff --git a/tests/linux/building.nix b/tests/linux/building.nix deleted file mode 100644 index 1b2fc8e..0000000 --- a/tests/linux/building.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ pkgs, nixie, sources, static-bins, ... }: -pkgs.testers.nixosTest { - name = "nixie-builds-nix-from-source"; - nodes = { - machine = { - environment.systemPackages = with pkgs; [ - nixie - git - - gcc - pkg-config - gnumake - flex - bison - perl - ]; - }; - }; - - testScript = '' - start_all() - - machine.succeed("git init") - machine.succeed("nixie init --sources-derivation ${sources} --binaries-derivation ${static-bins} --with-sources") - machine.succeed("./nix --nixie-no-precompiled --version") - ''; -} diff --git a/tests/linux/generation.nix b/tests/linux/generation.nix deleted file mode 100644 index 1a1b5d0..0000000 --- a/tests/linux/generation.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs, nixie, sources, static-bins, ... }: -pkgs.testers.nixosTest { - name = "nixie-generates-offline-script"; - nodes = { - machine = { - environment.systemPackages = with pkgs; [ - nixie - git - ]; - }; - }; - - testScript = '' - start_all() - - machine.succeed("git init") - machine.succeed("nixie init --sources-derivation ${sources} --binaries-derivation ${static-bins} --with-binaries") - machine.wait_until_succeeds("./nix --nixie-extract") - fs = machine.wait_until_succeeds("ls nixie") - assert "nix.Linux.x86_64" in fs - ''; -} diff --git a/tests/linux/migration.nix b/tests/linux/migration.nix deleted file mode 100644 index 7096d63..0000000 --- a/tests/linux/migration.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ pkgs, nixie, sources, static-bins, ... }: -pkgs.testers.nixosTest { - name = "nixie-migrates-rootless-paths"; - nodes = { - machine = { - environment.systemPackages = with pkgs; [ - nixie - git - ]; - - virtualisation.writableStore = true; - }; - }; - - testScript = '' - start_all() - - machine.succeed("git init") - machine.wait_until_succeeds("nixie init --sources-derivation ${sources} --binaries-derivation ${static-bins} --with-binaries") - machine.wait_until_succeeds("echo -n 'Nixie test file' > /my-file") - - f = machine.wait_until_succeeds("./nix --nixie-ignore-system store add-file /my-file") - machine.fail(f"cat {f}") - - # Running without ignore-system should cause rootless-created paths to be - # copied over to the system store. - machine.wait_until_succeeds("./nix --version") - out = machine.succeed(f"cat {f}") - assert "Nixie test file" == out, f"expected 'Nixie test file', got '{out}'" - ''; -} diff --git a/tests/linux/rootless.nix b/tests/linux/rootless.nix deleted file mode 100644 index c02dcf5..0000000 --- a/tests/linux/rootless.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ pkgs, nixie, sources, static-bins, ... }: -pkgs.testers.nixosTest { - name = "nixie-runs-rootless"; - nodes = { - machine = { - environment.systemPackages = with pkgs; [ - nixie - git - ]; - }; - }; - - testScript = '' - start_all() - - machine.succeed("git init") - machine.succeed("nixie init --sources-derivation ${sources} --binaries-derivation ${static-bins} --with-binaries") - machine.succeed("./nix --nixie-ignore-system --version") - ''; -} diff --git a/tests/makeDarwinTest.nix b/tests/makeDarwinTest.nix deleted file mode 100644 index 63c481c..0000000 --- a/tests/makeDarwinTest.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ nixpkgs, nixie, sources, static-bins -, system ? builtins.currentSystem, nix-darwin ? {}, ... }@as: - -let - buildFromConfig = configuration: sel: sel - (import ./. { inherit nixpkgs configuration system; }).config; -in - -test: - let - testName = - builtins.replaceStrings [ ".nix" ] [ "" ] - (builtins.baseNameOf test); - - configuration = - { config, lib, pkgs, ... }: - with lib; - { - imports = [ test ]; - - options = { - out = mkOption { - type = types.package; - }; - - test = mkOption { - type = types.lines; - }; - }; - - config = { - system.stateVersion = lib.mkDefault config.system.maxStateVersion; - - system.build.run-test = pkgs.runCommand "darwin-test-${testName}" - { allowSubstitutes = false; preferLocalBuild = true; } - '' - #! ${pkgs.stdenv.shell} - set -e - - echo >&2 "running tests for system ${config.out}" - echo >&2 - ${config.test} - echo >&2 ok - touch $out - ''; - - out = config.system.build.toplevel; - }; - }; - in - buildFromConfig configuration (config: config.system.build.run-test) diff --git a/tests/template-darwin.nix b/tests/template-darwin.nix new file mode 100644 index 0000000..ee927cb --- /dev/null +++ b/tests/template-darwin.nix @@ -0,0 +1,65 @@ +{ nixpkgs, configuration, nix-darwin, system, sources, static-bins +, featurePath ? ./features +, featureName +, ... }@opts: + +let + buildFromConfig = configuration: sel: sel + (import nix-darwin { inherit nixpkgs configuration system; }).config; + + configuration = + { config, lib, pkgs, ... }: + with lib; + { + imports = [ opts.configuration ]; + + options = { + out = mkOption { + type = types.package; + }; + }; + + stdenv.systemPackages = [ + pkgs.python3.withPackages (ps: with ps; [ behave ]) + ]; + + config = { + system.stateVersion = lib.mkDefault config.system.maxStateVersion; + + system.build.run-test = pkgs.runCommand "darwin-test-${testName}" + { allowSubstitutes = false; preferLocalBuild = true; } + '' + #! ${pkgs.stdenv.shell} + set -e + + echo >&2 "running tests for system ${config.out}" + echo >&2 + python3 <&2 ok + touch $out + ''; + + out = config.system.build.toplevel; + }; + }; +in + buildFromConfig configuration (config: config.system.build.run-test) diff --git a/tests/template-linux.nix b/tests/template-linux.nix new file mode 100644 index 0000000..720b3ca --- /dev/null +++ b/tests/template-linux.nix @@ -0,0 +1,28 @@ +{ pkgs, configuration, sources, static-bins +, featurePath ? ./features +, featureName +, ... }@opts: + +pkgs.testers.nixosTest { + name = featureName; + nodes = { machine = configuration; }; + + extraPythonPackages = p: with p; [ behave ]; + + skipTypeCheck = true; + + testScript = '' + from behave.configuration import Configuration + from behave.__main__ import run_behave + + def succeed(cmd): + return machine.succeed(cmd) + + def fail(cmd): + return machine.fail(cmd) + + conf = Configuration("${featurePath}/${featureName}.feature", userdata = { "succeed": succeed, "fail": fail, "sources": "${sources}", "static_bins": "${static-bins}" }) + start_all() + exit(run_behave(conf)) + ''; +} From b262e1e4512b02996ca13b8e0915c4efaf2949b6 Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Thu, 4 Jun 2026 15:03:58 +0200 Subject: [PATCH 3/8] Upgrade to Amber 0.6.0 --- flake.lock | 6 ++--- src/builders.ab | 6 ++--- src/builders/autoconf.ab | 1 - src/builders/boost.ab | 1 - src/builders/common.ab | 7 +++-- src/builders/lowdown.ab | 1 - src/builders/nix.ab | 3 +-- src/builders/nlohmann_json.ab | 1 - src/builders/openssl.ab | 4 --- src/cli.ab | 5 ++-- src/features.ab | 44 ++++++++++++++++++++++++++++++ src/main.ab | 51 ++++++----------------------------- src/nix.ab | 8 +++--- src/resources.ab | 7 +---- 14 files changed, 70 insertions(+), 75 deletions(-) create mode 100644 src/features.ab diff --git a/flake.lock b/flake.lock index 93f637f..abd3ade 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1772528384, - "narHash": "sha256-KsSaLlrYtpsxq5lxpkyCR1VGx1c3pGmMzTJG5HavMms=", + "lastModified": 1780252401, + "narHash": "sha256-M2BucUe+RvkDGW/0r3YEy6QLM0gu7gMa652l2QWLSBo=", "owner": "amber-lang", "repo": "amber", - "rev": "dd1b7dc7313b1de1c0b958ba17f06655f3ff9d42", + "rev": "32bdcbdf08af80ba35b9ad2731a77b9ab30ae830", "type": "github" }, "original": { diff --git a/src/builders.ab b/src/builders.ab index 44c64b3..4c56a38 100644 --- a/src/builders.ab +++ b/src/builders.ab @@ -10,7 +10,7 @@ import { check_deps, bail } from "./common.ab" import { pull_source_file, pull_binary } from "./resources.ab" import { get_osname, get_cache_root } from "./platform.ab" -import { get_source_root } from "./builders/common.ab" +import { get_source_root, step_total } from "./builders/common.ab" import { build_openssl } from "./builders/openssl.ab" import { build_lowdown } from "./builders/lowdown.ab" @@ -54,14 +54,14 @@ pub fun try_build_nix() { let cache_root = get_cache_root() + step_total = 9 + check_deps(["cc", "c++", "pkg-config", "make", "flex", "bison", "perl"]) failed { bail("Missing required dependencies to build from source.") } if get_osname() == "Darwin": darwin_export_sdk() - trust env_var_set("step_total", "9") - trust dir_create(get_source_root()) trust dir_create("{cache_root}/nix-deps/lib/pkgconfig") diff --git a/src/builders/autoconf.ab b/src/builders/autoconf.ab index b0a1e2d..b7a8a6b 100644 --- a/src/builders/autoconf.ab +++ b/src/builders/autoconf.ab @@ -47,6 +47,5 @@ main(cmdl) let inc_prefix = cmdl[2] trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1") - trust env_var_set("step_total", "1") build_autoconf_dep(lib_name, inc_prefix)? } diff --git a/src/builders/boost.ab b/src/builders/boost.ab index da268bd..2ba386f 100644 --- a/src/builders/boost.ab +++ b/src/builders/boost.ab @@ -67,6 +67,5 @@ pub fun build_boost() main(cmdl) { trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1") - trust env_var_set("step_total", "1") build_boost()? } diff --git a/src/builders/common.ab b/src/builders/common.ab index caeec57..255f3bd 100644 --- a/src/builders/common.ab +++ b/src/builders/common.ab @@ -8,6 +8,11 @@ import { dir_create } from "std/fs" import { set_title } from "../term.ab" import { get_repo_root } from "../platform.ab" +// The following variable gets set to the number of steps in builders.ab. +// This value is a default for the testing entrypoints in each builder module +#[allow_public_mutable] +pub let step_total = 1 + let step_current = 1 /// Invoke `pkg-config` to assert that a given dependency exists on the system. @@ -23,8 +28,6 @@ pub fun pkg_exists(package: Text): Bool /// Change the terminal title to a build step, and increments the step counter. pub fun step_title(name: Text): Null { - let step_total = trust env_var_get("step_total") - trust $clear$ set_title("Building Nix: {name} ({step_current}/{step_total})") diff --git a/src/builders/lowdown.ab b/src/builders/lowdown.ab index 5b34812..24ba40e 100644 --- a/src/builders/lowdown.ab +++ b/src/builders/lowdown.ab @@ -49,6 +49,5 @@ pub fun build_lowdown() main(cmdl) { trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1") - trust env_var_set("step_total", "1") build_lowdown()? } diff --git a/src/builders/nix.ab b/src/builders/nix.ab index effbe46..d07fce1 100644 --- a/src/builders/nix.ab +++ b/src/builders/nix.ab @@ -59,7 +59,6 @@ pub fun build_nix() main(cmdl) { - trust env_var_set("_nixie_testing_skip_tarball", "1") - trust env_var_set("step_total", "1") + trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1") build_nix()? } diff --git a/src/builders/nlohmann_json.ab b/src/builders/nlohmann_json.ab index a8082ca..c7f9a95 100644 --- a/src/builders/nlohmann_json.ab +++ b/src/builders/nlohmann_json.ab @@ -35,6 +35,5 @@ Cflags: -I{source_root}/nlohmann_json/include")? main(cmdl) { trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1") - trust env_var_set("step_total", "1") build_nlohmann_json()? } diff --git a/src/builders/openssl.ab b/src/builders/openssl.ab index 1a2404b..afe165e 100644 --- a/src/builders/openssl.ab +++ b/src/builders/openssl.ab @@ -47,9 +47,6 @@ pub fun build_openssl() { let source_root = get_source_root() let cache_root = get_cache_root() - // Workaround for amber-lang/amber#1043 - let dll_ext = get_dll_ext() - let _ = split_lines("hello") step_title("libcrypto") @@ -67,7 +64,6 @@ pub fun build_openssl() main(cmdl) { trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1") - trust env_var_set("step_total", "1") build_openssl()? } diff --git a/src/cli.ab b/src/cli.ab index f61e507..22b3177 100644 --- a/src/cli.ab +++ b/src/cli.ab @@ -9,11 +9,10 @@ import { dir_create } from "std/fs" import { untar } from "./common.ab" import { get_nix_root, get_cache_root, get_repo_root } from "./platform.ab" +import { NIXIE_VERSION } from "./features.ab" fun cmd_help() { - let NIXIE_VERSION = trust env_var_get("NIXIE_VERSION") - echo "Nix wrapper script, generated by Nixie {NIXIE_VERSION}" echo "" echo "Available --nixie- options:" @@ -36,7 +35,7 @@ fun cmd_print_config() fun cmd_extract() { trust dir_create("nixie") - cd "nixie" + trust cd "nixie" trust untar("") exit 0 } diff --git a/src/features.ab b/src/features.ab new file mode 100644 index 0000000..0f5ee29 --- /dev/null +++ b/src/features.ab @@ -0,0 +1,44 @@ +// Nixie © Karim Vergnes +// Licensed under GNU GPLv2 +// Set of environment variables expected in features + +#[allow_public_mutable] +pub let SOURCE_CACHE = "" +#[allow_public_mutable] +pub let SOURCE_DERIVATION = "" +#[allow_public_mutable] +pub let NIX_BINS_DERIVATION = "" + +#[allow_public_mutable] +pub let EXTRA_FEATURES = "" +#[allow_public_mutable] +pub let EXTRA_SUBSTITUTERS = "" +#[allow_public_mutable] +pub let EXTRA_TRUSTED_PUBLIC_KEYS = "" + +#[allow_public_mutable] +pub let NIXIE_VERSION = "" + +import { untar, bail } from "./common.ab" + +/// Populate environment variables from the features file in the archive. +pub fun load_features(): Null? +{ + let envfile = untar("features", true) failed { + bail("The resource archive is missing or malformed.", true) + } + + $eval {envfile}$ failed { + bail("The environment file in the resource archive is malformed.", true) + } + + SOURCE_CACHE = env_var_get("SOURCE_CACHE")? + SOURCE_DERIVATION = env_var_get("SOURCE_DERIVATION")? + NIX_BINS_DERIVATION = env_var_get("NIX_BINS_DERIVATION")? + + EXTRA_FEATURES = trust env_var_get("EXTRA_FEATURES") + EXTRA_SUBSTITUTERS = trust env_var_get("EXTRA_SUBSTITUTERS") + EXTRA_TRUSTED_PUBLIC_KEYS = trust env_var_get("EXTRA_TRUSTED_PUBLIC_KEYS") + + NIXIE_VERSION = trust env_var_get("NIXIE_VERSION") +} diff --git a/src/main.ab b/src/main.ab index c11453b..a8dd365 100644 --- a/src/main.ab +++ b/src/main.ab @@ -1,64 +1,29 @@ // Nixie © Karim Vergnes // Licensed under GNU GPLv2 // Entry point for script logic - -let SOURCE_CACHE = "" -let SOURCE_DERIVATION = "" -let NIX_BINS_DERIVATION = "" - -let EXTRA_FEATURES = "" -let EXTRA_SUBSTITUTERS = "" -let EXTRA_TRUSTED_PUBLIC_KEYS = "" - -let NIXIE_VERSION = "" - let args = [Text] import { env_var_get, env_var_set } from "std/env" import { array_shift } from "std/array" import { file_exists } from "std/fs" -import { bail, untar, check_deps } from "./common.ab" -import { get_osname } from "./platform.ab" -import { catch_args } from "./cli.ab" -import { launch_nix } from "./nix.ab" +import { check_deps, bail } from "./common.ab" +import { get_osname } from "./platform.ab" +import { catch_args } from "./cli.ab" +import { launch_nix } from "./nix.ab" +import { load_features } from "./features.ab" check_deps(["tar", "gzip", "uname"]) failed { exit 1 } -/// Populate environment variables from the features file in the archive. -/// Also sets variables local to this module, which is not much use until -/// [amber-lang/amber#671](https://github.com/amber-lang/amber/issues/671) is -/// implemented. Checks that the variables exist, I guess. -/// -/// Could be moved to `common.ab` -fun load_features(): Null -{ - let envfile = untar("features", true) failed { - bail("The resource archive is missing or malformed.", true) - } - - $eval {envfile}$ failed { - bail("The environment file in the resource archive is malformed.", true) - } - - SOURCE_CACHE = trust env_var_get("SOURCE_CACHE") - SOURCE_DERIVATION = trust env_var_get("SOURCE_DERIVATION") - NIX_BINS_DERIVATION = trust env_var_get("NIX_BINS_DERIVATION") - - EXTRA_FEATURES = trust env_var_get("EXTRA_FEATURES") - EXTRA_SUBSTITUTERS = trust env_var_get("EXTRA_SUBSTITUTERS") - EXTRA_TRUSTED_PUBLIC_KEYS = trust env_var_get("EXTRA_TRUSTED_PUBLIC_KEYS") - - NIXIE_VERSION = trust env_var_get("NIXIE_VERSION") -} - main(cmdl) { args = cmdl - load_features() + load_features() failed { + bail("The environment file in the resource archive is incomplete.", true) + } catch_args(args) let self = trust array_shift(args) diff --git a/src/nix.ab b/src/nix.ab index 155df01..dda38d0 100644 --- a/src/nix.ab +++ b/src/nix.ab @@ -13,6 +13,8 @@ import { get_osname, get_system, get_cache_root , get_nix_root, get_repo_root } from "./platform.ab" import { pull_binary } from "./resources.ab" import { try_build_nix } from "./builders.ab" +import { EXTRA_FEATURES, EXTRA_SUBSTITUTERS + , EXTRA_TRUSTED_PUBLIC_KEYS } from "./features.ab" /// Determine whether Nix is installed system-wide. Nixie can launch the /// system-wide Nix when it is available, using the script's bundled options. @@ -144,10 +146,6 @@ fun populate_extras(): [Text] { let args = [Text] - let EXTRA_FEATURES = trust env_var_get("EXTRA_FEATURES") - let EXTRA_SUBSTITUTERS = trust env_var_get("EXTRA_SUBSTITUTERS") - let EXTRA_TRUSTED_PUBLIC_KEYS = trust env_var_get("EXTRA_TRUSTED_PUBLIC_KEYS") - let nix_root = get_nix_root() if EXTRA_FEATURES != "": @@ -237,7 +235,7 @@ fun launch_shell_command(nix_path: Text, cmd: Text, extras: [Text], args: [Text] fun launch_nix_shebang(nix_path: Text, file: Text, extras: [Text], args: [Text]): Null { let shebang = "" - for i, line in lines(file) { + for i, line in trust lines(file) { if i == 1 { shebang = line break diff --git a/src/resources.ab b/src/resources.ab index c5fba91..6b73fbc 100644 --- a/src/resources.ab +++ b/src/resources.ab @@ -7,11 +7,10 @@ import { file_exists } from "std/fs" import { env_var_get, env_var_test } from "std/env" import { untar } from "./common.ab" +import { SOURCE_CACHE, SOURCE_DERIVATION, NIX_BINS_DERIVATION } from "./features.ab" fun cachix_url(derivation: Text, member: Text): Text { - let SOURCE_CACHE = trust env_var_get("SOURCE_CACHE") - return "https://{SOURCE_CACHE}/serve/{derivation}/{member}" } @@ -27,8 +26,6 @@ fun cachix_url(derivation: Text, member: Text): Text /// - `dest`: The target directory to move the package contents into pub fun pull_source_file(member: Text, dest: Text): Null? { - let SOURCE_DERIVATION = trust env_var_get("SOURCE_DERIVATION") - let where = "" let my_status = 1 @@ -80,8 +77,6 @@ pub fun pull_source_file(member: Text, dest: Text): Null? /// - `dest`: The target filename to move the file into pub fun pull_binary(member: Text, dest: Text): Null? { - let NIX_BINS_DERIVATION = trust env_var_get("NIX_BINS_DERIVATION") - let where = trust untar(member) if status != 0 { let tmpf = trust $mktemp -t nixie_{member}_XXXXXXXX$ From 1feeed3f7e99158ce393fbf48fe97aad57b48a6c Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Thu, 4 Jun 2026 16:29:51 +0200 Subject: [PATCH 4/8] Some testing cleanup, removed aarch64 normalisation as Nixpkgs now matches uname --- src/builders/common.ab | 3 --- src/features.ab | 2 ++ src/main.ab | 4 ++-- src/platform.ab | 7 +------ tests/features/generation.feature | 2 +- tests/features/steps/common.py | 1 + 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/builders/common.ab b/src/builders/common.ab index 255f3bd..fd69f5b 100644 --- a/src/builders/common.ab +++ b/src/builders/common.ab @@ -2,9 +2,6 @@ // Licensed under GNU GPLv2 // Common functions for source-based builders -import { env_var_get } from "std/env" -import { dir_create } from "std/fs" - import { set_title } from "../term.ab" import { get_repo_root } from "../platform.ab" diff --git a/src/features.ab b/src/features.ab index 0f5ee29..dc1cd7a 100644 --- a/src/features.ab +++ b/src/features.ab @@ -19,6 +19,8 @@ pub let EXTRA_TRUSTED_PUBLIC_KEYS = "" #[allow_public_mutable] pub let NIXIE_VERSION = "" +import { env_var_get } from "std/env" + import { untar, bail } from "./common.ab" /// Populate environment variables from the features file in the archive. diff --git a/src/main.ab b/src/main.ab index a8dd365..371d5d9 100644 --- a/src/main.ab +++ b/src/main.ab @@ -3,7 +3,7 @@ // Entry point for script logic let args = [Text] -import { env_var_get, env_var_set } from "std/env" +import { env_var_set } from "std/env" import { array_shift } from "std/array" import { file_exists } from "std/fs" @@ -14,7 +14,7 @@ import { launch_nix } from "./nix.ab" import { load_features } from "./features.ab" check_deps(["tar", "gzip", "uname"]) failed { - exit 1 + exit(1) } main(cmdl) diff --git a/src/platform.ab b/src/platform.ab index d2a18eb..ddcc74a 100644 --- a/src/platform.ab +++ b/src/platform.ab @@ -17,12 +17,7 @@ pub fun get_osname(): Text /// Return the current machine architecture, as reported by `uname -s`. pub fun get_machine(): Text { - let machine = trust $uname -m$ - - // Normalize to Linux 'aarch64' name - if machine == "arm64": - return "aarch64" - return machine + return trust $uname -m$ } /// Return the combined system-string, in the format `osname.machine`. diff --git a/tests/features/generation.feature b/tests/features/generation.feature index 320d319..93b8668 100644 --- a/tests/features/generation.feature +++ b/tests/features/generation.feature @@ -9,7 +9,7 @@ Feature: Nixie can generate a Nix script with offline resources | nix.Linux.x86_64 | | nix.Darwin.x86_64 | | nix.Linux.aarch64 | - | nix.Darwin.aarch64 | + | nix.Darwin.arm64 | | libfakedir.dylib | Scenario: Offline sources diff --git a/tests/features/steps/common.py b/tests/features/steps/common.py index 34ce03e..23169f4 100644 --- a/tests/features/steps/common.py +++ b/tests/features/steps/common.py @@ -8,6 +8,7 @@ def init_git(context): @given("a Nix wrapper generated with offline {offline}") @when("the Nix wrapper is generated with offline {offline}") def gen_offline(context, offline): + context.nixos.succeed("rm -f nix") cmdline = f"nixie init --sources-derivation {context.nixos.sources} --binaries-derivation {context.nixos.static_bins}" if "binaries" in offline: cmdline += " --with-binaries" From b351b16cbe78fb9f5f2e97676b34ebf89ffa6d7c Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Sat, 6 Jun 2026 15:20:24 +0200 Subject: [PATCH 5/8] Fixed generated file enumeration --- nix | 2534 +++++++++++++++------------- tests/features/generation.feature | 18 +- tests/features/steps/generation.py | 4 +- 3 files changed, 1382 insertions(+), 1174 deletions(-) diff --git a/nix b/nix index 14c35a4..b6c9a95 100755 --- a/nix +++ b/nix @@ -1,585 +1,739 @@ #!/usr/bin/env bash # 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) +# Built using Amber 0.6.0-alpha-nix-32bdcbd (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_253="${1}" - local delimiter_254="${2}" - local result_255=() - IFS="${delimiter_254}" read -rd '' -a result_255 < <(printf %s "$text_253") - __status=$? - ret_split5_v0=("${result_255[@]}") +if [ -n "$ZSH_VERSION" ]; then + EXEC_SHELL="zsh" + IFS='.' read -A EXEC_SHELL_VERSION <<< "$ZSH_VERSION" +elif [ -n "$KSH_VERSION" ]; then + EXEC_SHELL="ksh" + __exec_shell_version="${.sh.version##*/}" + IFS='.' read -a EXEC_SHELL_VERSION <<< "${__exec_shell_version%% *}" +else + EXEC_SHELL="bash" + EXEC_SHELL_VERSION=("${BASH_VERSINFO[0]}" "${BASH_VERSINFO[1]}" "${BASH_VERSINFO[2]}") +fi +# split(text: Text, delimiter: Text) +split__4_v0() { + local text_274="${1}" + local delimiter_275="${2}" + local result_276=() + if [ "$([ "_${EXEC_SHELL}" != "_zsh" ]; echo $?)" != 0 ]; then + IFS="${delimiter_275}" read -rd '' -A result_276 < <(printf %s "$text_274") + __status=$? + elif [ "$([ "_${EXEC_SHELL}" != "_ksh" ]; echo $?)" != 0 ]; then + if [ "$([ "_${delimiter_275}" != "_ +" ]; echo $?)" != 0 ]; then + while read -r -d $'\n'; do result_276+=("$REPLY"); done < <(echo "$text_274") + __status=$? + else + IFS="${delimiter_275}" read -rd '' -a result_276 < <(printf %s "$text_274") + __status=$? + fi + elif [ "$([ "_${EXEC_SHELL}" != "_bash" ]; echo $?)" != 0 ]; then + IFS="${delimiter_275}" read -rd '' -a result_276 < <(printf %s "$text_274") + __status=$? + fi + ret_split4_v0=("${result_276[@]}") return 0 } -join__8_v0() { - local list_261=("${!1}") - local delimiter_262="${2}" +# split_lines(text: Text) +split_lines__5_v0() { + local text_2816="${1}" + split__4_v0 "${text_2816}" " +" + ret_split_lines5_v0=("${ret_split4_v0[@]}") + return 0 +} + +# join(list: [Text], delimiter: Text) +join__7_v0() { + local list_282=("${!1}") + local delimiter_283="${2}" local command_1 - command_1="$(IFS="${delimiter_262}" ; printf "%s -" "${list_261[*]}")" + command_1="$(IFS="${delimiter_283}" ; printf "%s +" "${list_282[*]}")" __status=$? - ret_join8_v0="${command_1}" + ret_join7_v0="${command_1}" return 0 } -parse_int__14_v0() { - local text_2802="${1}" - [ -n "${text_2802}" ] && [ "${text_2802}" -eq "${text_2802}" ] 2>/dev/null +# parse_int(text: Text) +parse_int__13_v0() { + local text_2754="${1}" + [ -n "${text_2754}" ] && [ "${text_2754}" -eq "${text_2754}" ] 2>/dev/null __status=$? if [ "${__status}" != 0 ]; then - ret_parse_int14_v0='' + ret_parse_int13_v0='' return "${__status}" fi - ret_parse_int14_v0="${text_2802}" + ret_parse_int13_v0="${text_2754}" return 0 } -text_contains__17_v0() { - local source_22="${1}" - local search_23="${2}" - [[ "${source_22}" == *"${search_23}"* ]] +# text_contains(source: Text, search: Text) +text_contains__16_v0() { + local source_15="${1}" + local search_16="${2}" + [[ "${source_15}" == *"${search_16}"* ]] __status=$? - ret_text_contains17_v0="$(( __status == 0 ))" + ret_text_contains16_v0="$(( __status == 0 ))" return 0 } -starts_with__23_v0() { - local text_26="${1}" - local prefix_27="${2}" - [[ "${text_26}" == "${prefix_27}"* ]] +# starts_with(text: Text, prefix: Text) +starts_with__22_v0() { + local text_19="${1}" + local prefix_20="${2}" + [[ "${text_19}" == "${prefix_20}"* ]] __status=$? - ret_starts_with23_v0="$(( __status == 0 ))" + ret_starts_with22_v0="$(( __status == 0 ))" return 0 } -ends_with__24_v0() { - local text_2885="${1}" - local suffix_2886="${2}" - [[ "${text_2885}" == *"${suffix_2886}" ]] +# ends_with(text: Text, suffix: Text) +ends_with__23_v0() { + local text_2843="${1}" + local suffix_2844="${2}" + [[ "${text_2843}" == *"${suffix_2844}" ]] __status=$? - ret_ends_with24_v0="$(( __status == 0 ))" + ret_ends_with23_v0="$(( __status == 0 ))" return 0 } -slice__25_v0() { - local text_238="${1}" - local index_239="${2}" - local length_240="${3}" - local result_241="" - if [ "$(( length_240 == 0 ))" != 0 ]; then - local __length_2="${text_238}" - length_240="$(( ${#__length_2} - index_239 ))" +# slice(text: Text, index: Int, length: Int) +slice__24_v0() { + local text_259="${1}" + local index_260="${2}" + local length_261="${3}" + local result_262="" + if [ "$(( length_261 == 0 ))" != 0 ]; then + local __length_2="${text_259}" + length_261="$(( ${#__length_2} - index_260 ))" fi - if [ "$(( length_240 <= 0 ))" != 0 ]; then - ret_slice25_v0="${result_241}" + if [ "$(( length_261 <= 0 ))" != 0 ]; then + ret_slice24_v0="${result_262}" return 0 fi - result_241="${text_238: ${index_239}: ${length_240}}" + result_262="${text_259: ${index_260}: ${length_261}}" __status=$? - ret_slice25_v0="${result_241}" + ret_slice24_v0="${result_262}" return 0 } -dir_exists__41_v0() { - local path_245="${1}" - [ -d "${path_245}" ] +# dir_exists(path: Text) +dir_exists__38_v0() { + local path_265="${1}" + [ -d "${path_265}" ] __status=$? - ret_dir_exists41_v0="$(( __status == 0 ))" + ret_dir_exists38_v0="$(( __status == 0 ))" return 0 } -file_exists__42_v0() { - local path_278="${1}" - [ -f "${path_278}" ] +# file_exists(path: Text) +file_exists__39_v0() { + local path_299="${1}" + [ -f "${path_299}" ] __status=$? - ret_file_exists42_v0="$(( __status == 0 ))" + ret_file_exists39_v0="$(( __status == 0 ))" return 0 } -file_write__44_v0() { - local path_2873="${1}" - local content_2874="${2}" +# file_write(path: Text, content: Text) +file_write__41_v0() { + local path_2828="${1}" + local content_2829="${2}" local command_3 command_3="$(printf '%s -' "${content_2874}" > "${path_2873}")" +' "${content_2829}" > "${path_2828}")" __status=$? if [ "${__status}" != 0 ]; then - ret_file_write44_v0='' + ret_file_write41_v0='' return "${__status}" fi - ret_file_write44_v0="${command_3}" + ret_file_write41_v0="${command_3}" return 0 } -dir_create__47_v0() { - local path_244="${1}" - dir_exists__41_v0 "${path_244}" - local ret_dir_exists41_v0__87_12="${ret_dir_exists41_v0}" - if [ "$(( ! ret_dir_exists41_v0__87_12 ))" != 0 ]; then - mkdir -p "${path_244}" +# dir_create(path: Text) +dir_create__44_v0() { + local path_264="${1}" + dir_exists__38_v0 "${path_264}" + local ret_dir_exists38_v0__87_12="${ret_dir_exists38_v0}" + if [ "$(( ! ret_dir_exists38_v0__87_12 ))" != 0 ]; then + mkdir -p "${path_264}" __status=$? if [ "${__status}" != 0 ]; then - ret_dir_create47_v0='' + ret_dir_create44_v0='' return "${__status}" fi fi } -array_last__74_v0() { - local array_2796=("${!1}") - local __length_4=("${array_2796[@]}") - local index_2797="$(( ${#__length_4[@]} - 1 ))" - if [ "$(( index_2797 < 0 ))" != 0 ]; then - ret_array_last74_v0='' +# array_last(array: [Text]) +array_last__71_v0() { + local array_2748=("${!1}") + local __length_4=("${array_2748[@]}") + local index_2749="$(( ${#__length_4[@]} - 1 ))" + if [ "$(( index_2749 < 0 ))" != 0 ]; then + ret_array_last71_v0='' return 1 fi - ret_array_last74_v0="${array_2796[${index_2797}]}" + ret_array_last71_v0="${array_2748[${index_2749}]?"Index out of bounds (at std/array:69:18)"}" return 0 } -array_pop__77_v0() { - local array_257=("${1}") - eval "local array_257_deref_84=(\"\${${array_257[0]}[@]}\")" - local __length_5=("${array_257_deref_84[@]}") - local length_258="${#__length_5[@]}" - local index_259="$(( length_258 - 1 ))" - if [ "$(( index_259 < 0 ))" != 0 ]; then - ret_array_pop77_v0='' +# array_pop(array: [Text]) +array_pop__74_v0() { + local -n array_278="${1}" + local __length_5=("${array_278[@]}") + local length_279="${#__length_5[@]}" + local index_280="$(( length_279 - 1 ))" + if [ "$(( index_280 < 0 ))" != 0 ]; then + ret_array_pop74_v0='' return 1 fi - eval "local array_257_deref_85=\"\${${array_257[0]}[${index_259}]}\"" - local element_260="${array_257_deref_85}" - local slice_upper_6="${index_259}" + local element_281="${array_278[${index_280}]?"Index out of bounds (at std/array:122:27)"}" + local slice_upper_6="${index_280}" 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_257_deref_86=(\"\${${array_257[0]}[@]:\${slice_offset_7}:\${slice_length_8}}\")" - eval "${array_257}=(\"\${array_257_deref_86[@]}\")" - ret_array_pop77_v0="${element_260}" + array_278=("${array_278[@]:${slice_offset_7}:${slice_length_8}}") + ret_array_pop74_v0="${element_281}" return 0 } -array_shift__78_v0() { - local array_273=("${1}") - eval "local array_273_deref_87=(\"\${${array_273[0]}[@]}\")" - local __length_9=("${array_273_deref_87[@]}") - local length_274="${#__length_9[@]}" - if [ "$(( length_274 == 0 ))" != 0 ]; then - ret_array_shift78_v0='' +# array_shift(array: [Text]) +array_shift__75_v0() { + local -n array_294="${1}" + local __length_9=("${array_294[@]}") + local length_295="${#__length_9[@]}" + if [ "$(( length_295 == 0 ))" != 0 ]; then + ret_array_shift75_v0='' return 1 fi - eval "local array_273_deref_88=\"\${${array_273[0]}[0]}\"" - local element_275="${array_273_deref_88}" - local slice_upper_10="${length_274}" + local element_296="${array_294[0]?"Index out of bounds (at std/array:141:27)"}" + local slice_upper_10="${length_295}" 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_273_deref_89=(\"\${${array_273[0]}[@]:\${slice_offset_11}:\${slice_length_12}}\")" - eval "${array_273}=(\"\${array_273_deref_89[@]}\")" - ret_array_shift78_v0="${element_275}" + array_294=("${array_294[@]:${slice_offset_11}:${slice_length_12}}") + ret_array_shift75_v0="${element_296}" return 0 } -env_var_test__119_v0() { - local name_2794="${1}" - [[ ! -z ${!name_2794+z} ]] - __status=$? - if [ "${__status}" != 0 ]; then - ret_env_var_test119_v0=0 - return 0 +# env_var_test(name: Text) +env_var_test__117_v0() { + local name_2746="${1}" + if [ "$([ "_${EXEC_SHELL}" != "_zsh" ]; echo $?)" != 0 ]; then + [[ ! -z ${(P)name_2746+z} ]] + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_test117_v0=0 + return 0 + fi + elif [ "$([ "_${EXEC_SHELL}" != "_bash" ]; echo $?)" != 0 ]; then + declare -p -- "${name_2746}" > /dev/null 2> /dev/null + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_test117_v0=0 + return 0 + fi + elif [ "$([ "_${EXEC_SHELL}" != "_ksh" ]; echo $?)" != 0 ]; then + eval "[ \"\${$name_2746+x}\" = x ]" + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_test117_v0=0 + return 0 + fi fi - ret_env_var_test119_v0=1 + ret_env_var_test117_v0=1 return 0 } -env_var_set__121_v0() { - local name_266="${1}" - local val_267="${2}" - export $name_266="$val_267" 2> /dev/null +# env_var_set(name: Text, val: Text) +env_var_set__119_v0() { + local name_287="${1}" + local val_288="${2}" + export $name_287="$val_288" 2> /dev/null __status=$? if [ "${__status}" != 0 ]; then - ret_env_var_set121_v0='' + ret_env_var_set119_v0='' return "${__status}" fi } -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}" +# env_var_get(name: Text) +env_var_get__120_v0() { + local name_9="${1}" + if [ "$([ "_${EXEC_SHELL}" != "_bash" ]; echo $?)" != 0 ]; then + local command_13 + command_13="$(printf "%s +" "${!name_9}")" + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_get120_v0='' + return "${__status}" + fi + ret_env_var_get120_v0="${command_13}" + return 0 + elif [ "$([ "_${EXEC_SHELL}" != "_zsh" ]; echo $?)" != 0 ]; then + local command_14 + command_14="$(printf "%s +" "${(P)name_9}")" + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_get120_v0='' + return "${__status}" + fi + ret_env_var_get120_v0="${command_14}" + return 0 + elif [ "$([ "_${EXEC_SHELL}" != "_ksh" ]; echo $?)" != 0 ]; then + local command_15 + command_15="$(eval "echo \${$name_9}")" + __status=$? + if [ "${__status}" != 0 ]; then + ret_env_var_get120_v0='' + return "${__status}" + fi + ret_env_var_get120_v0="${command_15}" + return 0 fi - ret_env_var_get122_v0="${command_13}" - return 0 } -is_command__124_v0() { - local command_66="${1}" - [ -x "$(command -v "${command_66}")" ] +# is_command(command: Text) +is_command__122_v0() { + local command_86="${1}" + [ -x "$(command -v "${command_86}")" ] __status=$? if [ "${__status}" != 0 ]; then - ret_is_command124_v0=0 + ret_is_command122_v0=0 return 0 fi - ret_is_command124_v0=1 + ret_is_command122_v0=1 return 0 } -printf__130_v0() { - local format_38="${1}" - local args_39=("${!2}") - args_39=("${format_38}" "${args_39[@]}") +# printf(format: Text, args: [Text]) +printf__128_v0() { + local format_31="${1}" + local args_32=("${!2}") + args_32=("${format_31}" "${args_32[@]}") __status=$? - printf "${args_39[@]}" + printf "${args_32[@]}" __status=$? } -echo_warning__139_v0() { - local message_264="${1}" - local array_14=("${message_264}") - printf__130_v0 "\\x1b[1;3;97;43m%s\\x1b[0m -" array_14[@] +# echo_warning(message: Text) +echo_warning__137_v0() { + local message_285="${1}" + local array_16=("${message_285}") + printf__128_v0 "\\x1b[1;3;97;43m%s\\x1b[0m +" array_16[@] } -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}" +# echo_error(message: Text, exit_code: Int) +echo_error__138_v0() { + local message_29="${1}" + local exit_code_30="${2}" + local array_17=("${message_29}") + printf__128_v0 "\\x1b[1;3;97;41m%s\\x1b[0m +" array_17[@] + if [ "$(( exit_code_30 > 0 ))" != 0 ]; then + exit "${exit_code_30}" fi } -command_16="$(tput tsl)" +command_18="$(tput tsl)" __status=$? -tsl_11="${command_16}" -command_17="$(tput fsl)" +tsl_4="${command_18}" +command_19="$(tput fsl)" __status=$? -fsl_12="${command_17}" -command_18="$(tput smcup)" +fsl_5="${command_19}" +command_20="$(tput smcup)" __status=$? -smcup_13="${command_18}" -command_19="$(tput rmcup)" +smcup_6="${command_20}" +command_21="$(tput rmcup)" __status=$? -rmcup_14="${command_19}" -env_var_get__122_v0 "TERM" +rmcup_7="${command_21}" +env_var_get__120_v0 "TERM" __status=$? -__TERM_17="${ret_env_var_get122_v0}" -can_set_title__173_v0() { - local has_statusline_118=1 +__TERM_10="${ret_env_var_get120_v0}" +# can_set_title() +can_set_title__169_v0() { + local has_statusline_138=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 + starts_with__22_v0 "${__TERM_10}" "xterm" + local ret_starts_with22_v0__22_12="${ret_starts_with22_v0}" + if [ "${ret_starts_with22_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)" + local command_22 + command_22="$(TERM=xterm+sl tput tsl)" __status=$? - tsl_11="${command_20}" - local command_21 - command_21="$(TERM=xterm+sl tput fsl)" + tsl_4="${command_22}" + local command_23 + command_23="$(TERM=xterm+sl tput fsl)" __status=$? - fsl_12="${command_21}" + fsl_5="${command_23}" else - has_statusline_118=0 + has_statusline_138=0 fi else - has_statusline_118=0 + has_statusline_138=0 fi fi - ret_can_set_title173_v0="${has_statusline_118}" + ret_can_set_title169_v0="${has_statusline_138}" return 0 } -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 - >&2 echo "${tsl_11}""${title_117}""${fsl_12}" +# set_title(title: Text) +set_title__170_v0() { + local title_137="${1}" + can_set_title__169_v0 + local ret_can_set_title169_v0__43_8="${ret_can_set_title169_v0}" + if [ "${ret_can_set_title169_v0__43_8}" != 0 ]; then + >&2 echo "${tsl_4}""${title_137}""${fsl_5}" __status=$? fi } -enter_alt_buffer__175_v0() { - >&2 echo ${smcup_13} +# enter_alt_buffer() +enter_alt_buffer__171_v0() { + >&2 echo ${smcup_6} __status=$? } -exit_alt_buffer__176_v0() { - >&2 echo ${rmcup_14} +# exit_alt_buffer() +exit_alt_buffer__172_v0() { + >&2 echo ${rmcup_7} __status=$? } -teardown__177_v0() { - local failure_342="${1}" - if [ "${failure_342}" != 0 ]; then +# teardown(failure: Bool) +teardown__173_v0() { + local failure_2766="${1}" + if [ "${failure_2766}" != 0 ]; then echo "Press any key to continue..." read -n 1 __status=$? fi - set_title__174_v0 "" - exit_alt_buffer__176_v0 + set_title__170_v0 "" + exit_alt_buffer__172_v0 } -__SELF_18="" -env_var_get__122_v0 "0" +__SELF_11="" +env_var_get__120_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" +me_12="${ret_env_var_get120_v0}" +text_contains__16_v0 "${me_12}" "/" +ret_text_contains16_v0__15_4="${ret_text_contains16_v0}" +if [ "${ret_text_contains16_v0__15_4}" != 0 ]; then + starts_with__22_v0 "${me_12}" "/" + ret_starts_with22_v0__16_12="${ret_starts_with22_v0}" + if [ "$(( ! ret_starts_with22_v0__16_12 ))" != 0 ]; then + env_var_get__120_v0 "PWD" __status=$? - __PWD_28="${ret_env_var_get122_v0}" - command_22="$(readlink ${me_19})" + __PWD_21="${ret_env_var_get120_v0}" + command_24="$(readlink ${me_12})" __status=$? if [ "${__status}" != 0 ]; then - __SELF_18="${__PWD_28}/${me_19}" + __SELF_11="${__PWD_21}/${me_12}" 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}" + rl_22="${command_24}" + starts_with__22_v0 "${rl_22}" "/" + ret_starts_with22_v0__25_17="${ret_starts_with22_v0}" + if [ "$([ "_${rl_22}" != "_" ]; echo $?)" != 0 ]; then + __SELF_11="${__SELF_11}" + elif [ "$(( ! ret_starts_with22_v0__25_17 ))" != 0 ]; then + __SELF_11="${__PWD_21}/${rl_22}" else - __SELF_18="${rl_29}" + __SELF_11="${rl_22}" fi fi else - echo_error__140_v0 "This script must be run from an absolute or relative path." 1 + echo_error__138_v0 "This script must be run from an absolute or relative path." 1 fi -exists_newer__180_v0() { - local left_2800="${1}" - local right_2801="${2}" - local command_23 - command_23="$(stat -c %W ${left_2800})" +# exists_newer(left: Text, right: Text) +exists_newer__176_v0() { + local left_2752="${1}" + local right_2753="${2}" + local command_25 + command_25="$(stat -c %W ${left_2752})" __status=$? - parse_int__14_v0 "${command_23}" + parse_int__13_v0 "${command_25}" __status=$? if [ "${__status}" != 0 ]; then - ret_exists_newer180_v0=0 + ret_exists_newer176_v0=0 return 0 fi - local left_time_2803="${ret_parse_int14_v0}" - local command_24 - command_24="$(stat -c %W ${right_2801})" + local left_time_2755="${ret_parse_int13_v0}" + local command_26 + command_26="$(stat -c %W ${right_2753})" __status=$? - parse_int__14_v0 "${command_24}" + parse_int__13_v0 "${command_26}" __status=$? if [ "${__status}" != 0 ]; then - ret_exists_newer180_v0=0 + ret_exists_newer176_v0=0 return 0 fi - local right_time_2804="${ret_parse_int14_v0}" - ret_exists_newer180_v0="$(( left_time_2803 >= right_time_2804 ))" + local right_time_2756="${ret_parse_int13_v0}" + ret_exists_newer176_v0="$(( left_time_2755 >= right_time_2756 ))" return 0 } -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 +# bail(message: Text, archive: Bool) +bail__177_v0() { + local message_135="${1}" + local archive_136="${2}" + exit_alt_buffer__172_v0 + set_title__170_v0 "" + echo_error__138_v0 "${message_135}" 0 + if [ "${archive_136}" != 0 ]; then + echo_error__138_v0 "This script can be rebuilt using the nixie tool." 0 fi exit 1 kill -ABRT $$ __status=$? } -get_self__182_v0() { - ret_get_self182_v0="${__SELF_18}" +# get_self() +get_self__178_v0() { + ret_get_self178_v0="${__SELF_11}" return 0 } -dump_archive__183_v0() { - local command_25 - command_25="$(mktemp -t nixie_XXXXXXXX.tar)" +# dump_archive() +dump_archive__179_v0() { + local command_27 + command_27="$(mktemp -t nixie_XXXXXXXX.tar)" __status=$? - local dest_114="${command_25}" - cat ${__SELF_18} | ( + local dest_134="${command_27}" + cat ${__SELF_11} | ( read -r M while ! [[ "$M" =~ ^-----BEGIN\ ARCHIVE\ SECTION----- ]] do read -r M || return 1 done - gzip -d -c 2>/dev/null > ${dest_114} + gzip -d -c 2>/dev/null > ${dest_134} ) __status=$? if [ "${__status}" != 0 ]; then if [ "$(( __status != 2 ))" != 0 ]; then - bail__181_v0 "Could not find the script's resource archive." 1 + bail__177_v0 "Could not find the script's resource archive." 1 fi fi - ret_dump_archive183_v0="${dest_114}" + ret_dump_archive179_v0="${dest_134}" return 0 } -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}" +# untar(member: Text, dump: Bool) +untar__180_v0() { + local member_132="${1}" + local dump_133="${2}" + dump_archive__179_v0 + local archive_139="${ret_dump_archive179_v0}" + local tar_cmd_140="tar -x ${member_132} -f ${archive_139}" + if [ "${dump_133}" != 0 ]; then + tar_cmd_140="tar -x -O ${member_132} -f ${archive_139}" fi - local command_26 - command_26="$(${tar_cmd_120})" + local command_28 + command_28="$(${tar_cmd_140})" __status=$? if [ "${__status}" != 0 ]; then - local tar_status_121="${__status}" - rm ${archive_119} + local tar_status_141="${__status}" + rm ${archive_139} __status=$? - ret_untar184_v0='' - return "${tar_status_121}" + ret_untar180_v0='' + return "${tar_status_141}" fi - local tar_out_122="${command_26}" - rm ${archive_119} + local tar_out_142="${command_28}" + rm ${archive_139} __status=$? - if [ "${dump_113}" != 0 ]; then - ret_untar184_v0="${tar_out_122}" + if [ "${dump_133}" != 0 ]; then + ret_untar180_v0="${tar_out_142}" return 0 else - ret_untar184_v0="${member_112}" + ret_untar180_v0="${member_132}" return 0 fi } -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__139_16="${ret_is_command124_v0}" - if [ "$(( ! ret_is_command124_v0__139_16 ))" != 0 ]; then - missing_64+=("${dep_65}") +# check_deps(deps: [Text]) +check_deps__181_v0() { + local deps_83=("${!1}") + local missing_84=() + for dep_85 in "${deps_83[@]}"; do + is_command__122_v0 "${dep_85}" + local ret_is_command122_v0__139_16="${ret_is_command122_v0}" + if [ "$(( ! ret_is_command122_v0__139_16 ))" != 0 ]; then + missing_84+=("${dep_85}") 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 + local __length_33=("${missing_84[@]}") + if [ "$(( ${#__length_33[@]} > 0 ))" != 0 ]; then + echo_error__138_v0 "The following commands are missing:" 0 + for cmd_87 in "${missing_84[@]}"; do + echo_error__138_v0 "- ${cmd_87}" 0 done - echo_error__140_v0 "Use your distribution's package manager to install them, then try again." 0 - ret_check_deps185_v0='' + echo_error__138_v0 "Use your distribution's package manager to install them, then try again." 0 + ret_check_deps181_v0='' return 1 fi } -get_osname__195_v0() { - local command_30 - command_30="$(uname -s)" +# get_osname() +get_osname__190_v0() { + local command_36 + command_36="$(uname -s)" __status=$? - ret_get_osname195_v0="${command_30}" + ret_get_osname190_v0="${command_36}" return 0 } -get_machine__196_v0() { - local command_31 - command_31="$(uname -m)" +# get_machine() +get_machine__191_v0() { + local command_37 + command_37="$(uname -m)" __status=$? - local machine_2810="${command_31}" - if [ "$([ "_${machine_2810}" != "_arm64" ]; echo $?)" != 0 ]; then - ret_get_machine196_v0="aarch64" - return 0 - fi - ret_get_machine196_v0="${machine_2810}" + ret_get_machine191_v0="${command_37}" return 0 } -get_system__197_v0() { - get_osname__195_v0 - local osname_2809="${ret_get_osname195_v0}" - get_machine__196_v0 - local machine_2811="${ret_get_machine196_v0}" - ret_get_system197_v0="${osname_2809}.${machine_2811}" +# get_system() +get_system__192_v0() { + get_osname__190_v0 + local osname_2761="${ret_get_osname190_v0}" + get_machine__191_v0 + local machine_2762="${ret_get_machine191_v0}" + ret_get_system192_v0="${osname_2761}.${machine_2762}" return 0 } -get_nix_root__199_v0() { - env_var_get__122_v0 "HOME" +# get_nix_root() +get_nix_root__194_v0() { + env_var_get__120_v0 "HOME" __status=$? - local userhome_246="${ret_env_var_get122_v0}" - get_osname__195_v0 - local osname_247="${ret_get_osname195_v0}" - if [ "$([ "_${osname_247}" != "_Darwin" ]; echo $?)" != 0 ]; then - ret_get_nix_root199_v0="${userhome_246}/Library/Nix" - return 0 + local userhome_266="${ret_env_var_get120_v0}" + get_osname__190_v0 + local osname_267="${ret_get_osname190_v0}" + local result_268="" + if [ "$([ "_${osname_267}" != "_Darwin" ]; echo $?)" != 0 ]; then + result_268="${userhome_266}/Library/Nix" else - ret_get_nix_root199_v0="${userhome_246}/.local/share/nix/root" - return 0 + result_268="${userhome_266}/.local/share/nix/root" fi + mkdir -p ${result_268} + __status=$? + ret_get_nix_root194_v0="${result_268}" + return 0 } -get_cache_root__200_v0() { - env_var_get__122_v0 "HOME" +# get_cache_root() +get_cache_root__195_v0() { + env_var_get__120_v0 "HOME" __status=$? - local userhome_249="${ret_env_var_get122_v0}" - get_osname__195_v0 - local osname_250="${ret_get_osname195_v0}" - local result_251="" - if [ "$([ "_${osname_250}" != "_Darwin" ]; echo $?)" != 0 ]; then - result_251="${userhome_249}/Library/Caches" + local userhome_270="${ret_env_var_get120_v0}" + get_osname__190_v0 + local osname_271="${ret_get_osname190_v0}" + local result_272="" + if [ "$([ "_${osname_271}" != "_Darwin" ]; echo $?)" != 0 ]; then + result_272="${userhome_270}/Library/Caches" else - result_251="${userhome_249}/.cache" + result_272="${userhome_270}/.cache" fi - mkdir -p ${result_251} + mkdir -p ${result_272} __status=$? - ret_get_cache_root200_v0="${result_251}" + ret_get_cache_root195_v0="${result_272}" return 0 } -get_repo_root__201_v0() { - get_self__182_v0 - local ret_get_self182_v0__82_24="${ret_get_self182_v0}" - split__5_v0 "${ret_get_self182_v0__82_24}" "/" - local self_a_256=("${ret_split5_v0[@]}") - array_pop__77_v0 "self_a_256" +# get_repo_root() +get_repo_root__196_v0() { + get_self__178_v0 + local ret_get_self178_v0__80_24="${ret_get_self178_v0}" + split__4_v0 "${ret_get_self178_v0__80_24}" "/" + local self_a_277=("${ret_split4_v0[@]}") + array_pop__74_v0 "self_a_277" __status=$? - join__8_v0 self_a_256[@] "/" - local ret_join8_v0__85_26="${ret_join8_v0}" - local self_dir_263="/""${ret_join8_v0__85_26}" - local command_32 - command_32="$(git -C ${self_dir_263} rev-parse --show-toplevel)" + join__7_v0 self_a_277[@] "/" + local ret_join7_v0__83_26="${ret_join7_v0}" + local self_dir_284="/""${ret_join7_v0__83_26}" + local command_38 + command_38="$(git -C ${self_dir_284} 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_263}" + echo_warning__137_v0 "Failed to find current Git repository, using script parent directory." + ret_get_repo_root196_v0="${self_dir_284}" return 0 fi - ret_get_repo_root201_v0="${command_32}" + ret_get_repo_root196_v0="${command_38}" return 0 } -cmd_help__214_v0() { - env_var_get__122_v0 "NIXIE_VERSION" +__SOURCE_CACHE_33="" +__NIX_BINS_DERIVATION_35="" +__EXTRA_FEATURES_36="" +__EXTRA_SUBSTITUTERS_37="" +__EXTRA_TRUSTED_PUBLIC_KEYS_38="" +__NIXIE_VERSION_39="" +# load_features() +load_features__212_v0() { + untar__180_v0 "features" 1 + __status=$? + if [ "${__status}" != 0 ]; then + bail__177_v0 "The resource archive is missing or malformed." 1 + fi + local envfile_143="${ret_untar180_v0}" + eval ${envfile_143} + __status=$? + if [ "${__status}" != 0 ]; then + bail__177_v0 "The environment file in the resource archive is malformed." 1 + fi + env_var_get__120_v0 "SOURCE_CACHE" + __status=$? + if [ "${__status}" != 0 ]; then + ret_load_features212_v0='' + return "${__status}" + fi + __SOURCE_CACHE_33="${ret_env_var_get120_v0}" + env_var_get__120_v0 "SOURCE_DERIVATION" + __status=$? + if [ "${__status}" != 0 ]; then + ret_load_features212_v0='' + return "${__status}" + fi + env_var_get__120_v0 "NIX_BINS_DERIVATION" + __status=$? + if [ "${__status}" != 0 ]; then + ret_load_features212_v0='' + return "${__status}" + fi + __NIX_BINS_DERIVATION_35="${ret_env_var_get120_v0}" + env_var_get__120_v0 "EXTRA_FEATURES" + __status=$? + __EXTRA_FEATURES_36="${ret_env_var_get120_v0}" + env_var_get__120_v0 "EXTRA_SUBSTITUTERS" + __status=$? + __EXTRA_SUBSTITUTERS_37="${ret_env_var_get120_v0}" + env_var_get__120_v0 "EXTRA_TRUSTED_PUBLIC_KEYS" + __status=$? + __EXTRA_TRUSTED_PUBLIC_KEYS_38="${ret_env_var_get120_v0}" + env_var_get__120_v0 "NIXIE_VERSION" __status=$? - local __NIXIE_VERSION_243="${ret_env_var_get122_v0}" - echo "Nix wrapper script, generated by Nixie ${__NIXIE_VERSION_243}" + __NIXIE_VERSION_39="${ret_env_var_get120_v0}" +} + +# cmd_help() +cmd_help__213_v0() { + echo "Nix wrapper script, generated by Nixie ${__NIXIE_VERSION_39}" printf '%s\n' "" echo "Available --nixie- options:" echo " --nixie-help Show this help message and exit." @@ -590,1400 +744,1454 @@ cmd_help__214_v0() { exit 0 } -cmd_print_config__215_v0() { - untar__184_v0 "features" 1 +# cmd_print_config() +cmd_print_config__214_v0() { + untar__180_v0 "features" 1 __status=$? - local ret_untar184_v0__32_16="${ret_untar184_v0}" - printf '%s\n' "${ret_untar184_v0__32_16}" + local ret_untar180_v0__31_16="${ret_untar180_v0}" + printf '%s\n' "${ret_untar180_v0__31_16}" exit 0 } -cmd_extract__216_v0() { - dir_create__47_v0 "nixie" +# cmd_extract() +cmd_extract__215_v0() { + dir_create__44_v0 "nixie" + __status=$? + cd "nixie" __status=$? - cd "nixie" || exit - untar__184_v0 "" 0 + untar__180_v0 "" 0 __status=$? exit 0 } -cmd_cleanup__217_v0() { - get_nix_root__199_v0 - local nix_root_248="${ret_get_nix_root199_v0}" - get_cache_root__200_v0 - local cache_root_252="${ret_get_cache_root200_v0}" - get_repo_root__201_v0 - local repo_root_265="${ret_get_repo_root201_v0}" +# cmd_cleanup() +cmd_cleanup__216_v0() { + get_nix_root__194_v0 + local nix_root_269="${ret_get_nix_root194_v0}" + get_cache_root__195_v0 + local cache_root_273="${ret_get_cache_root195_v0}" + get_repo_root__196_v0 + local repo_root_286="${ret_get_repo_root196_v0}" echo "Removing local Nix channels and build files..." - chmod -R +wx ${repo_root_265}/.nixie 2>/dev/null + chmod -R +wx ${repo_root_286}/.nixie 2>/dev/null __status=$? - rm -rf ${repo_root_265}/.nixie + rm -rf ${repo_root_286}/.nixie __status=$? echo "Removing user Nix store..." - chmod -R +wx ${nix_root_248} 2>/dev/null + chmod -R +wx ${nix_root_269} 2>/dev/null __status=$? - rm -rf ${nix_root_248} + rm -rf ${nix_root_269} __status=$? echo "Removing retrieved Nix binaries..." - rm -rf ${cache_root_252}/nix-static ${cache_root_252}/nix-lib ${cache_root_252}/nix-deps + rm -rf ${cache_root_273}/nix-static ${cache_root_273}/nix-lib ${cache_root_273}/nix-deps __status=$? exit 0 } -opt_ignore_system__218_v0() { +# opt_ignore_system() +opt_ignore_system__217_v0() { >&2 echo "Ignoring system-wide Nix for testing purposes." __status=$? >&2 echo "Re-run without the --nixie-ignore-system flag to import the single-user" __status=$? >&2 echo "Nix store into the system store." __status=$? - env_var_set__121_v0 "nosystem" "1" + env_var_set__119_v0 "nosystem" "1" __status=$? } -opt_no_precompiled__219_v0() { +# opt_no_precompiled() +opt_no_precompiled__218_v0() { >&2 echo "Ignoring precompiled binaries for testing purposes." __status=$? >&2 echo "This implies --nixie-ignore-system." __status=$? - env_var_set__121_v0 "nobins" "1" + env_var_set__119_v0 "nobins" "1" __status=$? - env_var_set__121_v0 "nosystem" "1" + env_var_set__119_v0 "nosystem" "1" __status=$? } -notfound__220_v0() { - local cmd_268="${1}" - env_var_get__122_v0 "0" +# notfound(cmd: Text) +notfound__219_v0() { + local cmd_289="${1}" + env_var_get__120_v0 "0" __status=$? - local self_269="${ret_env_var_get122_v0}" - echo_error__140_v0 "No such option: --nixie-${cmd_268}. Run '${self_269} --nixie-help' for available options." 1 + local self_290="${ret_env_var_get120_v0}" + echo_error__138_v0 "No such option: --nixie-${cmd_289}. Run '${self_290} --nixie-help' for available options." 1 } -eval_cmd__221_v0() { - local cmd_242="${1}" - if [ "$([ "_${cmd_242}" != "_help" ]; echo $?)" != 0 ]; then - cmd_help__214_v0 - elif [ "$([ "_${cmd_242}" != "_print-config" ]; echo $?)" != 0 ]; then - cmd_print_config__215_v0 - elif [ "$([ "_${cmd_242}" != "_extract" ]; echo $?)" != 0 ]; then - cmd_extract__216_v0 - elif [ "$([ "_${cmd_242}" != "_cleanup" ]; echo $?)" != 0 ]; then - cmd_cleanup__217_v0 - elif [ "$([ "_${cmd_242}" != "_ignore-system" ]; echo $?)" != 0 ]; then - opt_ignore_system__218_v0 - elif [ "$([ "_${cmd_242}" != "_no-precompiled" ]; echo $?)" != 0 ]; then - opt_no_precompiled__219_v0 +# eval_cmd(cmd: Text) +eval_cmd__220_v0() { + local cmd_263="${1}" + if [ "$([ "_${cmd_263}" != "_help" ]; echo $?)" != 0 ]; then + cmd_help__213_v0 + elif [ "$([ "_${cmd_263}" != "_print-config" ]; echo $?)" != 0 ]; then + cmd_print_config__214_v0 + elif [ "$([ "_${cmd_263}" != "_extract" ]; echo $?)" != 0 ]; then + cmd_extract__215_v0 + elif [ "$([ "_${cmd_263}" != "_cleanup" ]; echo $?)" != 0 ]; then + cmd_cleanup__216_v0 + elif [ "$([ "_${cmd_263}" != "_ignore-system" ]; echo $?)" != 0 ]; then + opt_ignore_system__217_v0 + elif [ "$([ "_${cmd_263}" != "_no-precompiled" ]; echo $?)" != 0 ]; then + opt_no_precompiled__218_v0 else - notfound__220_v0 "${cmd_242}" - fi -} - -catch_args__222_v0() { - local args_234=("${1}") - eval "local args_234_deref_90=(\"\${${args_234[0]}[@]}\")" - local local_args_235=("${args_234_deref_90[@]}") - eval "${args_234}=()" - for arg_236 in "${local_args_235[@]}"; do - local cmd_237="" - starts_with__23_v0 "${arg_236}" "--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_236}" "${#__length_34}" 0 - cmd_237="${ret_slice25_v0}" - eval_cmd__221_v0 "${cmd_237}" + notfound__219_v0 "${cmd_263}" + fi +} + +# catch_args(args: [Text]) +catch_args__221_v0() { + local -n args_255="${1}" + local local_args_256=("${args_255[@]}") + args_255=() + for arg_257 in "${local_args_256[@]}"; do + local cmd_258="" + starts_with__22_v0 "${arg_257}" "--nixie-" + local ret_starts_with22_v0__109_12="${ret_starts_with22_v0}" + if [ "${ret_starts_with22_v0__109_12}" != 0 ]; then + local __length_42="--nixie-" + slice__24_v0 "${arg_257}" "${#__length_42}" 0 + cmd_258="${ret_slice24_v0}" + eval_cmd__220_v0 "${cmd_258}" else - eval "${args_234}+=(\"\${arg_236}\")" + args_255+=("${arg_257}") fi done } -file_download__326_v0() { - local url_2823="${1}" - local path_2824="${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_2824}" "${url_2823}">/dev/null 2>&1 +# file_download(url: Text, path: Text) +file_download__324_v0() { + local url_2773="${1}" + local path_2774="${2}" + is_command__122_v0 "curl" + local ret_is_command122_v0__15_9="${ret_is_command122_v0}" + is_command__122_v0 "wget" + local ret_is_command122_v0__18_9="${ret_is_command122_v0}" + is_command__122_v0 "aria2c" + local ret_is_command122_v0__21_9="${ret_is_command122_v0}" + if [ "${ret_is_command122_v0__15_9}" != 0 ]; then + curl -L -o "${path_2774}" "${url_2773}" >/dev/null 2>&1 __status=$? - elif [ "${ret_is_command124_v0__18_9}" != 0 ]; then - wget "${url_2823}" -P "${path_2824}">/dev/null 2>&1 + elif [ "${ret_is_command122_v0__18_9}" != 0 ]; then + wget "${url_2773}" -P "${path_2774}" >/dev/null 2>&1 __status=$? - elif [ "${ret_is_command124_v0__21_9}" != 0 ]; then - aria2c "${url_2823}" -d "${path_2824}">/dev/null 2>&1 + elif [ "${ret_is_command122_v0__21_9}" != 0 ]; then + aria2c "${url_2773}" -d "${path_2774}" >/dev/null 2>&1 __status=$? else - ret_file_download326_v0='' + ret_file_download324_v0='' return 1 fi } -cachix_url__333_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_url333_v0="https://${__SOURCE_CACHE_2822}/serve/${derivation_2820}/${member_2821}" +# cachix_url(derivation: Text, member: Text) +cachix_url__331_v0() { + local derivation_2771="${1}" + local member_2772="${2}" + ret_cachix_url331_v0="https://${__SOURCE_CACHE_33}/serve/${derivation_2771}/${member_2772}" return 0 } -pull_binary__335_v0() { - local member_2815="${1}" - local dest_2816="${2}" - env_var_get__122_v0 "NIX_BINS_DERIVATION" - __status=$? - local __NIX_BINS_DERIVATION_2817="${ret_env_var_get122_v0}" - untar__184_v0 "${member_2815}" 0 +# pull_binary(member: Text, dest: Text) +pull_binary__333_v0() { + local member_2767="${1}" + local dest_2768="${2}" + untar__180_v0 "${member_2767}" 0 __status=$? - local where_2818="${ret_untar184_v0}" + local where_2769="${ret_untar180_v0}" if [ "$(( __status != 0 ))" != 0 ]; then - local command_36 - command_36="$(mktemp -t nixie_${member_2815}_XXXXXXXX)" + local command_44 + command_44="$(mktemp -t nixie_${member_2767}_XXXXXXXX)" __status=$? - local tmpf_2819="${command_36}" - cachix_url__333_v0 "${__NIX_BINS_DERIVATION_2817}" "${member_2815}" - local ret_cachix_url333_v0__89_23="${ret_cachix_url333_v0}" - file_download__326_v0 "${ret_cachix_url333_v0__89_23}" "${tmpf_2819}" + local tmpf_2770="${command_44}" + cachix_url__331_v0 "${__NIX_BINS_DERIVATION_35}" "${member_2767}" + local ret_cachix_url331_v0__84_23="${ret_cachix_url331_v0}" + file_download__324_v0 "${ret_cachix_url331_v0__84_23}" "${tmpf_2770}" __status=$? if [ "${__status}" != 0 ]; then - ret_pull_binary335_v0='' + ret_pull_binary333_v0='' return "${__status}" fi - where_2818="${tmpf_2819}" + where_2769="${tmpf_2770}" fi - mv "${where_2818}" "${dest_2816}" + mv "${where_2769}" "${dest_2768}" __status=$? } -command_37="$(tput tsl)" +command_45="$(tput tsl)" __status=$? -tsl_40="${command_37}" -command_38="$(tput fsl)" +tsl_44="${command_45}" +command_46="$(tput fsl)" __status=$? -fsl_41="${command_38}" -command_39="$(tput smcup)" +fsl_45="${command_46}" +command_47="$(tput smcup)" __status=$? -command_40="$(tput rmcup)" +command_48="$(tput rmcup)" __status=$? -env_var_get__122_v0 "TERM" +env_var_get__120_v0 "TERM" __status=$? -__TERM_44="${ret_env_var_get122_v0}" -can_set_title__352_v0() { - local has_statusline_2841=1 +__TERM_48="${ret_env_var_get120_v0}" +# can_set_title() +can_set_title__348_v0() { + local has_statusline_2790=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 + starts_with__22_v0 "${__TERM_48}" "xterm" + local ret_starts_with22_v0__22_12="${ret_starts_with22_v0}" + if [ "${ret_starts_with22_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)" + local command_49 + command_49="$(TERM=xterm+sl tput tsl)" __status=$? - tsl_40="${command_41}" - local command_42 - command_42="$(TERM=xterm+sl tput fsl)" + tsl_44="${command_49}" + local command_50 + command_50="$(TERM=xterm+sl tput fsl)" __status=$? - fsl_41="${command_42}" + fsl_45="${command_50}" else - has_statusline_2841=0 + has_statusline_2790=0 fi else - has_statusline_2841=0 + has_statusline_2790=0 fi fi - ret_can_set_title352_v0="${has_statusline_2841}" + ret_can_set_title348_v0="${has_statusline_2790}" return 0 } -set_title__353_v0() { - local title_2840="${1}" - can_set_title__352_v0 - local ret_can_set_title352_v0__43_8="${ret_can_set_title352_v0}" - if [ "${ret_can_set_title352_v0__43_8}" != 0 ]; then - >&2 echo "${tsl_40}""${title_2840}""${fsl_41}" +# set_title(title: Text) +set_title__349_v0() { + local title_2789="${1}" + can_set_title__348_v0 + local ret_can_set_title348_v0__43_8="${ret_can_set_title348_v0}" + if [ "${ret_can_set_title348_v0__43_8}" != 0 ]; then + >&2 echo "${tsl_44}""${title_2789}""${fsl_45}" __status=$? fi } -command_43="$(tput tsl)" +command_51="$(tput tsl)" __status=$? -tsl_45="${command_43}" -command_44="$(tput fsl)" +tsl_49="${command_51}" +command_52="$(tput fsl)" __status=$? -fsl_46="${command_44}" -command_45="$(tput smcup)" +fsl_50="${command_52}" +command_53="$(tput smcup)" __status=$? -command_46="$(tput rmcup)" +command_54="$(tput rmcup)" __status=$? -rmcup_48="${command_46}" -env_var_get__122_v0 "TERM" +rmcup_52="${command_54}" +env_var_get__120_v0 "TERM" __status=$? -__TERM_49="${ret_env_var_get122_v0}" -can_set_title__372_v0() { - local has_statusline_2854=1 +__TERM_53="${ret_env_var_get120_v0}" +# can_set_title() +can_set_title__368_v0() { + local has_statusline_2802=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 + starts_with__22_v0 "${__TERM_53}" "xterm" + local ret_starts_with22_v0__22_12="${ret_starts_with22_v0}" + if [ "${ret_starts_with22_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)" + local command_55 + command_55="$(TERM=xterm+sl tput tsl)" __status=$? - tsl_45="${command_47}" - local command_48 - command_48="$(TERM=xterm+sl tput fsl)" + tsl_49="${command_55}" + local command_56 + command_56="$(TERM=xterm+sl tput fsl)" __status=$? - fsl_46="${command_48}" + fsl_50="${command_56}" else - has_statusline_2854=0 + has_statusline_2802=0 fi else - has_statusline_2854=0 + has_statusline_2802=0 fi fi - ret_can_set_title372_v0="${has_statusline_2854}" + ret_can_set_title368_v0="${has_statusline_2802}" return 0 } -set_title__373_v0() { - local title_2853="${1}" - can_set_title__372_v0 - local ret_can_set_title372_v0__43_8="${ret_can_set_title372_v0}" - if [ "${ret_can_set_title372_v0__43_8}" != 0 ]; then - >&2 echo "${tsl_45}""${title_2853}""${fsl_46}" +# set_title(title: Text) +set_title__369_v0() { + local title_2801="${1}" + can_set_title__368_v0 + local ret_can_set_title368_v0__43_8="${ret_can_set_title368_v0}" + if [ "${ret_can_set_title368_v0__43_8}" != 0 ]; then + >&2 echo "${tsl_49}""${title_2801}""${fsl_50}" __status=$? fi } -exit_alt_buffer__375_v0() { - >&2 echo ${rmcup_48} +# exit_alt_buffer() +exit_alt_buffer__371_v0() { + >&2 echo ${rmcup_52} __status=$? } -__SELF_50="" -env_var_get__122_v0 "0" +__SELF_54="" +env_var_get__120_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" +me_55="${ret_env_var_get120_v0}" +text_contains__16_v0 "${me_55}" "/" +ret_text_contains16_v0__15_4="${ret_text_contains16_v0}" +if [ "${ret_text_contains16_v0__15_4}" != 0 ]; then + starts_with__22_v0 "${me_55}" "/" + ret_starts_with22_v0__16_12="${ret_starts_with22_v0}" + if [ "$(( ! ret_starts_with22_v0__16_12 ))" != 0 ]; then + env_var_get__120_v0 "PWD" __status=$? - __PWD_52="${ret_env_var_get122_v0}" - command_49="$(readlink ${me_51})" + __PWD_56="${ret_env_var_get120_v0}" + command_57="$(readlink ${me_55})" __status=$? if [ "${__status}" != 0 ]; then - __SELF_50="${__PWD_52}/${me_51}" + __SELF_54="${__PWD_56}/${me_55}" 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}" + rl_57="${command_57}" + starts_with__22_v0 "${rl_57}" "/" + ret_starts_with22_v0__25_17="${ret_starts_with22_v0}" + if [ "$([ "_${rl_57}" != "_" ]; echo $?)" != 0 ]; then + __SELF_54="${__SELF_54}" + elif [ "$(( ! ret_starts_with22_v0__25_17 ))" != 0 ]; then + __SELF_54="${__PWD_56}/${rl_57}" else - __SELF_50="${rl_53}" + __SELF_54="${rl_57}" fi fi else - echo_error__140_v0 "This script must be run from an absolute or relative path." 1 + echo_error__138_v0 "This script must be run from an absolute or relative path." 1 fi -bail__380_v0() { - local message_2851="${1}" - local archive_2852="${2}" - exit_alt_buffer__375_v0 - set_title__373_v0 "" - echo_error__140_v0 "${message_2851}" 0 - if [ "${archive_2852}" != 0 ]; then - echo_error__140_v0 "This script can be rebuilt using the nixie tool." 0 +# bail(message: Text, archive: Bool) +bail__376_v0() { + local message_2799="${1}" + local archive_2800="${2}" + exit_alt_buffer__371_v0 + set_title__369_v0 "" + echo_error__138_v0 "${message_2799}" 0 + if [ "${archive_2800}" != 0 ]; then + echo_error__138_v0 "This script can be rebuilt using the nixie tool." 0 fi exit 1 kill -ABRT $$ __status=$? } -get_self__381_v0() { - ret_get_self381_v0="${__SELF_50}" +# get_self() +get_self__377_v0() { + ret_get_self377_v0="${__SELF_54}" return 0 } -dump_archive__382_v0() { - local command_50 - command_50="$(mktemp -t nixie_XXXXXXXX.tar)" +# dump_archive() +dump_archive__378_v0() { + local command_58 + command_58="$(mktemp -t nixie_XXXXXXXX.tar)" __status=$? - local dest_2850="${command_50}" - cat ${__SELF_50} | ( + local dest_2798="${command_58}" + cat ${__SELF_54} | ( read -r M while ! [[ "$M" =~ ^-----BEGIN\ ARCHIVE\ SECTION----- ]] do read -r M || return 1 done - gzip -d -c 2>/dev/null > ${dest_2850} + gzip -d -c 2>/dev/null > ${dest_2798} ) __status=$? if [ "${__status}" != 0 ]; then if [ "$(( __status != 2 ))" != 0 ]; then - bail__380_v0 "Could not find the script's resource archive." 1 + bail__376_v0 "Could not find the script's resource archive." 1 fi fi - ret_dump_archive382_v0="${dest_2850}" + ret_dump_archive378_v0="${dest_2798}" return 0 } -untar__383_v0() { - local member_2848="${1}" - local dump_2849="${2}" - dump_archive__382_v0 - local archive_2855="${ret_dump_archive382_v0}" - local tar_cmd_2856="tar -x ${member_2848} -f ${archive_2855}" - if [ "${dump_2849}" != 0 ]; then - tar_cmd_2856="tar -x -O ${member_2848} -f ${archive_2855}" +# untar(member: Text, dump: Bool) +untar__379_v0() { + local member_2796="${1}" + local dump_2797="${2}" + dump_archive__378_v0 + local archive_2803="${ret_dump_archive378_v0}" + local tar_cmd_2804="tar -x ${member_2796} -f ${archive_2803}" + if [ "${dump_2797}" != 0 ]; then + tar_cmd_2804="tar -x -O ${member_2796} -f ${archive_2803}" fi - local command_51 - command_51="$(${tar_cmd_2856})" + local command_59 + command_59="$(${tar_cmd_2804})" __status=$? if [ "${__status}" != 0 ]; then - local tar_status_2857="${__status}" - rm ${archive_2855} + local tar_status_2805="${__status}" + rm ${archive_2803} __status=$? - ret_untar383_v0='' - return "${tar_status_2857}" + ret_untar379_v0='' + return "${tar_status_2805}" fi - local tar_out_2858="${command_51}" - rm ${archive_2855} + local tar_out_2806="${command_59}" + rm ${archive_2803} __status=$? - if [ "${dump_2849}" != 0 ]; then - ret_untar383_v0="${tar_out_2858}" + if [ "${dump_2797}" != 0 ]; then + ret_untar379_v0="${tar_out_2806}" return 0 else - ret_untar383_v0="${member_2848}" + ret_untar379_v0="${member_2796}" return 0 fi } -get_osname__386_v0() { - local command_52 - command_52="$(uname -s)" +# get_osname() +get_osname__382_v0() { + local command_60 + command_60="$(uname -s)" __status=$? - ret_get_osname386_v0="${command_52}" + ret_get_osname382_v0="${command_60}" return 0 } -get_cache_root__391_v0() { - env_var_get__122_v0 "HOME" +# get_dll_ext() +get_dll_ext__385_v0() { + get_osname__382_v0 + local osname_2813="${ret_get_osname382_v0}" + if [ "$([ "_${osname_2813}" != "_Darwin" ]; echo $?)" != 0 ]; then + ret_get_dll_ext385_v0="dylib" + return 0 + else + ret_get_dll_ext385_v0="so" + return 0 + fi +} + +# get_cache_root() +get_cache_root__387_v0() { + env_var_get__120_v0 "HOME" __status=$? - local userhome_2834="${ret_env_var_get122_v0}" - get_osname__386_v0 - local osname_2835="${ret_get_osname386_v0}" - local result_2836="" - if [ "$([ "_${osname_2835}" != "_Darwin" ]; echo $?)" != 0 ]; then - result_2836="${userhome_2834}/Library/Caches" + local userhome_2784="${ret_env_var_get120_v0}" + get_osname__382_v0 + local osname_2785="${ret_get_osname382_v0}" + local result_2786="" + if [ "$([ "_${osname_2785}" != "_Darwin" ]; echo $?)" != 0 ]; then + result_2786="${userhome_2784}/Library/Caches" else - result_2836="${userhome_2834}/.cache" + result_2786="${userhome_2784}/.cache" fi - mkdir -p ${result_2836} + mkdir -p ${result_2786} __status=$? - ret_get_cache_root391_v0="${result_2836}" + ret_get_cache_root387_v0="${result_2786}" return 0 } -get_repo_root__392_v0() { - get_self__381_v0 - local ret_get_self381_v0__82_24="${ret_get_self381_v0}" - split__5_v0 "${ret_get_self381_v0__82_24}" "/" - local self_a_2829=("${ret_split5_v0[@]}") - array_pop__77_v0 "self_a_2829" +# get_repo_root() +get_repo_root__388_v0() { + get_self__377_v0 + local ret_get_self377_v0__80_24="${ret_get_self377_v0}" + split__4_v0 "${ret_get_self377_v0__80_24}" "/" + local self_a_2779=("${ret_split4_v0[@]}") + array_pop__74_v0 "self_a_2779" __status=$? - join__8_v0 self_a_2829[@] "/" - local ret_join8_v0__85_26="${ret_join8_v0}" - local self_dir_2830="/""${ret_join8_v0__85_26}" - local command_53 - command_53="$(git -C ${self_dir_2830} rev-parse --show-toplevel)" + join__7_v0 self_a_2779[@] "/" + local ret_join7_v0__83_26="${ret_join7_v0}" + local self_dir_2780="/""${ret_join7_v0__83_26}" + local command_61 + command_61="$(git -C ${self_dir_2780} 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_root392_v0="${self_dir_2830}" + echo_warning__137_v0 "Failed to find current Git repository, using script parent directory." + ret_get_repo_root388_v0="${self_dir_2780}" return 0 fi - ret_get_repo_root392_v0="${command_53}" + ret_get_repo_root388_v0="${command_61}" return 0 } -get_source_root__396_v0() { - get_repo_root__392_v0 - local repo_root_2831="${ret_get_repo_root392_v0}" - ret_get_source_root396_v0="${repo_root_2831}/.nixie/sources" +# get_source_root() +get_source_root__392_v0() { + get_repo_root__388_v0 + local repo_root_2781="${ret_get_repo_root388_v0}" + ret_get_source_root392_v0="${repo_root_2781}/.nixie/sources" return 0 } -cachix_url__406_v0() { - local derivation_2863="${1}" - local member_2864="${2}" - env_var_get__122_v0 "SOURCE_CACHE" - __status=$? - local __SOURCE_CACHE_2865="${ret_env_var_get122_v0}" - ret_cachix_url406_v0="https://${__SOURCE_CACHE_2865}/serve/${derivation_2863}/${member_2864}" +__SOURCE_CACHE_61="" +__SOURCE_DERIVATION_62="" +# cachix_url(derivation: Text, member: Text) +cachix_url__408_v0() { + local derivation_2811="${1}" + local member_2812="${2}" + ret_cachix_url408_v0="https://${__SOURCE_CACHE_61}/serve/${derivation_2811}/${member_2812}" return 0 } -pull_source_file__407_v0() { - local member_2843="${1}" - local dest_2844="${2}" - env_var_get__122_v0 "SOURCE_DERIVATION" - __status=$? - local __SOURCE_DERIVATION_2845="${ret_env_var_get122_v0}" - local where_2846="" - local my_status_2847=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__383_v0 "sources/${member_2843}" 0 +# pull_source_file(member: Text, dest: Text) +pull_source_file__409_v0() { + local member_2792="${1}" + local dest_2793="${2}" + local where_2794="" + local my_status_2795=1 + env_var_test__117_v0 "_NIXIE_TESTING_SKIP_TARBALL" + local ret_env_var_test117_v0__33_12="${ret_env_var_test117_v0}" + if [ "$(( ! ret_env_var_test117_v0__33_12 ))" != 0 ]; then + untar__379_v0 "sources/${member_2792}" 0 __status=$? - where_2846="${ret_untar383_v0}" - my_status_2847="${__status}" + where_2794="${ret_untar379_v0}" + my_status_2795="${__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_2847 != 0 )) ))" != 0 ]; then - env_var_get__122_v0 "_NIXIE_TESTING_SOURCES_DIR" + env_var_test__117_v0 "_NIXIE_TESTING_SOURCES_DIR" + local ret_env_var_test117_v0__38_8="${ret_env_var_test117_v0}" + if [ "$(( ret_env_var_test117_v0__38_8 && $(( my_status_2795 != 0 )) ))" != 0 ]; then + env_var_get__120_v0 "_NIXIE_TESTING_SOURCES_DIR" __status=$? - local srcdir_2859="${ret_env_var_get122_v0}" - local command_54 - command_54="$(mktemp -t -d nixie_${member_2843}_XXXXXXXX)" + local srcdir_2807="${ret_env_var_get120_v0}" + local command_62 + command_62="$(mktemp -t -d nixie_${member_2792}_XXXXXXXX)" __status=$? - local tmpd_2860="${command_54}" - file_exists__42_v0 "${srcdir_2859}/${member_2843}.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_2859}/${member_2843}.tar.gz | tar -x -C ${tmpd_2860} + local tmpd_2808="${command_62}" + file_exists__39_v0 "${srcdir_2807}/${member_2792}.tar.gz" + local ret_file_exists39_v0__42_12="${ret_file_exists39_v0}" + if [ "${ret_file_exists39_v0__42_12}" != 0 ]; then + gzip -d -c ${srcdir_2807}/${member_2792}.tar.gz | tar -x -C ${tmpd_2808} __status=$? - my_status_2847="${__status}" - where_2846="${tmpd_2860}/${member_2843}" + my_status_2795="${__status}" + where_2794="${tmpd_2808}/${member_2792}" else - my_status_2847=1 + my_status_2795=1 fi fi - if [ "$(( my_status_2847 != 0 ))" != 0 ]; then - local command_55 - command_55="$(mktemp -t nixie_src_XXXXXXXX.tgz)" + if [ "$(( my_status_2795 != 0 ))" != 0 ]; then + local command_63 + command_63="$(mktemp -t nixie_src_XXXXXXXX.tgz)" __status=$? - local tmpf_2861="${command_55}" - local command_56 - command_56="$(mktemp -t -d nixie_${member_2843}_XXXXXXXX)" + local tmpf_2809="${command_63}" + local command_64 + command_64="$(mktemp -t -d nixie_${member_2792}_XXXXXXXX)" __status=$? - local tmpd_2862="${command_56}" - cachix_url__406_v0 "${__SOURCE_DERIVATION_2845}" "${member_2843}.tar.gz" - local ret_cachix_url406_v0__58_23="${ret_cachix_url406_v0}" - file_download__326_v0 "${ret_cachix_url406_v0__58_23}" "${tmpf_2861}" + local tmpd_2810="${command_64}" + cachix_url__408_v0 "${__SOURCE_DERIVATION_62}" "${member_2792}.tar.gz" + local ret_cachix_url408_v0__55_23="${ret_cachix_url408_v0}" + file_download__324_v0 "${ret_cachix_url408_v0__55_23}" "${tmpf_2809}" __status=$? if [ "${__status}" != 0 ]; then - ret_pull_source_file407_v0='' + ret_pull_source_file409_v0='' return "${__status}" fi - gzip -d -c ${tmpf_2861} | tar -x -C ${tmpd_2862} + gzip -d -c ${tmpf_2809} | tar -x -C ${tmpd_2810} __status=$? if [ "${__status}" != 0 ]; then - ret_pull_source_file407_v0='' + ret_pull_source_file409_v0='' return "${__status}" fi - rm -f ${tmpf_2861} + rm -f ${tmpf_2809} __status=$? - where_2846="${tmpd_2862}/${member_2843}" + where_2794="${tmpd_2810}/${member_2792}" fi - rm -rf ${dest_2844} + rm -rf ${dest_2793} __status=$? - mv "${where_2846}" "${dest_2844}" + mv "${where_2794}" "${dest_2793}" __status=$? } -step_current_55=1 -pkg_exists__416_v0() { - local package_2842="${1}" - pkg-config ${package_2842} +step_total_71=1 +step_current_72=1 +# pkg_exists(package: Text) +pkg_exists__414_v0() { + local package_2791="${1}" + pkg-config ${package_2791} __status=$? if [ "${__status}" != 0 ]; then - ret_pkg_exists416_v0=0 + ret_pkg_exists414_v0=0 return 0 fi - ret_pkg_exists416_v0=1 + ret_pkg_exists414_v0=1 return 0 } -step_title__417_v0() { - local name_2838="${1}" - env_var_get__122_v0 "step_total" - __status=$? - local step_total_2839="${ret_env_var_get122_v0}" +# step_title(name: Text) +step_title__415_v0() { + local name_2788="${1}" clear __status=$? - set_title__353_v0 "Building Nix: ${name_2838} (${step_current_55}/${step_total_2839})" - step_current_55="$(( step_current_55 + 1 ))" + set_title__349_v0 "Building Nix: ${name_2788} (${step_current_72}/${step_total_71})" + step_current_72="$(( step_current_72 + 1 ))" } -get_source_root__418_v0() { - get_repo_root__392_v0 - local repo_root_2832="${ret_get_repo_root392_v0}" - ret_get_source_root418_v0="${repo_root_2832}/.nixie/sources" +# get_source_root() +get_source_root__416_v0() { + get_repo_root__388_v0 + local repo_root_2782="${ret_get_repo_root388_v0}" + ret_get_source_root416_v0="${repo_root_2782}/.nixie/sources" return 0 } -build_openssl_inner__423_v0() { - get_dll_ext__389_v0 - local dll_ext_512="${ret_get_dll_ext389_v0}" - get_cache_root__391_v0 - local cache_root_516="${ret_get_cache_root391_v0}" +# build_openssl_inner() +build_openssl_inner__420_v0() { + get_dll_ext__385_v0 + local dll_ext_2814="${ret_get_dll_ext385_v0}" + get_cache_root__387_v0 + local cache_root_2815="${ret_get_cache_root387_v0}" chmod +x ./config __status=$? ./config __status=$? if [ "${__status}" != 0 ]; then - ret_build_openssl_inner423_v0='' + ret_build_openssl_inner420_v0='' return "${__status}" fi - make_headers__422_v0 + local command_67 + command_67="$(grep ".*\.h:" ./Makefile | cut -f 1 -d :)" __status=$? - if [ "${__status}" != 0 ]; then - ret_build_openssl_inner423_v0='' - return "${__status}" - fi - make libcrypto.${dll_ext_512} libcrypto.pc + split_lines__5_v0 "${command_67}" + local ret_split_lines5_v0__25_19=("${ret_split_lines5_v0[@]}") + for header_2817 in "${ret_split_lines5_v0__25_19[@]}"; do + make ${header_2817} + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_openssl_inner420_v0='' + return "${__status}" + fi + done + local command_70 + command_70="$(grep ".*\.inc:" ./Makefile | cut -f 1 -d :)" + __status=$? + split_lines__5_v0 "${command_70}" + local ret_split_lines5_v0__28_17=("${ret_split_lines5_v0[@]}") + for hinc_2818 in "${ret_split_lines5_v0__28_17[@]}"; do + make ${hinc_2818} + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_openssl_inner420_v0='' + return "${__status}" + fi + done + make libcrypto.${dll_ext_2814} libcrypto.pc __status=$? if [ "${__status}" != 0 ]; then - ret_build_openssl_inner423_v0='' + ret_build_openssl_inner420_v0='' return "${__status}" fi - cp ./libcrypto.* ${cache_root_516}/nix-deps/lib/ + cp ./libcrypto.* ${cache_root_2815}/nix-deps/lib/ __status=$? - cp ./libcrypto.pc ${cache_root_516}/nix-deps/lib/pkgconfig + cp ./libcrypto.pc ${cache_root_2815}/nix-deps/lib/pkgconfig __status=$? - cp -r ./include ${cache_root_516}/nix-deps/ + cp -r ./include ${cache_root_2815}/nix-deps/ __status=$? } -build_openssl__424_v0() { - get_source_root__418_v0 - local source_root_2833="${ret_get_source_root418_v0}" - get_cache_root__391_v0 - step_title__417_v0 "libcrypto" - pkg_exists__416_v0 "libcrypto" - local ret_pkg_exists416_v0__56_8="${ret_pkg_exists416_v0}" - if [ "${ret_pkg_exists416_v0__56_8}" != 0 ]; then - ret_build_openssl424_v0=0 +# build_openssl() +build_openssl__421_v0() { + get_source_root__416_v0 + local source_root_2783="${ret_get_source_root416_v0}" + get_cache_root__387_v0 + step_title__415_v0 "libcrypto" + pkg_exists__414_v0 "libcrypto" + local ret_pkg_exists414_v0__53_8="${ret_pkg_exists414_v0}" + if [ "${ret_pkg_exists414_v0__53_8}" != 0 ]; then + ret_build_openssl421_v0=0 return 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_openssl424_v0=0 + env_var_test__117_v0 "OPENSSL_LIBS" + local ret_env_var_test117_v0__55_8="${ret_env_var_test117_v0}" + env_var_test__117_v0 "OPENSSL_CFLAGS" + local ret_env_var_test117_v0__55_41="${ret_env_var_test117_v0}" + if [ "$(( ret_env_var_test117_v0__55_8 && ret_env_var_test117_v0__55_41 ))" != 0 ]; then + ret_build_openssl421_v0=0 return 0 fi - pull_source_file__407_v0 "openssl" "${source_root_2833}/openssl" + pull_source_file__409_v0 "openssl" "${source_root_2783}/openssl" __status=$? if [ "${__status}" != 0 ]; then - ret_build_openssl424_v0='' + ret_build_openssl421_v0='' return "${__status}" fi - (cd ${source_root_2833}/openssl && build_openssl_inner__423_v0) + (cd ${source_root_2783}/openssl && build_openssl_inner__420_v0) __status=$? if [ "${__status}" != 0 ]; then - ret_build_openssl424_v0='' + ret_build_openssl421_v0='' return "${__status}" fi } -build_lowdown_inner__434_v0() { - get_cache_root__391_v0 - local cache_root_776="${ret_get_cache_root391_v0}" - ./configure PREFIX=${cache_root_776}/nix-deps +# macos_build_post() +macos_build_post__430_v0() { + cc -shared -o liblowdown.1.dylib *.o __status=$? if [ "${__status}" != 0 ]; then - ret_build_lowdown_inner434_v0='' + ret_macos_build_post430_v0='' + return "${__status}" + fi +} + +# build_lowdown_inner() +build_lowdown_inner__431_v0() { + get_cache_root__387_v0 + local cache_root_2832="${ret_get_cache_root387_v0}" + ./configure PREFIX=${cache_root_2832}/nix-deps + __status=$? + if [ "${__status}" != 0 ]; then + ret_build_lowdown_inner431_v0='' return "${__status}" fi make __status=$? if [ "${__status}" != 0 ]; then - ret_build_lowdown_inner434_v0='' + ret_build_lowdown_inner431_v0='' return "${__status}" fi - get_osname__386_v0 - local ret_get_osname386_v0__26_8="${ret_get_osname386_v0}" - if [ "$([ "_${ret_get_osname386_v0__26_8}" != "_Darwin" ]; echo $?)" != 0 ]; then - macos_build_post__433_v0 + get_osname__382_v0 + local ret_get_osname382_v0__26_8="${ret_get_osname382_v0}" + if [ "$([ "_${ret_get_osname382_v0__26_8}" != "_Darwin" ]; echo $?)" != 0 ]; then + macos_build_post__430_v0 __status=$? if [ "${__status}" != 0 ]; then - ret_build_lowdown_inner434_v0='' + ret_build_lowdown_inner431_v0='' return "${__status}" fi fi make install_shared __status=$? if [ "${__status}" != 0 ]; then - ret_build_lowdown_inner434_v0='' + ret_build_lowdown_inner431_v0='' return "${__status}" fi } -build_lowdown__435_v0() { - get_source_root__418_v0 - local source_root_2875="${ret_get_source_root418_v0}" - get_cache_root__391_v0 - step_title__417_v0 "lowdown" - pkg_exists__416_v0 "lowdown" - local ret_pkg_exists416_v0__41_8="${ret_pkg_exists416_v0}" - if [ "${ret_pkg_exists416_v0__41_8}" != 0 ]; then - ret_build_lowdown435_v0=0 +# build_lowdown() +build_lowdown__432_v0() { + get_source_root__416_v0 + local source_root_2830="${ret_get_source_root416_v0}" + get_cache_root__387_v0 + step_title__415_v0 "lowdown" + pkg_exists__414_v0 "lowdown" + local ret_pkg_exists414_v0__41_8="${ret_pkg_exists414_v0}" + if [ "${ret_pkg_exists414_v0__41_8}" != 0 ]; then + ret_build_lowdown432_v0=0 return 0 fi - pull_source_file__407_v0 "lowdown" "${source_root_2875}/lowdown" + pull_source_file__409_v0 "lowdown" "${source_root_2830}/lowdown" __status=$? if [ "${__status}" != 0 ]; then - ret_build_lowdown435_v0='' + ret_build_lowdown432_v0='' return "${__status}" fi - (cd ${source_root_2875}/lowdown && build_lowdown_inner__434_v0) + (cd ${source_root_2830}/lowdown && build_lowdown_inner__431_v0) __status=$? if [ "${__status}" != 0 ]; then - ret_build_lowdown435_v0='' + ret_build_lowdown432_v0='' return "${__status}" fi } -build_nlohmann_json__444_v0() { - get_source_root__418_v0 - local source_root_2870="${ret_get_source_root418_v0}" - get_cache_root__391_v0 - local cache_root_2871="${ret_get_cache_root391_v0}" - step_title__417_v0 "nlohmann_json" - pkg_exists__416_v0 "nlohmann_json" - local ret_pkg_exists416_v0__21_8="${ret_pkg_exists416_v0}" - if [ "${ret_pkg_exists416_v0__21_8}" != 0 ]; then - ret_build_nlohmann_json444_v0=0 +# build_nlohmann_json() +build_nlohmann_json__441_v0() { + get_source_root__416_v0 + local source_root_2825="${ret_get_source_root416_v0}" + get_cache_root__387_v0 + local cache_root_2826="${ret_get_cache_root387_v0}" + step_title__415_v0 "nlohmann_json" + pkg_exists__414_v0 "nlohmann_json" + local ret_pkg_exists414_v0__21_8="${ret_pkg_exists414_v0}" + if [ "${ret_pkg_exists414_v0__21_8}" != 0 ]; then + ret_build_nlohmann_json441_v0=0 return 0 fi - pull_source_file__407_v0 "nlohmann_json" "${source_root_2870}/nlohmann_json" + pull_source_file__409_v0 "nlohmann_json" "${source_root_2825}/nlohmann_json" __status=$? if [ "${__status}" != 0 ]; then - ret_build_nlohmann_json444_v0='' + ret_build_nlohmann_json441_v0='' return "${__status}" fi - local command_57 - command_57="$(grep "^version:" ${source_root_2870}/nlohmann_json/wsjcpp.yml | cut -d '"' -f 2 | cut -d 'v' -f 2)" + local command_71 + command_71="$(grep "^version:" ${source_root_2825}/nlohmann_json/wsjcpp.yml | cut -d '"' -f 2 | cut -d 'v' -f 2)" __status=$? - local version_2872="${command_57}" - file_write__44_v0 "${cache_root_2871}/nix-deps/lib/pkgconfig/nlohmann_json.pc" "Name: nlohmann_json -Version: ${version_2872} + local version_2827="${command_71}" + file_write__41_v0 "${cache_root_2826}/nix-deps/lib/pkgconfig/nlohmann_json.pc" "Name: nlohmann_json +Version: ${version_2827} Description: JSON for Modern C++ -Cflags: -I${source_root_2870}/nlohmann_json/include" +Cflags: -I${source_root_2825}/nlohmann_json/include" __status=$? if [ "${__status}" != 0 ]; then - ret_build_nlohmann_json444_v0='' + ret_build_nlohmann_json441_v0='' return "${__status}" fi } -modules_56=("predef" "chrono" "container" "context" "coroutine" "system" "thread") -find_boost_libs__453_v0() { - local libs_2867=("${!1}") - for lib_2868 in "${libs_2867[@]}"; do - local libname_2869="libboost_${lib_2868}*" - file_exists__42_v0 "/usr/lib/${libname_2869}" - local ret_file_exists42_v0__23_20="${ret_file_exists42_v0}" - file_exists__42_v0 "/usr/local/lib/${libname_2869}" - 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_libs453_v0=0 +modules_73=("predef" "chrono" "container" "context" "coroutine" "system" "thread") +# find_boost_libs(libs: [Text]) +find_boost_libs__450_v0() { + local libs_2820=("${!1}") + for lib_2821 in "${libs_2820[@]}"; do + local libname_2822="libboost_${lib_2821}*" + file_exists__39_v0 "/usr/lib/${libname_2822}" + local ret_file_exists39_v0__23_20="${ret_file_exists39_v0}" + file_exists__39_v0 "/usr/local/lib/${libname_2822}" + local ret_file_exists39_v0__24_20="${ret_file_exists39_v0}" + if [ "$(( ! $(( ret_file_exists39_v0__23_20 || ret_file_exists39_v0__24_20 )) ))" != 0 ]; then + ret_find_boost_libs450_v0=0 return 0 fi - dir_exists__41_v0 "/usr/include/boost/${lib_2868}" - local ret_dir_exists41_v0__26_20="${ret_dir_exists41_v0}" - dir_exists__41_v0 "/usr/local/include/boost/${lib_2868}" - 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_libs453_v0=0 + dir_exists__38_v0 "/usr/include/boost/${lib_2821}" + local ret_dir_exists38_v0__26_20="${ret_dir_exists38_v0}" + dir_exists__38_v0 "/usr/local/include/boost/${lib_2821}" + local ret_dir_exists38_v0__27_20="${ret_dir_exists38_v0}" + if [ "$(( ! $(( ret_dir_exists38_v0__26_20 || ret_dir_exists38_v0__27_20 )) ))" != 0 ]; then + ret_find_boost_libs450_v0=0 return 0 fi done - ret_find_boost_libs453_v0=1 + ret_find_boost_libs450_v0=1 return 0 } -build_boost_inner__454_v0() { - local args_605=("variant=release" "link=static" "--stagedir=.") - for mod_606 in "${modules_56[@]}"; do - args_605+=("--with-${mod_606}") +# build_boost_inner() +build_boost_inner__451_v0() { + local args_2823=("variant=release" "link=static" "--stagedir=.") + for mod_2824 in "${modules_73[@]}"; do + args_2823+=("--with-${mod_2824}") done ./bootstrap.sh __status=$? if [ "${__status}" != 0 ]; then - ret_build_boost_inner454_v0='' + ret_build_boost_inner451_v0='' return "${__status}" fi - ./b2 "${args_605[@]}" + ./b2 "${args_2823[@]}" __status=$? if [ "${__status}" != 0 ]; then - ret_build_boost_inner454_v0='' + ret_build_boost_inner451_v0='' return "${__status}" fi } -build_boost__455_v0() { - get_source_root__418_v0 - local source_root_2866="${ret_get_source_root418_v0}" - step_title__417_v0 "boost" - local array_61=("atomic") - local array_add_62=("${array_61[@]}" "${modules_56[@]}") - find_boost_libs__453_v0 array_add_62[@] - local ret_find_boost_libs453_v0__56_8="${ret_find_boost_libs453_v0}" - if [ "${ret_find_boost_libs453_v0__56_8}" != 0 ]; then - ret_build_boost455_v0=0 +# build_boost() +build_boost__452_v0() { + get_source_root__416_v0 + local source_root_2819="${ret_get_source_root416_v0}" + step_title__415_v0 "boost" + local array_79=("atomic") + local array_add_80=("${array_79[@]}" "${modules_73[@]}") + find_boost_libs__450_v0 array_add_80[@] + local ret_find_boost_libs450_v0__56_8="${ret_find_boost_libs450_v0}" + if [ "${ret_find_boost_libs450_v0__56_8}" != 0 ]; then + ret_build_boost452_v0=0 return 0 fi - pull_source_file__407_v0 "boost" "${source_root_2866}/boost" + pull_source_file__409_v0 "boost" "${source_root_2819}/boost" __status=$? if [ "${__status}" != 0 ]; then - ret_build_boost455_v0='' + ret_build_boost452_v0='' return "${__status}" fi - (cd ${source_root_2866}/boost && build_boost_inner__454_v0) + (cd ${source_root_2819}/boost && build_boost_inner__451_v0) __status=$? if [ "${__status}" != 0 ]; then - ret_build_boost455_v0='' + ret_build_boost452_v0='' return "${__status}" fi - env_var_set__121_v0 "BOOST_ROOT" "${source_root_2866}/boost" + env_var_set__119_v0 "BOOST_ROOT" "${source_root_2819}/boost" __status=$? export BOOST_ROOT __status=$? } -build_autoconf_dep__463_v0() { - local lib_name_2877="${1}" - local inc_prefix_2878="${2}" - get_source_root__418_v0 - local source_root_2879="${ret_get_source_root418_v0}" - get_cache_root__391_v0 - local cache_root_2880="${ret_get_cache_root391_v0}" - local my_source_2881="${source_root_2879}/${lib_name_2877}" - step_title__417_v0 "${lib_name_2877}" - pkg_exists__416_v0 "${lib_name_2877}" - local ret_pkg_exists416_v0__26_8="${ret_pkg_exists416_v0}" - if [ "${ret_pkg_exists416_v0__26_8}" != 0 ]; then - ret_build_autoconf_dep463_v0='' +# build_autoconf_dep(lib_name: Text, inc_prefix: Text) +build_autoconf_dep__460_v0() { + local lib_name_2833="${1}" + local inc_prefix_2834="${2}" + get_source_root__416_v0 + local source_root_2835="${ret_get_source_root416_v0}" + get_cache_root__387_v0 + local cache_root_2836="${ret_get_cache_root387_v0}" + local my_source_2837="${source_root_2835}/${lib_name_2833}" + step_title__415_v0 "${lib_name_2833}" + pkg_exists__414_v0 "${lib_name_2833}" + local ret_pkg_exists414_v0__26_8="${ret_pkg_exists414_v0}" + if [ "${ret_pkg_exists414_v0__26_8}" != 0 ]; then + ret_build_autoconf_dep460_v0='' return 0 fi - pull_source_file__407_v0 "${lib_name_2877}" "${my_source_2881}" + pull_source_file__409_v0 "${lib_name_2833}" "${my_source_2837}" __status=$? if [ "${__status}" != 0 ]; then - ret_build_autoconf_dep463_v0='' + ret_build_autoconf_dep460_v0='' return "${__status}" fi - ( unset C_INCLUDE_PATH CPLUS_INCLUDE_PATH && cd ${my_source_2881} && ./configure --prefix=${cache_root_2880}/nix-deps && make && make install ) + ( unset C_INCLUDE_PATH CPLUS_INCLUDE_PATH && cd ${my_source_2837} && ./configure --prefix=${cache_root_2836}/nix-deps && make && make install ) __status=$? if [ "${__status}" != 0 ]; then - ret_build_autoconf_dep463_v0='' + ret_build_autoconf_dep460_v0='' return "${__status}" fi } -build_nix_inner__473_v0() { - get_source_root__418_v0 - local source_root_1075="${ret_get_source_root418_v0}" - local venv_1076="${source_root_1075}/nix/venv" +# build_nix_inner() +build_nix_inner__470_v0() { + get_source_root__416_v0 + local source_root_2841="${ret_get_source_root416_v0}" + local venv_2842="${source_root_2841}/nix/venv" mkdir build && cd build __status=$? if [ "${__status}" != 0 ]; then - ret_build_nix_inner473_v0='' + ret_build_nix_inner470_v0='' return "${__status}" fi - ${venv_1076}/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 .. + ${venv_2842}/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_inner473_v0='' + ret_build_nix_inner470_v0='' return "${__status}" fi - ${venv_1076}/bin/ninja + ${venv_2842}/bin/ninja __status=$? if [ "${__status}" != 0 ]; then - ret_build_nix_inner473_v0='' + ret_build_nix_inner470_v0='' return "${__status}" fi } -build_nix__474_v0() { - get_source_root__418_v0 - local source_root_2882="${ret_get_source_root418_v0}" - get_cache_root__391_v0 - local cache_root_2883="${ret_get_cache_root391_v0}" - local venv_2884="${source_root_2882}/nix/venv" - step_title__417_v0 "nix" - pull_source_file__407_v0 "nix" "${source_root_2882}/nix" +# build_nix() +build_nix__471_v0() { + get_source_root__416_v0 + local source_root_2838="${ret_get_source_root416_v0}" + get_cache_root__387_v0 + local cache_root_2839="${ret_get_cache_root387_v0}" + local venv_2840="${source_root_2838}/nix/venv" + step_title__415_v0 "nix" + pull_source_file__409_v0 "nix" "${source_root_2838}/nix" __status=$? if [ "${__status}" != 0 ]; then - ret_build_nix474_v0='' + ret_build_nix471_v0='' return "${__status}" fi - python3 -m venv --system-site-packages "${venv_2884}" + python3 -m venv --system-site-packages "${venv_2840}" __status=$? if [ "${__status}" != 0 ]; then - ret_build_nix474_v0='' + ret_build_nix471_v0='' return "${__status}" fi - export LIBRARY_PATH=${cache_root_2883}/nix-deps/lib:$LIBRARY_PATH + export LIBRARY_PATH=${cache_root_2839}/nix-deps/lib:$LIBRARY_PATH __status=$? - export PKG_CONFIG_PATH=${cache_root_2883}/nix-deps/lib/pkgconfig:${cache_root_2883}/nix-deps/share/pkgconfig:$PKG_CONFIG_PATH + export PKG_CONFIG_PATH=${cache_root_2839}/nix-deps/lib/pkgconfig:${cache_root_2839}/nix-deps/share/pkgconfig:$PKG_CONFIG_PATH __status=$? - ${venv_2884}/bin/pip install meson ninja + ${venv_2840}/bin/pip install meson ninja __status=$? if [ "${__status}" != 0 ]; then - ret_build_nix474_v0='' + ret_build_nix471_v0='' return "${__status}" fi - (cd ${source_root_2882}/nix && build_nix_inner__473_v0) + (cd ${source_root_2838}/nix && build_nix_inner__470_v0) __status=$? if [ "${__status}" != 0 ]; then - ret_build_nix474_v0='' + ret_build_nix471_v0='' return "${__status}" fi - mv "${source_root_2882}/nix/src/nix/nix" "${cache_root_2883}/nix-static" + mv "${source_root_2838}/nix/src/nix/nix" "${cache_root_2839}/nix-static" __status=$? } -darwin_export_sdk__476_v0() { - local command_63 - command_63="$(xcrun --show-sdk-path)" +# darwin_export_sdk() +darwin_export_sdk__473_v0() { + local command_81 + command_81="$(xcrun --show-sdk-path)" __status=$? - local sdk_path_2826="${command_63}" - dir_exists__41_v0 "${sdk_path_2826}" - 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 + local sdk_path_2776="${command_81}" + dir_exists__38_v0 "${sdk_path_2776}" + local ret_dir_exists38_v0__30_12="${ret_dir_exists38_v0}" + if [ "$(( ! ret_dir_exists38_v0__30_12 ))" != 0 ]; then + bail__177_v0 "The macOS SDK from Xcode or CommandLineTools is required to build Nix." 0 fi - local sdk_libs_2827="${sdk_path_2826}/usr/lib" - local sdk_cflags_2828="-I${sdk_path_2826}/usr/include" - env_var_set__121_v0 "LIBCURL_LIBS" "${sdk_libs_2827}" + local sdk_libs_2777="${sdk_path_2776}/usr/lib" + local sdk_cflags_2778="-I${sdk_path_2776}/usr/include" + env_var_set__119_v0 "LIBCURL_LIBS" "${sdk_libs_2777}" __status=$? - env_var_set__121_v0 "LIBCURL_CFLAGS" "${sdk_cflags_2828}" + env_var_set__119_v0 "LIBCURL_CFLAGS" "${sdk_cflags_2778}" __status=$? - env_var_set__121_v0 "LIBARCHIVE_LIBS" "${sdk_libs_2827}" + env_var_set__119_v0 "LIBARCHIVE_LIBS" "${sdk_libs_2777}" __status=$? - env_var_set__121_v0 "LIBARCHIVE_CFLAGS" "${sdk_cflags_2828}" + env_var_set__119_v0 "LIBARCHIVE_CFLAGS" "${sdk_cflags_2778}" __status=$? - env_var_set__121_v0 "OPENSSL_LIBS" "${sdk_libs_2827}" + env_var_set__119_v0 "OPENSSL_LIBS" "${sdk_libs_2777}" __status=$? - env_var_set__121_v0 "OPENSSL_CFLAGS" "${sdk_cflags_2828}" + env_var_set__119_v0 "OPENSSL_CFLAGS" "${sdk_cflags_2778}" __status=$? export LIBCURL_LIBS LIBCURL_CFLAGS LIBARCHIVE_LIBS LIBARCHIVE_CFLAGS OPENSSL_LIBS OPENSSL_CFLAGS __status=$? } -try_build_nix__477_v0() { - get_cache_root__200_v0 - local cache_root_2825="${ret_get_cache_root200_v0}" - local array_64=("cc" "c++" "pkg-config" "make" "flex" "bison" "perl") - check_deps__185_v0 array_64[@] +# try_build_nix() +try_build_nix__474_v0() { + get_cache_root__195_v0 + local cache_root_2775="${ret_get_cache_root195_v0}" + local array_82=("cc" "c++" "pkg-config" "make" "flex" "bison" "perl") + check_deps__181_v0 array_82[@] __status=$? if [ "${__status}" != 0 ]; then - bail__181_v0 "Missing required dependencies to build from source." 0 + bail__177_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__476_v0 + get_osname__190_v0 + local ret_get_osname190_v0__62_8="${ret_get_osname190_v0}" + if [ "$([ "_${ret_get_osname190_v0__62_8}" != "_Darwin" ]; echo $?)" != 0 ]; then + darwin_export_sdk__473_v0 fi - env_var_set__121_v0 "step_total" "9" - __status=$? - get_source_root__396_v0 - local ret_get_source_root396_v0__65_22="${ret_get_source_root396_v0}" - dir_create__47_v0 "${ret_get_source_root396_v0__65_22}" + get_source_root__392_v0 + local ret_get_source_root392_v0__65_22="${ret_get_source_root392_v0}" + dir_create__44_v0 "${ret_get_source_root392_v0__65_22}" __status=$? - dir_create__47_v0 "${cache_root_2825}/nix-deps/lib/pkgconfig" + dir_create__44_v0 "${cache_root_2775}/nix-deps/lib/pkgconfig" __status=$? - build_openssl__424_v0 + build_openssl__421_v0 __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi - build_boost__455_v0 + build_boost__452_v0 __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi - build_nlohmann_json__444_v0 + build_nlohmann_json__441_v0 __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi - build_lowdown__435_v0 + build_lowdown__432_v0 __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi - build_autoconf_dep__463_v0 "libbrotlicommon" "c/include" + build_autoconf_dep__460_v0 "libbrotlicommon" "c/include" __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi - build_autoconf_dep__463_v0 "libsodium" "src/libsodium/include" + build_autoconf_dep__460_v0 "libsodium" "src/libsodium/include" __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi - build_autoconf_dep__463_v0 "libeditline" "include" + build_autoconf_dep__460_v0 "libeditline" "include" __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi - build_autoconf_dep__463_v0 "libarchive" "libarchive" + build_autoconf_dep__460_v0 "libarchive" "libarchive" __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi - build_nix__474_v0 + build_nix__471_v0 __status=$? if [ "${__status}" != 0 ]; then - ret_try_build_nix477_v0='' + ret_try_build_nix474_v0='' return "${__status}" fi } -is_nix_installed__479_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_installed479_v0=0 +# is_nix_installed() +is_nix_installed__476_v0() { + env_var_test__117_v0 "nosystem" + local ret_env_var_test117_v0__26_8="${ret_env_var_test117_v0}" + if [ "${ret_env_var_test117_v0__26_8}" != 0 ]; then + ret_is_nix_installed476_v0=0 return 0 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_installed479_v0=1 + dir_exists__38_v0 "/nix/store" + local ret_dir_exists38_v0__31_8="${ret_dir_exists38_v0}" + if [ "${ret_dir_exists38_v0__31_8}" != 0 ]; then + ret_is_nix_installed476_v0=1 return 0 fi - ret_is_nix_installed479_v0=0 + ret_is_nix_installed476_v0=0 return 0 } -get_nix__480_v0() { - get_cache_root__200_v0 - local cache_root_2807="${ret_get_cache_root200_v0}" - get_osname__195_v0 - local osname_2808="${ret_get_osname195_v0}" - get_system__197_v0 - local system_2812="${ret_get_system197_v0}" - local nix_path_2813="${cache_root_2807}/nix-static" - local fakedir_path_2814="${cache_root_2807}/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_2814}" - local ret_file_exists42_v0__58_35="${ret_file_exists42_v0}" - if [ "$(( $([ "_${osname_2808}" != "_Darwin" ]; echo $?) && $(( ! ret_file_exists42_v0__58_35 )) ))" != 0 ]; then - dir_create__47_v0 "${cache_root_2807}/nix-deps/lib" +# get_nix() +get_nix__477_v0() { + get_cache_root__195_v0 + local cache_root_2759="${ret_get_cache_root195_v0}" + get_osname__190_v0 + local osname_2760="${ret_get_osname190_v0}" + get_system__192_v0 + local system_2763="${ret_get_system192_v0}" + local nix_path_2764="${cache_root_2759}/nix-static" + local fakedir_path_2765="${cache_root_2759}/nix-deps/lib/libfakedir.dylib" + enter_alt_buffer__171_v0 + set_title__170_v0 "Building Nix..." + trap "teardown__173_v0; exit 1" SIGKILL SIGTERM SIGINT SIGABRT + __status=$? + file_exists__39_v0 "${fakedir_path_2765}" + local ret_file_exists39_v0__60_35="${ret_file_exists39_v0}" + if [ "$(( $([ "_${osname_2760}" != "_Darwin" ]; echo $?) && $(( ! ret_file_exists39_v0__60_35 )) ))" != 0 ]; then + dir_create__44_v0 "${cache_root_2759}/nix-deps/lib" __status=$? - pull_binary__335_v0 "libfakedir.dylib" "${fakedir_path_2814}" + pull_binary__333_v0 "libfakedir.dylib" "${fakedir_path_2765}" __status=$? if [ "${__status}" != 0 ]; then - teardown__177_v0 1 - ret_get_nix480_v0='' + teardown__173_v0 1 + ret_get_nix477_v0='' return 1 fi fi - get_self__182_v0 - local ret_get_self182_v0__67_62="${ret_get_self182_v0}" - exists_newer__180_v0 "${fakedir_path_2814}" "${ret_get_self182_v0__67_62}" - local ret_exists_newer180_v0__67_35="${ret_exists_newer180_v0}" - if [ "$(( $([ "_${osname_2808}" != "_Darwin" ]; echo $?) && $(( ! ret_exists_newer180_v0__67_35 )) ))" != 0 ]; then - pull_binary__335_v0 "libfakedir.dylib" "${fakedir_path_2814}" + get_self__178_v0 + local ret_get_self178_v0__69_62="${ret_get_self178_v0}" + exists_newer__176_v0 "${fakedir_path_2765}" "${ret_get_self178_v0__69_62}" + local ret_exists_newer176_v0__69_35="${ret_exists_newer176_v0}" + if [ "$(( $([ "_${osname_2760}" != "_Darwin" ]; echo $?) && $(( ! ret_exists_newer176_v0__69_35 )) ))" != 0 ]; then + pull_binary__333_v0 "libfakedir.dylib" "${fakedir_path_2765}" __status=$? fi - file_exists__42_v0 "${nix_path_2813}" - 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_nix480_v0=0 + file_exists__39_v0 "${nix_path_2764}" + local ret_file_exists39_v0__73_8="${ret_file_exists39_v0}" + if [ "${ret_file_exists39_v0__73_8}" != 0 ]; then + teardown__173_v0 0 + ret_get_nix477_v0=0 return 0 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__477_v0 + env_var_test__117_v0 "nobins" + local ret_env_var_test117_v0__78_8="${ret_env_var_test117_v0}" + if [ "${ret_env_var_test117_v0__78_8}" != 0 ]; then + try_build_nix__474_v0 __status=$? if [ "${__status}" != 0 ]; then - teardown__177_v0 1 - ret_get_nix480_v0='' + teardown__173_v0 1 + ret_get_nix477_v0='' return 1 fi fi - pull_binary__335_v0 "nix.${system_2812}" "${nix_path_2813}" + pull_binary__333_v0 "nix.${system_2763}" "${nix_path_2764}" __status=$? if [ "${__status}" != 0 ]; then - try_build_nix__477_v0 + try_build_nix__474_v0 __status=$? if [ "${__status}" != 0 ]; then - teardown__177_v0 1 - ret_get_nix480_v0='' + teardown__173_v0 1 + ret_get_nix477_v0='' return 1 fi fi - chmod +x ${nix_path_2813} + chmod +x ${nix_path_2764} __status=$? - teardown__177_v0 0 - ret_get_nix480_v0=0 + teardown__173_v0 0 + ret_get_nix477_v0=0 return 0 } -migrate_nix_store__481_v0() { - get_nix_root__199_v0 - local ret_get_nix_root199_v0__105_36="${ret_get_nix_root199_v0}" - local command_65 - command_65="$(readlink -f ${ret_get_nix_root199_v0__105_36})" +# migrate_nix_store() +migrate_nix_store__478_v0() { + get_nix_root__194_v0 + local ret_get_nix_root194_v0__107_36="${ret_get_nix_root194_v0}" + local command_83 + command_83="$(readlink -f ${ret_get_nix_root194_v0__107_36})" __status=$? - nix_root_2806="${command_65}" + nix_root_2758="${command_83}" if [ "$(( __status != 0 ))" != 0 ]; then - get_nix_root__199_v0 - nix_root_2806="${ret_get_nix_root199_v0}" + get_nix_root__194_v0 + nix_root_2758="${ret_get_nix_root194_v0}" fi - dir_exists__41_v0 "${nix_root_2806}/nix/store" - local ret_dir_exists41_v0__110_12="${ret_dir_exists41_v0}" - if [ "$(( ! ret_dir_exists41_v0__110_12 ))" != 0 ]; then - ret_migrate_nix_store481_v0=0 + dir_exists__38_v0 "${nix_root_2758}/nix/store" + local ret_dir_exists38_v0__112_12="${ret_dir_exists38_v0}" + if [ "$(( ! ret_dir_exists38_v0__112_12 ))" != 0 ]; then + ret_migrate_nix_store478_v0=0 return 0 fi >&2 echo "Migrating Nix store to system-wide install..." __status=$? - nix --extra-experimental-features nix-command copy --from ${nix_root_2806} --all --no-check-sigs + nix --extra-experimental-features nix-command copy --from ${nix_root_2758} --all --no-check-sigs __status=$? if [ "$(( __status == 0 ))" != 0 ]; then - chmod -R +wx ${nix_root_2806} && rm -rf ${nix_root_2806} + chmod -R +wx ${nix_root_2758} && rm -rf ${nix_root_2758} __status=$? fi } -unpack_channels__482_v0() { - get_repo_root__201_v0 - local repo_root_2799="${ret_get_repo_root201_v0}" - get_self__182_v0 - local ret_get_self182_v0__126_52="${ret_get_self182_v0}" - exists_newer__180_v0 "${repo_root_2799}/.nixie/channels" "${ret_get_self182_v0__126_52}" - local ret_exists_newer180_v0__126_8="${ret_exists_newer180_v0}" - if [ "${ret_exists_newer180_v0__126_8}" != 0 ]; then - env_var_get__122_v0 "NIX_PATH" +# unpack_channels() +unpack_channels__479_v0() { + get_repo_root__196_v0 + local repo_root_2751="${ret_get_repo_root196_v0}" + get_self__178_v0 + local ret_get_self178_v0__128_52="${ret_get_self178_v0}" + exists_newer__176_v0 "${repo_root_2751}/.nixie/channels" "${ret_get_self178_v0__128_52}" + local ret_exists_newer176_v0__128_8="${ret_exists_newer176_v0}" + if [ "${ret_exists_newer176_v0__128_8}" != 0 ]; then + env_var_get__120_v0 "NIX_PATH" __status=$? - local __NIX_PATH_2805="${ret_env_var_get122_v0}" - env_var_set__121_v0 "NIX_PATH" "${repo_root_2799}/.nixie/channels:${__NIX_PATH_2805}" + local __NIX_PATH_2757="${ret_env_var_get120_v0}" + env_var_set__119_v0 "NIX_PATH" "${repo_root_2751}/.nixie/channels:${__NIX_PATH_2757}" __status=$? export NIX_PATH __status=$? - ret_unpack_channels482_v0=0 + ret_unpack_channels479_v0=0 return 0 fi echo "Unpacking Nix channels, hang tight..." - dir_create__47_v0 "${repo_root_2799}/.nixie" + dir_create__44_v0 "${repo_root_2751}/.nixie" __status=$? - untar__184_v0 "channels -C ${repo_root_2799}/.nixie" 0 + untar__180_v0 "channels -C ${repo_root_2751}/.nixie" 0 __status=$? if [ "${__status}" != 0 ]; then - mkdir ${repo_root_2799}/.nixie/channels + mkdir ${repo_root_2751}/.nixie/channels __status=$? fi } -populate_extras__483_v0() { - local args_2789=() - env_var_get__122_v0 "EXTRA_FEATURES" - __status=$? - local __EXTRA_FEATURES_2790="${ret_env_var_get122_v0}" - env_var_get__122_v0 "EXTRA_SUBSTITUTERS" - __status=$? - local __EXTRA_SUBSTITUTERS_2791="${ret_env_var_get122_v0}" - env_var_get__122_v0 "EXTRA_TRUSTED_PUBLIC_KEYS" - __status=$? - local __EXTRA_TRUSTED_PUBLIC_KEYS_2792="${ret_env_var_get122_v0}" - get_nix_root__199_v0 - local nix_root_2793="${ret_get_nix_root199_v0}" - if [ "$([ "_${__EXTRA_FEATURES_2790}" == "_" ]; echo $?)" != 0 ]; then - args_2789+=("--extra-experimental-features" "${__EXTRA_FEATURES_2790}") +# populate_extras() +populate_extras__480_v0() { + local args_2744=() + get_nix_root__194_v0 + local nix_root_2745="${ret_get_nix_root194_v0}" + if [ "$([ "_${__EXTRA_FEATURES_36}" == "_" ]; echo $?)" != 0 ]; then + args_2744+=("--extra-experimental-features" "${__EXTRA_FEATURES_36}") fi - if [ "$([ "_${__EXTRA_SUBSTITUTERS_2791}" == "_" ]; echo $?)" != 0 ]; then - args_2789+=("--extra-substituters" "${__EXTRA_SUBSTITUTERS_2791}") + if [ "$([ "_${__EXTRA_SUBSTITUTERS_37}" == "_" ]; echo $?)" != 0 ]; then + args_2744+=("--extra-substituters" "${__EXTRA_SUBSTITUTERS_37}") fi - if [ "$([ "_${__EXTRA_TRUSTED_PUBLIC_KEYS_2792}" == "_" ]; echo $?)" != 0 ]; then - args_2789+=("--extra-trusted-public-keys" "${__EXTRA_TRUSTED_PUBLIC_KEYS_2792}") + if [ "$([ "_${__EXTRA_TRUSTED_PUBLIC_KEYS_38}" == "_" ]; echo $?)" != 0 ]; then + args_2744+=("--extra-trusted-public-keys" "${__EXTRA_TRUSTED_PUBLIC_KEYS_38}") fi - get_osname__195_v0 - local ret_get_osname195_v0__162_8="${ret_get_osname195_v0}" - is_nix_installed__479_v0 - local ret_is_nix_installed479_v0__162_41="${ret_is_nix_installed479_v0}" - if [ "$(( $([ "_${ret_get_osname195_v0__162_8}" == "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed479_v0__162_41 )) ))" != 0 ]; then - local command_71 - command_71="$(readlink -f ${nix_root_2793})" + get_osname__190_v0 + local ret_get_osname190_v0__160_8="${ret_get_osname190_v0}" + is_nix_installed__476_v0 + local ret_is_nix_installed476_v0__160_41="${ret_is_nix_installed476_v0}" + if [ "$(( $([ "_${ret_get_osname190_v0__160_8}" == "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed476_v0__160_41 )) ))" != 0 ]; then + local command_89 + command_89="$(readlink -f ${nix_root_2745})" __status=$? - args_2789+=("--store" "${command_71}") + args_2744+=("--store" "${command_89}") fi - ret_populate_extras483_v0=("${args_2789[@]}") + ret_populate_extras480_v0=("${args_2744[@]}") return 0 } -launch_darwin_workaround__484_v0() { - local name_2899="${1}" - local nix_path_2900="${2}" - local args_2901=("${!3}") - get_cache_root__200_v0 - local cache_root_2902="${ret_get_cache_root200_v0}" - get_nix_root__199_v0 - local nix_root_2903="${ret_get_nix_root199_v0}" - local fakedir_path_2904="${cache_root_2902}/nix-deps/lib/libfakedir.dylib" - env_var_set__121_v0 "FAKEDIR_PATTERN" "/nix" +# launch_darwin_workaround(name: Text, nix_path: Text, args: [Text]) +launch_darwin_workaround__481_v0() { + local name_2857="${1}" + local nix_path_2858="${2}" + local args_2859=("${!3}") + get_cache_root__195_v0 + local cache_root_2860="${ret_get_cache_root195_v0}" + get_nix_root__194_v0 + local nix_root_2861="${ret_get_nix_root194_v0}" + local fakedir_path_2862="${cache_root_2860}/nix-deps/lib/libfakedir.dylib" + env_var_set__119_v0 "FAKEDIR_PATTERN" "/nix" __status=$? - env_var_set__121_v0 "FAKEDIR_TARGET" "${nix_root_2903}/nix" + env_var_set__119_v0 "FAKEDIR_TARGET" "${nix_root_2861}/nix" __status=$? export FAKEDIR_PATTERN FAKEDIR_TARGET __status=$? - _NIX_TEST_NO_SANDBOX=1 DYLD_INSERT_LIBRARIES="${fakedir_path_2904}" DYLD_LIBRARY_PATH="${cache_root_2902}/nix-deps/lib" exec -a ${name_2899} "${nix_path_2900}" "${args_2901[@]}" - __status=$? -} - -launch_shell_command__485_v0() { - local nix_path_2905="${1}" - local cmd_2906="${2}" - local extras_2907=("${!3}") - local args_2908=("${!4}") - get_repo_root__201_v0 - local repo_root_2909="${ret_get_repo_root201_v0}" - env_var_get__122_v0 "PWD" - __status=$? - local pwd_2910="${ret_env_var_get122_v0}" - local name_2911="nix-shell" - local shell_cmd_2912=("${repo_root_2909}/shell.nix" "--command" "${cmd_2906} ${args_2908[@]}") - file_exists__42_v0 "${pwd_2910}/flake.nix" - local ret_file_exists42_v0__211_8="${ret_file_exists42_v0}" - if [ "${ret_file_exists42_v0__211_8}" != 0 ]; then - name_2911="nix" - local array_73=("develop" "${pwd_2910}" "-c" "${cmd_2906}") - shell_cmd_2912=("${array_73[@]}" "${args_2908[@]}") + _NIX_TEST_NO_SANDBOX=1 DYLD_INSERT_LIBRARIES="${fakedir_path_2862}" DYLD_LIBRARY_PATH="${cache_root_2860}/nix-deps/lib" exec -a ${name_2857} "${nix_path_2858}" "${args_2859[@]}" + __status=$? +} + +# launch_shell_command(nix_path: Text, cmd: Text, extras: [Text], args: [Text]) +launch_shell_command__482_v0() { + local nix_path_2863="${1}" + local cmd_2864="${2}" + local extras_2865=("${!3}") + local args_2866=("${!4}") + get_repo_root__196_v0 + local repo_root_2867="${ret_get_repo_root196_v0}" + env_var_get__120_v0 "PWD" + __status=$? + local pwd_2868="${ret_env_var_get120_v0}" + local name_2869="nix-shell" + local shell_cmd_2870=("${repo_root_2867}/shell.nix" "--command" "${cmd_2864} ${args_2866[@]}") + file_exists__39_v0 "${pwd_2868}/flake.nix" + local ret_file_exists39_v0__209_8="${ret_file_exists39_v0}" + if [ "${ret_file_exists39_v0__209_8}" != 0 ]; then + name_2869="nix" + local array_91=("develop" "${pwd_2868}" "-c" "${cmd_2864}") + shell_cmd_2870=("${array_91[@]}" "${args_2866[@]}") else - file_exists__42_v0 "${repo_root_2909}/flake.nix" - local ret_file_exists42_v0__214_16="${ret_file_exists42_v0}" - if [ "${ret_file_exists42_v0__214_16}" != 0 ]; then - name_2911="nix" - local array_75=("develop" "${repo_root_2909}" "-c" "${cmd_2906}") - shell_cmd_2912=("${array_75[@]}" "${args_2908[@]}") + file_exists__39_v0 "${repo_root_2867}/flake.nix" + local ret_file_exists39_v0__212_16="${ret_file_exists39_v0}" + if [ "${ret_file_exists39_v0__212_16}" != 0 ]; then + name_2869="nix" + local array_93=("develop" "${repo_root_2867}" "-c" "${cmd_2864}") + shell_cmd_2870=("${array_93[@]}" "${args_2866[@]}") else - file_exists__42_v0 "${pwd_2910}/shell.nix" - local ret_file_exists42_v0__217_16="${ret_file_exists42_v0}" - if [ "${ret_file_exists42_v0__217_16}" != 0 ]; then - shell_cmd_2912=("${pwd_2910}/shell.nix" "--command" "${cmd_2906} ${args_2908[@]}") + file_exists__39_v0 "${pwd_2868}/shell.nix" + local ret_file_exists39_v0__215_16="${ret_file_exists39_v0}" + if [ "${ret_file_exists39_v0__215_16}" != 0 ]; then + shell_cmd_2870=("${pwd_2868}/shell.nix" "--command" "${cmd_2864} ${args_2866[@]}") fi fi fi - get_osname__195_v0 - local ret_get_osname195_v0__221_8="${ret_get_osname195_v0}" - is_nix_installed__479_v0 - local ret_is_nix_installed479_v0__221_41="${ret_is_nix_installed479_v0}" - if [ "$(( $([ "_${ret_get_osname195_v0__221_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed479_v0__221_41 )) ))" != 0 ]; then - local array_add_78=("${extras_2907[@]}" "${shell_cmd_2912[@]}") - launch_darwin_workaround__484_v0 "${name_2911}" "${nix_path_2905}" array_add_78[@] + get_osname__190_v0 + local ret_get_osname190_v0__219_8="${ret_get_osname190_v0}" + is_nix_installed__476_v0 + local ret_is_nix_installed476_v0__219_41="${ret_is_nix_installed476_v0}" + if [ "$(( $([ "_${ret_get_osname190_v0__219_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed476_v0__219_41 )) ))" != 0 ]; then + local array_add_96=("${extras_2865[@]}" "${shell_cmd_2870[@]}") + launch_darwin_workaround__481_v0 "${name_2869}" "${nix_path_2863}" array_add_96[@] else - exec -a ${name_2911} ${nix_path_2905} "${extras_2907[@]}" "${shell_cmd_2912[@]}" + exec -a ${name_2869} ${nix_path_2863} "${extras_2865[@]}" "${shell_cmd_2870[@]}" __status=$? fi } -launch_nix_shebang__486_v0() { - local nix_path_2888="${1}" - local file_2889="${2}" - local extras_2890=("${!3}") - local args_2891=("${!4}") - local shebang_2892="" - i_2894=0; - while IFS= read -r line_2893 || [ -n "$line_2893" ]; do - if [ "$(( i_2894 == 1 ))" != 0 ]; then - shebang_2892="${line_2893}" +# launch_nix_shebang(nix_path: Text, file: Text, extras: [Text], args: [Text]) +launch_nix_shebang__483_v0() { + local nix_path_2846="${1}" + local file_2847="${2}" + local extras_2848=("${!3}") + local args_2849=("${!4}") + local shebang_2850="" + i_2852=0; + __AMBER_FIFO_97=$(mktemp -u) || exit 1 + mkfifo "$__AMBER_FIFO_97" || exit 1 + cat "${file_2847}" >"$__AMBER_FIFO_97" & + __AMBER_PID_98=$! + while IFS= read -r line_2851 || [ -n "$line_2851" ]; do + if [ "$(( i_2852 == 1 ))" != 0 ]; then + shebang_2850="${line_2851}" break fi - (( i_2894++ )) || true - done <"${file_2889}" - starts_with__23_v0 "${shebang_2892}" "#"'!'"" - local ret_starts_with23_v0__248_12="${ret_starts_with23_v0}" - if [ "$(( ! ret_starts_with23_v0__248_12 ))" != 0 ]; then - ret_launch_nix_shebang486_v0='' + (( i_2852++ )) || true + done <"$__AMBER_FIFO_97" + wait $__AMBER_PID_98 + rm -f "$__AMBER_FIFO_97" + __status=$? + starts_with__22_v0 "${shebang_2850}" "#"'!'"" + local ret_starts_with22_v0__246_12="${ret_starts_with22_v0}" + if [ "$(( ! ret_starts_with22_v0__246_12 ))" != 0 ]; then + ret_launch_nix_shebang483_v0='' return 0 fi - slice__25_v0 "${shebang_2892}" 2 0 - local ret_slice25_v0__250_27="${ret_slice25_v0}" - split__5_v0 "${ret_slice25_v0__250_27}" " " - local bang_args_2895=("${ret_split5_v0[@]}") - array_shift__78_v0 "bang_args_2895" - __status=$? - local name_2896="${ret_array_shift78_v0}" - i_2898=0; - for arg_2897 in "${bang_args_2895[@]}"; do - if [ "$([ "_${arg_2897}" != "_-i" ]; echo $?)" != 0 ]; then - bang_args_2895["${i_2898}"]="--command" - bang_args_2895["$(( i_2898 + 1 ))"]="${bang_args_2895[$(( i_2898 + 1 ))]} ${file_2889} ${args_2891[@]}" + slice__24_v0 "${shebang_2850}" 2 0 + local ret_slice24_v0__248_27="${ret_slice24_v0}" + split__4_v0 "${ret_slice24_v0__248_27}" " " + local bang_args_2853=("${ret_split4_v0[@]}") + array_shift__75_v0 "bang_args_2853" + __status=$? + local name_2854="${ret_array_shift75_v0}" + i_2856=0; + for arg_2855 in "${bang_args_2853[@]}"; do + if [ "$([ "_${arg_2855}" != "_-i" ]; echo $?)" != 0 ]; then + bang_args_2853["${i_2856}"]="--command" + bang_args_2853["$(( i_2856 + 1 ))"]="${bang_args_2853[$(( i_2856 + 1 ))]?"Index out of bounds (at src/./nix.ab:255:42)"} ${file_2847} ${args_2849[@]}" break fi - (( i_2898++ )) || true + (( i_2856++ )) || true done - get_osname__195_v0 - local ret_get_osname195_v0__262_8="${ret_get_osname195_v0}" - is_nix_installed__479_v0 - local ret_is_nix_installed479_v0__262_41="${ret_is_nix_installed479_v0}" - if [ "$(( $([ "_${ret_get_osname195_v0__262_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed479_v0__262_41 )) ))" != 0 ]; then - local array_add_79=("${extras_2890[@]}" "${bang_args_2895[@]}") - launch_darwin_workaround__484_v0 "${name_2896}" "${nix_path_2888}" array_add_79[@] + get_osname__190_v0 + local ret_get_osname190_v0__260_8="${ret_get_osname190_v0}" + is_nix_installed__476_v0 + local ret_is_nix_installed476_v0__260_41="${ret_is_nix_installed476_v0}" + if [ "$(( $([ "_${ret_get_osname190_v0__260_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed476_v0__260_41 )) ))" != 0 ]; then + local array_add_101=("${extras_2848[@]}" "${bang_args_2853[@]}") + launch_darwin_workaround__481_v0 "${name_2854}" "${nix_path_2846}" array_add_101[@] else - exec -a ${name_2896} ${nix_path_2888} "${extras_2890[@]}" "${bang_args_2895[@]}" + exec -a ${name_2854} ${nix_path_2846} "${extras_2848[@]}" "${bang_args_2853[@]}" __status=$? fi } -launch_nix__487_v0() { - local self_2784="${1}" - local args_2785=("${!2}") - get_cache_root__200_v0 - local cache_root_2786="${ret_get_cache_root200_v0}" - get_nix_root__199_v0 - local nix_path_2788="${cache_root_2786}/nix-static" - populate_extras__483_v0 - local extras_2795=("${ret_populate_extras483_v0[@]}") - split__5_v0 "${self_2784}" "/" - local ret_split5_v0__279_33=("${ret_split5_v0[@]}") - array_last__74_v0 ret_split5_v0__279_33[@] - __status=$? - local name_2798="${ret_array_last74_v0}" - starts_with__23_v0 "${name_2798}" "nix-" - local ret_starts_with23_v0__281_8="${ret_starts_with23_v0}" - if [ "${ret_starts_with23_v0__281_8}" != 0 ]; then - unpack_channels__482_v0 - fi - is_nix_installed__479_v0 - local ret_is_nix_installed479_v0__284_8="${ret_is_nix_installed479_v0}" - if [ "${ret_is_nix_installed479_v0__284_8}" != 0 ]; then - migrate_nix_store__481_v0 - nix_path_2788="nix" +# launch_nix(self: Text, args: [Text]) +launch_nix__484_v0() { + local self_2739="${1}" + local args_2740=("${!2}") + get_cache_root__195_v0 + local cache_root_2741="${ret_get_cache_root195_v0}" + get_nix_root__194_v0 + local nix_path_2743="${cache_root_2741}/nix-static" + populate_extras__480_v0 + local extras_2747=("${ret_populate_extras480_v0[@]}") + split__4_v0 "${self_2739}" "/" + local ret_split4_v0__277_33=("${ret_split4_v0[@]}") + array_last__71_v0 ret_split4_v0__277_33[@] + __status=$? + local name_2750="${ret_array_last71_v0}" + starts_with__22_v0 "${name_2750}" "nix-" + local ret_starts_with22_v0__279_8="${ret_starts_with22_v0}" + if [ "${ret_starts_with22_v0__279_8}" != 0 ]; then + unpack_channels__479_v0 + fi + is_nix_installed__476_v0 + local ret_is_nix_installed476_v0__282_8="${ret_is_nix_installed476_v0}" + if [ "${ret_is_nix_installed476_v0__282_8}" != 0 ]; then + migrate_nix_store__478_v0 + nix_path_2743="nix" else - get_nix__480_v0 + get_nix__477_v0 __status=$? if [ "${__status}" != 0 ]; then - bail__181_v0 "Failed to obtain Nix. Check your internet connection." 0 + bail__177_v0 "Failed to obtain Nix. Check your internet connection." 0 fi fi export NIX_SSL_CERT_FILE __status=$? - file_exists__42_v0 "${args_2785[0]}" - local ret_file_exists42_v0__295_8="${ret_file_exists42_v0}" - ends_with__24_v0 "${args_2785[0]}" ".nix" - local ret_ends_with24_v0__295_37="${ret_ends_with24_v0}" - if [ "$(( ret_file_exists42_v0__295_8 && $(( ! ret_ends_with24_v0__295_37 )) ))" != 0 ]; then - local args_shebang_2887=("${args_2785[@]}") - array_shift__78_v0 "args_shebang_2887" + file_exists__39_v0 "${args_2740[0]?"Index out of bounds (at src/./nix.ab:293:25)"}" + local ret_file_exists39_v0__293_8="${ret_file_exists39_v0}" + ends_with__23_v0 "${args_2740[0]?"Index out of bounds (at src/./nix.ab:293:52)"}" ".nix" + local ret_ends_with23_v0__293_37="${ret_ends_with23_v0}" + if [ "$(( ret_file_exists39_v0__293_8 && $(( ! ret_ends_with23_v0__293_37 )) ))" != 0 ]; then + local args_shebang_2845=("${args_2740[@]}") + array_shift__75_v0 "args_shebang_2845" __status=$? - launch_nix_shebang__486_v0 "${nix_path_2788}" "${args_2785[0]}" extras_2795[@] args_shebang_2887[@] - fi - starts_with__23_v0 "${name_2798}" "nix" - local ret_starts_with23_v0__301_12="${ret_starts_with23_v0}" - if [ "$(( ! ret_starts_with23_v0__301_12 ))" != 0 ]; then - launch_shell_command__485_v0 "${nix_path_2788}" "${name_2798}" extras_2795[@] args_2785[@] - fi - get_osname__195_v0 - local ret_get_osname195_v0__305_8="${ret_get_osname195_v0}" - is_nix_installed__479_v0 - local ret_is_nix_installed479_v0__305_41="${ret_is_nix_installed479_v0}" - if [ "$(( $([ "_${ret_get_osname195_v0__305_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed479_v0__305_41 )) ))" != 0 ]; then - local array_add_80=("${extras_2795[@]}" "${args_2785[@]}") - launch_darwin_workaround__484_v0 "${name_2798}" "${nix_path_2788}" array_add_80[@] + launch_nix_shebang__483_v0 "${nix_path_2743}" "${args_2740[0]?"Index out of bounds (at src/./nix.ab:296:43)"}" extras_2747[@] args_shebang_2845[@] + fi + starts_with__22_v0 "${name_2750}" "nix" + local ret_starts_with22_v0__299_12="${ret_starts_with22_v0}" + if [ "$(( ! ret_starts_with22_v0__299_12 ))" != 0 ]; then + launch_shell_command__482_v0 "${nix_path_2743}" "${name_2750}" extras_2747[@] args_2740[@] + fi + get_osname__190_v0 + local ret_get_osname190_v0__303_8="${ret_get_osname190_v0}" + is_nix_installed__476_v0 + local ret_is_nix_installed476_v0__303_41="${ret_is_nix_installed476_v0}" + if [ "$(( $([ "_${ret_get_osname190_v0__303_8}" != "_Darwin" ]; echo $?) && $(( ! ret_is_nix_installed476_v0__303_41 )) ))" != 0 ]; then + local array_add_102=("${extras_2747[@]}" "${args_2740[@]}") + launch_darwin_workaround__481_v0 "${name_2750}" "${nix_path_2743}" array_add_102[@] else - exec -a ${name_2798} ${nix_path_2788} "${extras_2795[@]}" "${args_2785[@]}" + exec -a ${name_2750} ${nix_path_2743} "${extras_2747[@]}" "${args_2740[@]}" __status=$? fi } -array_82=("tar" "gzip" "uname") -check_deps__185_v0 array_82[@] +array_104=("tar" "gzip" "uname") +check_deps__181_v0 array_104[@] __status=$? if [ "${__status}" != 0 ]; then exit 1 fi -load_features__489_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__489_v0 -catch_args__222_v0 "args_7" -array_shift__78_v0 "args_7" +typeset -r cmdl_88=("$0" "$@") +args_0=("${cmdl_88[@]}") +load_features__212_v0 +__status=$? +if [ "${__status}" != 0 ]; then + bail__177_v0 "The environment file in the resource archive is incomplete." 1 +fi +catch_args__221_v0 "args_0" +array_shift__75_v0 "args_0" __status=$? -self_276="${ret_array_shift78_v0}" -file_exists__42_v0 "/etc/pki/tls/certs/ca-bundle.crt" -ret_file_exists42_v0__68_5="${ret_file_exists42_v0}" -get_osname__195_v0 -ret_get_osname195_v0__70_5="${ret_get_osname195_v0}" -if [ "${ret_file_exists42_v0__68_5}" != 0 ]; then - env_var_set__121_v0 "NIX_SSL_CERT_FILE" "/etc/pki/tls/certs/ca-bundle.crt" +self_297="${ret_array_shift75_v0}" +file_exists__39_v0 "/etc/pki/tls/certs/ca-bundle.crt" +ret_file_exists39_v0__33_5="${ret_file_exists39_v0}" +get_osname__190_v0 +ret_get_osname190_v0__35_5="${ret_get_osname190_v0}" +if [ "${ret_file_exists39_v0__33_5}" != 0 ]; then + env_var_set__119_v0 "NIX_SSL_CERT_FILE" "/etc/pki/tls/certs/ca-bundle.crt" __status=$? -elif [ "$([ "_${ret_get_osname195_v0__70_5}" != "_Darwin" ]; echo $?)" != 0 ]; then - env_var_set__121_v0 "NIX_SSL_CERT_FILE" "/etc/ssl/cert.pem" +elif [ "$([ "_${ret_get_osname190_v0__35_5}" != "_Darwin" ]; echo $?)" != 0 ]; then + env_var_set__119_v0 "NIX_SSL_CERT_FILE" "/etc/ssl/cert.pem" __status=$? fi -launch_nix__487_v0 "${self_276}" args_7[@] +launch_nix__484_v0 "${self_297}" args_0[@] exit 0 cat <Ol)|7c}UqśZVIG2m5@p 淹Ϯ@iN=e0}Eݳc-Xyqo2/\q.7jVtRTrM Ǒ3&||R[bEB s*ۆ3(ՊXC:q-_1}b$5t'([?1049l # (tarball data) \ No newline at end of file diff --git a/tests/features/generation.feature b/tests/features/generation.feature index 93b8668..f5d1434 100644 --- a/tests/features/generation.feature +++ b/tests/features/generation.feature @@ -18,12 +18,12 @@ Feature: Nixie can generate a Nix script with offline resources And the Nix wrapper is extracted Then the Nix wrapper should contain these files | filename | - | libbrotlicommon | - | libsodium | - | libeditline | - | libarchive | - | boost | - | lowdown | - | nix | - | nlohmann_json | - | openssl | + | sources/libbrotlicommon | + | sources/libsodium | + | sources/libeditline | + | sources/libarchive | + | sources/boost | + | sources/lowdown | + | sources/nix | + | sources/nlohmann_json | + | sources/openssl | diff --git a/tests/features/steps/generation.py b/tests/features/steps/generation.py index 97e6450..2d5292f 100644 --- a/tests/features/steps/generation.py +++ b/tests/features/steps/generation.py @@ -7,7 +7,7 @@ def nixie_extract(context): @then("the Nix wrapper should contain these files") def check_extracted(context): - filelist = context.nixos.succeed("ls nixie").split('\n') + filelist = context.nixos.succeed("find nixie -maxdepth 2").split('\n') for row in context.table.rows: - if row.cells[0] not in filelist: + if f"nixie/{row.cells[0]}" not in filelist: raise AssertionError(f"Missing entry: {row.cells[0]}") From d908b21e310f898799f217f5a9a71099ca1cf250 Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Sat, 6 Jun 2026 15:48:18 +0200 Subject: [PATCH 6/8] Added Allure reporting --- tests/default.nix | 9 ++++++++- tests/report.nix | 22 ++++++++++++++++++++++ tests/template-darwin.nix | 8 +++++--- tests/template-linux.nix | 5 ++++- 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 tests/report.nix diff --git a/tests/default.nix b/tests/default.nix index 152e787..0c21a9e 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -4,14 +4,21 @@ let pkgs = import nixpkgs { inherit system; }; + makeReport = test: + (pkgs.callPackage ./report.nix { inherit test; }); + makeDarwinTest = featureName: configuration: import ./template-darwin.nix { inherit pkgs configuration featureName sources static-bins; }; makeLinuxTest = featureName: configuration: import ./template-linux.nix { inherit pkgs configuration featureName sources static-bins; }; - makeTest = + makeTest' = if pkgs.stdenv.isLinux then makeLinuxTest else if pkgs.stdenv.isDarwin then makeDarwinTest else throw "Unsupported platform: ${pkgs.stdenv.platform}"; + makeTest = n: c: + let test = makeTest' n c; + in test // { report = makeReport test; }; + defaultConfig = { environment.systemPackages = with pkgs; [ nixie git diff --git a/tests/report.nix b/tests/report.nix new file mode 100644 index 0000000..9d3a36e --- /dev/null +++ b/tests/report.nix @@ -0,0 +1,22 @@ +{ pkgs, lib, stdenv, allure, emptyDirectory + # A NixOS Behave test (with a .driver output) to run +, test +, ... }: + +stdenv.mkDerivation { + name = "${test.name}-report"; + src = emptyDirectory; + + nativeBuildInputs = [ + allure + ]; + + buildPhase = '' + ${lib.getExe test.driver} || true + ''; + + installPhase = '' + mkdir -p $out + allure generate allure_output -o $out + ''; +} diff --git a/tests/template-darwin.nix b/tests/template-darwin.nix index ee927cb..ee259c6 100644 --- a/tests/template-darwin.nix +++ b/tests/template-darwin.nix @@ -20,7 +20,7 @@ let }; stdenv.systemPackages = [ - pkgs.python3.withPackages (ps: with ps; [ behave ]) + pkgs.python3.withPackages (ps: with ps; [ behave allure-behave ]) ]; config = { @@ -50,8 +50,10 @@ let return true raise AssertionError(f"Command '{cmd}' succeeded unexpectedly") - conf = Configuration("${featurePath}/${featureName}.feature", userdata = { "succeed": succeed, "fail": fail, "sources": "${sources}", "static_bins": "${static-bins}" }) - + conf = Configuration("${featurePath}/${featureName}.feature", userdata = { "succeed": succeed, "fail": fail, "sources": "${sources}", "static_bins": "${static-bins}" }) + conf.format = [ "allure_behave.formatter:AllureFormatter", "pretty" ] + conf.outputs = [] + conf.setup_outputs(['allure_output']) exit(run_behave(conf)) EOF echo >&2 ok diff --git a/tests/template-linux.nix b/tests/template-linux.nix index 720b3ca..8864617 100644 --- a/tests/template-linux.nix +++ b/tests/template-linux.nix @@ -7,7 +7,7 @@ pkgs.testers.nixosTest { name = featureName; nodes = { machine = configuration; }; - extraPythonPackages = p: with p; [ behave ]; + extraPythonPackages = p: with p; [ behave allure-behave ]; skipTypeCheck = true; @@ -22,6 +22,9 @@ pkgs.testers.nixosTest { return machine.fail(cmd) conf = Configuration("${featurePath}/${featureName}.feature", userdata = { "succeed": succeed, "fail": fail, "sources": "${sources}", "static_bins": "${static-bins}" }) + conf.format = [ "allure_behave.formatter:AllureFormatter", "pretty" ] + conf.outputs = [] + conf.setup_outputs(['allure_output']) start_all() exit(run_behave(conf)) ''; From 2ac2b3a01889b2f760d051372725b924a617d7aa Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Sat, 6 Jun 2026 15:50:56 +0200 Subject: [PATCH 7/8] GitHub Actions matrix testing --- .github/workflows/testing.yaml | 97 ++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/testing.yaml diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml new file mode 100644 index 0000000..dc915db --- /dev/null +++ b/.github/workflows/testing.yaml @@ -0,0 +1,97 @@ +name: "Run end-to-end tests for Nixie" + +on: + push: + paths: + - 'src/**' + - 'nixie/**' + - 'sources/**' + - 'static-bins/**' + - 'tests/**' + - '*.nix' + +jobs: + run-tests: + strategy: + # We need other architectures to succeed to generate full reports! + fail-fast: false + matrix: + os: [ ubuntu-latest, ubuntu-24.04-arm, macos-latest ] + cpu: [ x86_64, aarch64 ] + exclude: + - os: ubuntu-latest + cpu: aarch64 + - os: ubuntu-24.04-arm + cpu: x86_64 + name: Run unit tests + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up Nix + uses: cachix/install-nix-action@v20 + - name: Set up Cachix access + uses: cachix/cachix-action@v12 + with: + name: nix-wrap + - name: Enable KVM group perms + if: matrix.os == 'ubuntu-latest' + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: Launch tests + run: | + for file in tests/features/*.feature + do + echo "::group::Test ${file##*/}" + feat="${file##*/}" + os="$(uname -s | tr ':[A-Z]:' ':[a-z]:')" + nix run .#checks.${{ matrix.cpu }}-${os}.${feat%%.feature}.driver + echo "::endgroup::" + done + - name: Save results + uses: actions/upload-artifact@v7 + if: always() + with: + name: allure-output-${{ matrix.cpu }}-${{ matrix.os }} + path: allure_output + + push-reports: + name: Upload HTML reports to Pages + needs: run-tests + if: always() + runs-on: ubuntu-latest + permissions: + statuses: write + contents: write + pages: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Fetch report + uses: actions/download-artifact@v8 + with: + pattern: allure-output-* + path: allure_output + merge-multiple: true + - name: Deploy report to GitHub Pages + id: report + uses: PavanMudigonda/html-reporter-github-pages@v1.5.21 + with: + test_results: allure_output + allure_report_generate_flag: true + keep_reports: 10 + gh_pages: pages_reports + workflow_name: ${{ github.workflow }} + use_actions_summary: true + - name: Notify about generated report + uses: guibranco/github-status-action-v2@v1.1.14 + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: Nixie test reports + description: Click here to open test reports + state: success + sha: ${{github.event.pull_request.head.sha || github.sha}} + target_url: ${{env.GITHUB_PAGES_WEBSITE_URL}}/${{github.run_member}}/index.html + From a769d06faa55ff71184506a3f7da6d23ceaa9cee Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Sat, 6 Jun 2026 15:52:19 +0200 Subject: [PATCH 8/8] Fix macOS test derivation --- tests/default.nix | 4 ++-- tests/report.nix | 16 ++++++++++++---- tests/template-darwin.nix | 10 +++++----- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/default.nix b/tests/default.nix index 0c21a9e..3eaff67 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -7,8 +7,8 @@ let makeReport = test: (pkgs.callPackage ./report.nix { inherit test; }); - makeDarwinTest = featureName: configuration: import ./template-darwin.nix { inherit pkgs configuration featureName sources static-bins; }; - makeLinuxTest = featureName: configuration: import ./template-linux.nix { inherit pkgs configuration featureName sources static-bins; }; + makeDarwinTest = featureName: configuration: import ./template-darwin.nix { inherit nixpkgs nix-darwin configuration featureName sources static-bins system; }; + makeLinuxTest = featureName: configuration: import ./template-linux.nix { inherit pkgs configuration featureName sources static-bins system; }; makeTest' = if pkgs.stdenv.isLinux then makeLinuxTest diff --git a/tests/report.nix b/tests/report.nix index 9d3a36e..fe3ac1f 100644 --- a/tests/report.nix +++ b/tests/report.nix @@ -1,5 +1,6 @@ -{ pkgs, lib, stdenv, allure, emptyDirectory +{ pkgs, lib, stdenv, allure, emptyDirectory, writeShellScript # A NixOS Behave test (with a .driver output) to run + # or a Nix-Darwin Behave test , test , ... }: @@ -11,9 +12,16 @@ stdenv.mkDerivation { allure ]; - buildPhase = '' - ${lib.getExe test.driver} || true - ''; + buildPhase = + if stdenv.hostPlatform.isLinux + then + '' + ${lib.getExe test.driver} || true + '' + else + '' + ${writeShellScript "${test.name}-driver" test.buildCommand} || true + ''; installPhase = '' mkdir -p $out diff --git a/tests/template-darwin.nix b/tests/template-darwin.nix index ee259c6..04a4d1a 100644 --- a/tests/template-darwin.nix +++ b/tests/template-darwin.nix @@ -19,14 +19,13 @@ let }; }; - stdenv.systemPackages = [ - pkgs.python3.withPackages (ps: with ps; [ behave allure-behave ]) - ]; - config = { + environment.systemPackages = [ + (pkgs.python3.withPackages (ps: with ps; [ behave allure-behave ])) + ]; system.stateVersion = lib.mkDefault config.system.maxStateVersion; - system.build.run-test = pkgs.runCommand "darwin-test-${testName}" + system.build.run-test = pkgs.runCommand "darwin-test-${featureName}" { allowSubstitutes = false; preferLocalBuild = true; } '' #! ${pkgs.stdenv.shell} @@ -54,6 +53,7 @@ let conf.format = [ "allure_behave.formatter:AllureFormatter", "pretty" ] conf.outputs = [] conf.setup_outputs(['allure_output']) + exit(run_behave(conf)) EOF echo >&2 ok