mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
39 lines
1.2 KiB
Nix
39 lines
1.2 KiB
Nix
{
|
|
pkgs,
|
|
ntlib,
|
|
...
|
|
}: {
|
|
suites."flake-parts" = {
|
|
pos = __curPos;
|
|
tests = [
|
|
{
|
|
name = "flakeModule";
|
|
type = "script";
|
|
script =
|
|
# sh
|
|
''
|
|
${ntlib.helpers.scriptHelpers}
|
|
${ntlib.helpers.path (with pkgs; [coreutils nix gnused gnugrep jq])}
|
|
repo_path=${../.}
|
|
|
|
dir=$(mktemp -d)
|
|
trap "rm -rf $dir" EXIT
|
|
cd $dir
|
|
cp ${./fixtures/flake_parts}/* .
|
|
# import from the absolute path above, is easier than trying to figure out the repo path etc.
|
|
sed -i -e "s|@repo_path@|$repo_path|" flake.nix
|
|
|
|
# NOTE: --impure is required since importing modules from absolute paths is not allowed in pure mode
|
|
nix build --impure .#gitlab-ci:pipeline:default
|
|
assert "-f result" "should exist"
|
|
assert_file_contains "result" "finalize_nix_ci"
|
|
jq '.' result # check if valid json just to be sure
|
|
|
|
nix build --impure .#gitlab-ci:pipeline:default:pretty
|
|
assert "-f result" "should exist"
|
|
assert_file_contains "result" " - finalize_nix_ci"
|
|
'';
|
|
}
|
|
];
|
|
};
|
|
}
|