From de11f7909341588893e9f9a4bb97c48797581cc5 Mon Sep 17 00:00:00 2001 From: Guillaume Desforges Date: Wed, 20 Sep 2023 12:24:22 +0200 Subject: [PATCH] Add more fixtures --- .../flake-direct-nativeBuildInput/flake.lock | 61 +++++++++++++++++++ .../flake-direct-nativeBuildInput/flake.nix | 38 ++++++++++++ .../flake-direct-nativeBuildInput/pkg1/pkg1 | 2 + .../flake-direct-nativeBuildInput/pkg2/pkg2 | 2 + tests/fixtures/flake-three-levels/flake.lock | 61 +++++++++++++++++++ tests/fixtures/flake-three-levels/flake.nix | 50 +++++++++++++++ tests/fixtures/flake-three-levels/pkg1/pkg1 | 2 + tests/fixtures/flake-three-levels/pkg2/pkg2 | 2 + tests/fixtures/flake-three-levels/pkg3/pkg3 | 2 + 9 files changed, 220 insertions(+) create mode 100644 tests/fixtures/flake-direct-nativeBuildInput/flake.lock create mode 100644 tests/fixtures/flake-direct-nativeBuildInput/flake.nix create mode 100755 tests/fixtures/flake-direct-nativeBuildInput/pkg1/pkg1 create mode 100755 tests/fixtures/flake-direct-nativeBuildInput/pkg2/pkg2 create mode 100644 tests/fixtures/flake-three-levels/flake.lock create mode 100644 tests/fixtures/flake-three-levels/flake.nix create mode 100755 tests/fixtures/flake-three-levels/pkg1/pkg1 create mode 100755 tests/fixtures/flake-three-levels/pkg2/pkg2 create mode 100755 tests/fixtures/flake-three-levels/pkg3/pkg3 diff --git a/tests/fixtures/flake-direct-nativeBuildInput/flake.lock b/tests/fixtures/flake-direct-nativeBuildInput/flake.lock new file mode 100644 index 0000000..eff9f1c --- /dev/null +++ b/tests/fixtures/flake-direct-nativeBuildInput/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/tests/fixtures/flake-direct-nativeBuildInput/flake.nix b/tests/fixtures/flake-direct-nativeBuildInput/flake.nix new file mode 100644 index 0000000..b8d2b05 --- /dev/null +++ b/tests/fixtures/flake-direct-nativeBuildInput/flake.nix @@ -0,0 +1,38 @@ +{ + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { flake-utils, nixpkgs, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + + pkg1 = pkgs.stdenv.mkDerivation { + name = "pkg1"; + src = ./pkg1; + buildInputs = [ pkgs.bash ]; + installPhase = '' + mkdir -p $out/bin + cp $src/* $out/bin + ''; + }; + + pkg2 = pkgs.stdenv.mkDerivation { + name = "pkg2"; + src = ./pkg2; + nativeBuildInputs = [ pkgs.bash pkg1 ]; + buildPhase = '' + pkg1 + ''; + installPhase = '' + mkdir -p $out/bin + cp $src/* $out/bin + ''; + }; + + in + { + packages.default = pkg2; + } + ); +} diff --git a/tests/fixtures/flake-direct-nativeBuildInput/pkg1/pkg1 b/tests/fixtures/flake-direct-nativeBuildInput/pkg1/pkg1 new file mode 100755 index 0000000..50eef3d --- /dev/null +++ b/tests/fixtures/flake-direct-nativeBuildInput/pkg1/pkg1 @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo "pkg1" \ No newline at end of file diff --git a/tests/fixtures/flake-direct-nativeBuildInput/pkg2/pkg2 b/tests/fixtures/flake-direct-nativeBuildInput/pkg2/pkg2 new file mode 100755 index 0000000..40d4fa8 --- /dev/null +++ b/tests/fixtures/flake-direct-nativeBuildInput/pkg2/pkg2 @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo "pkg2" \ No newline at end of file diff --git a/tests/fixtures/flake-three-levels/flake.lock b/tests/fixtures/flake-three-levels/flake.lock new file mode 100644 index 0000000..eff9f1c --- /dev/null +++ b/tests/fixtures/flake-three-levels/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/tests/fixtures/flake-three-levels/flake.nix b/tests/fixtures/flake-three-levels/flake.nix new file mode 100644 index 0000000..429cc34 --- /dev/null +++ b/tests/fixtures/flake-three-levels/flake.nix @@ -0,0 +1,50 @@ +{ + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { flake-utils, nixpkgs, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + + pkg1 = pkgs.stdenv.mkDerivation { + name = "pkg1"; + src = ./pkg1; + buildInputs = [ pkgs.bash ]; + installPhase = '' + mkdir -p $out/bin + cp $src/* $out/bin + ''; + }; + + pkg2 = pkgs.stdenv.mkDerivation { + name = "pkg2"; + src = ./pkg2; + buildInputs = [ pkgs.bash pkg1 ]; + buildPhase = '' + pkg1 + ''; + installPhase = '' + mkdir -p $out/bin + cp $src/* $out/bin + ''; + }; + + pkg3 = pkgs.stdenv.mkDerivation { + name = "pkg3"; + src = ./pkg3; + buildInputs = [ pkgs.bash pkg2 ]; + buildPhase = '' + pkg2 + ''; + installPhase = '' + mkdir -p $out/bin + cp $src/* $out/bin + ''; + }; + in + { + packages.default = pkg3; + } + ); +} diff --git a/tests/fixtures/flake-three-levels/pkg1/pkg1 b/tests/fixtures/flake-three-levels/pkg1/pkg1 new file mode 100755 index 0000000..50eef3d --- /dev/null +++ b/tests/fixtures/flake-three-levels/pkg1/pkg1 @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo "pkg1" \ No newline at end of file diff --git a/tests/fixtures/flake-three-levels/pkg2/pkg2 b/tests/fixtures/flake-three-levels/pkg2/pkg2 new file mode 100755 index 0000000..40d4fa8 --- /dev/null +++ b/tests/fixtures/flake-three-levels/pkg2/pkg2 @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo "pkg2" \ No newline at end of file diff --git a/tests/fixtures/flake-three-levels/pkg3/pkg3 b/tests/fixtures/flake-three-levels/pkg3/pkg3 new file mode 100755 index 0000000..cb076a7 --- /dev/null +++ b/tests/fixtures/flake-three-levels/pkg3/pkg3 @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo "pkg3"