[M7] generated flake.nix moves to build/flake.nix

This commit is contained in:
2026-05-15 22:57:05 +00:00
parent db1c9eb36d
commit 815e5b1be2
5 changed files with 22 additions and 10 deletions

View File

@@ -64,7 +64,7 @@ TEST_CASE("cmd_build generates files for a no-deps binary project",
auto r = cmd_build(root, true, false, std::nullopt, overlay_path(parent));
REQUIRE(r.has_value());
REQUIRE(std::filesystem::exists(root / "flake.nix"));
REQUIRE(std::filesystem::exists(root / "build" / "flake.nix"));
REQUIRE(std::filesystem::exists(root / "build" / "CMakeLists.txt"));
REQUIRE(std::filesystem::exists(root / "Cargoxx.lock"));
@@ -73,7 +73,7 @@ TEST_CASE("cmd_build generates files for a no-deps binary project",
REQUIRE(cmake_text.find("add_executable(hello_bin ../src/main.cpp)") !=
std::string::npos);
auto flake_text = read_file(root / "flake.nix");
auto flake_text = read_file(root / "build" / "flake.nix");
REQUIRE(flake_text.find("description = \"hello\";") != std::string::npos);
REQUIRE(flake_text.find("github:NixOS/nixpkgs/nixos-unstable") != std::string::npos);
}
@@ -113,7 +113,7 @@ TEST_CASE("cmd_build resolves a manually-seeded dep into find_package + targets"
REQUIRE(cmake_text.find("find_package(fmt CONFIG REQUIRED)") != std::string::npos);
REQUIRE(cmake_text.find("fmt::fmt") != std::string::npos);
auto flake_text = read_file(root / "flake.nix");
auto flake_text = read_file(root / "build" / "flake.nix");
REQUIRE(flake_text.find("pkgs.fmt_10") != std::string::npos);
}
@@ -197,11 +197,11 @@ TEST_CASE("cmd_build is idempotent — second run produces identical files",
REQUIRE(cmd_build(root, true, false, std::nullopt, overlay_path(parent)).has_value());
auto first_cmake = read_file(root / "build" / "CMakeLists.txt");
auto first_flake = read_file(root / "flake.nix");
auto first_flake = read_file(root / "build" / "flake.nix");
auto first_lock = read_file(root / "Cargoxx.lock");
REQUIRE(cmd_build(root, true, false, std::nullopt, overlay_path(parent)).has_value());
REQUIRE(read_file(root / "build" / "CMakeLists.txt") == first_cmake);
REQUIRE(read_file(root / "flake.nix") == first_flake);
REQUIRE(read_file(root / "build" / "flake.nix") == first_flake);
REQUIRE(read_file(root / "Cargoxx.lock") == first_lock);
}