aboutsummaryrefslogtreecommitdiff
path: root/tests/flakes/common.sh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-07-13 14:40:39 +0200
committerEelco Dolstra <edolstra@gmail.com>2022-07-13 15:06:57 +0200
commitc591efafd3e967816964600722265b037872200a (patch)
tree036d660514bcab4c0979e1c16a7706bc9524bd6a /tests/flakes/common.sh
parent420957e149256677046b2433135f53ab0dadab3c (diff)
Split off the Mercurial flake tests
Diffstat (limited to 'tests/flakes/common.sh')
-rw-r--r--tests/flakes/common.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/flakes/common.sh b/tests/flakes/common.sh
new file mode 100644
index 000000000..aa45dffa9
--- /dev/null
+++ b/tests/flakes/common.sh
@@ -0,0 +1,36 @@
+source ../common.sh
+
+registry=$TEST_ROOT/registry.json
+
+writeSimpleFlake() {
+ local flakeDir="$1"
+ cat > $flakeDir/flake.nix <<EOF
+{
+ description = "Bla bla";
+
+ outputs = inputs: rec {
+ packages.$system = rec {
+ foo = import ./simple.nix;
+ default = foo;
+ };
+
+ # To test "nix flake init".
+ legacyPackages.x86_64-linux.hello = import ./simple.nix;
+ };
+}
+EOF
+
+ cp ../simple.nix ../simple.builder.sh ../config.nix $flakeDir/
+}
+
+writeDependentFlake() {
+ local flakeDir="$1"
+ cat > $flakeDir/flake.nix <<EOF
+{
+ outputs = { self, flake1 }: {
+ packages.$system.default = flake1.packages.$system.default;
+ expr = assert builtins.pathExists ./flake.lock; 123;
+ };
+}
+EOF
+}