31 default_packages = [ bash file findutils gettext ];
32 parsed_packages = [ coreutils sqlite unixtools.script gnused gawk findutils rlwrap gnutar bc ];
35 module1 = resholve.mkDerivation {
37 version = "unreleased";
40 setSourceRoot = "sourceRoot=$(echo */tests/nix/libressl)";
43 mkdir -p $out/{bin,submodule}
44 install libressl.sh $out/bin/libressl.sh
45 install submodule/helper.sh $out/submodule/helper.sh
50 # submodule to demonstrate
51 scripts = [ "bin/libressl.sh" "submodule/helper.sh" ];
53 inputs = [ jq module2 libressl.bin ];
57 is_it_okay_with_arbitrary_envs = "shonuff";
59 module2 = resholve.mkDerivation {
61 version = "unreleased";
64 setSourceRoot = "sourceRoot=$(echo */tests/nix/openssl)";
67 mkdir -p $out/bin $out/libexec
68 install openssl.sh $out/bin/openssl.sh
69 install libexec.sh $out/libexec/invokeme
70 install profile $out/profile
78 scripts = [ "bin/openssl.sh" "libexec/invokeme" ];
80 inputs = [ shunit2 openssl.bin "libexec" "libexec/invokeme" ];
83 This is the same verdict binlore will
84 come up with. It's a no-op just to demo
85 how to fiddle lore via the Nix API.
87 "cannot:${openssl.bin}/bin/openssl"
88 # different verdict, but not used
89 "can:${openssl.bin}/bin/c_rehash"
93 scripts = [ "profile" ];
99 # demonstrate that we could use resholve in larger build
100 module3 = stdenv.mkDerivation {
102 version = "unreleased";
105 setSourceRoot = "sourceRoot=$(echo */tests/nix/future_perfect_tense)";
109 install conjure.sh $out/bin/conjure.sh
110 ${resholve.phraseSolution "conjure" {
111 scripts = [ "bin/conjure.sh" ];
112 interpreter = "${bash}/bin/bash";
113 inputs = [ module1 ];
115 external = [ "jq" "openssl" ];
121 cli = stdenv.mkDerivation {
122 name = "resholve-test";
129 buildInputs = [ resholve ];
130 nativeCheckInputs = [ coreutils bats python27 ];
134 RESHOLVE_PATH = "${lib.makeBinPath default_packages}";
135 # but separate packages for combining as needed
136 PKG_FILE = "${lib.makeBinPath [ file ]}";
137 PKG_FINDUTILS = "${lib.makeBinPath [ findutils ]}";
138 PKG_GETTEXT = "${lib.makeBinPath [ gettext ]}";
139 PKG_COREUTILS = "${lib.makeBinPath [ coreutils ]}";
140 RESHOLVE_LORE = "${binlore.collect { drvs = default_packages ++ [ coreutils ] ++ parsed_packages; } }";
141 PKG_PARSED = "${lib.makeBinPath parsed_packages}";
143 # explicit interpreter for demo suite; maybe some better way...
144 INTERP = "${bash}/bin/bash";
149 touch empty_lore/{execers,wrappers}
150 export EMPTY_LORE=$PWD/empty_lore
151 printf "\033[33m============================= resholve test suite ===================================\033[0m\n" > test.ansi
152 if ./test.sh &>> test.ansi; then
155 cat test.ansi && exit 1
157 '' + lib.optionalString runDemo ''
158 printf "\033[33m============================= resholve demo ===================================\033[0m\n" > demo.ansi
159 if ./demo &>> demo.ansi; then
162 cat demo.ansi && exit 1
167 # Caution: ci.nix asserts the equality of both of these w/ diff
168 resholvedScript = resholve.writeScript "resholved-script" {
170 interpreter = "${bash}/bin/bash";
175 resholvedScriptBin = resholve.writeScriptBin "resholved-script-bin" {
177 interpreter = "${bash}/bin/bash";
182 resholvedScriptBinNone = resholve.writeScriptBin "resholved-script-bin" {
184 interpreter = "none";