aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/flakes/flake-metadata.sh
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-08-07 00:50:30 +0000
committerGerrit Code Review <gerrit@localhost>2024-08-07 00:50:30 +0000
commit529eed74c477eee8567f28379210cd47f0b4e18f (patch)
tree4c82036a43a1c1f627cacf2316f708afb6835389 /tests/functional/flakes/flake-metadata.sh
parent2c48460850186e5fb8152e7882baf9e29bb5e884 (diff)
parentca9d3e6e00ec452701d9d3b7e909eff61799f739 (diff)
Merge changes I0fc80718,Ia182b86f,I355f82cb,I8a9b58fa,Id89f8a1f, ... into main
* changes: tree-wide: fix various lint warnings flake & doxygen: update tagline nix flake metadata: print modified dates for input flakes cli: eat terminal codes from stdout also Implement forcing CLI colour on, and document it better manual: fix a syntax error in redirects.js that made it not do anything misc docs/meson tidying build: implement clang-tidy using our plugin
Diffstat (limited to 'tests/functional/flakes/flake-metadata.sh')
-rw-r--r--tests/functional/flakes/flake-metadata.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/functional/flakes/flake-metadata.sh b/tests/functional/flakes/flake-metadata.sh
new file mode 100644
index 000000000..ab5a69b3a
--- /dev/null
+++ b/tests/functional/flakes/flake-metadata.sh
@@ -0,0 +1,36 @@
+source ./common.sh
+
+flakeDir=$TEST_ROOT/flake
+mkdir -p "$flakeDir"
+
+cat > "$flakeDir/flake.nix" <<-'EOF'
+{
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
+ flake-utils.url = "github:numtide/flake-utils";
+ flake-compat = {
+ url = "github:edolstra/flake-compat";
+ flake = false;
+ };
+ lanzaboote = {
+ url = "github:nix-community/lanzaboote";
+ inputs.nixpkgs.follows = "nixpkgs";
+ inputs.flake-utils.follows = "flake-utils";
+ inputs.flake-compat.follows = "flake-compat";
+ };
+ };
+
+ outputs = { ... }: {};
+}
+EOF
+
+cp flake-metadata/flake.lock "$flakeDir"
+touch -d @1000 "$flakeDir/flake.nix" "$flakeDir/flake.lock" "$flakeDir"
+
+# For some reason we use NIX_STORE_DIR which causes unstable paths. This is
+# goofy. We can just use --store, which sets rootDir and does not have this
+# problem.
+actualStore=$NIX_STORE_DIR
+unset NIX_STORE_DIR
+NOCOLOR=1 TZ=UTC LC_ALL=C.UTF-8 nix flake metadata --store "$actualStore" "$flakeDir" | grep -v -e 'Locked URL:' -e 'Resolved URL:' > "$TEST_ROOT/metadata.out.actual"
+diff -u flake-metadata/metadata.out.expected "$TEST_ROOT/metadata.out.actual"