Skip to content

Commit

Permalink
ci(nix): Check that $OMNIX_SOURCE is buildable
Browse files Browse the repository at this point in the history
Do it without building it; just evaluating the drv is enough.
  • Loading branch information
srid committed Oct 26, 2024
1 parent db74dfd commit bf1806e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
4 changes: 4 additions & 0 deletions nix/modules/flake-parts/om.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
name = "check-closure-size";
systems = [ "x86_64-linux" ]; # We have static binary for Linux only.
};
omnix-source-is-buildable = {
type = "app";
name = "omnix-source-is-buildable";
};
cargo-tests = {
type = "devshell";
command = [ "just" "cargo-test" ];
Expand Down
26 changes: 15 additions & 11 deletions nix/modules/flake-parts/rust.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,20 @@
});
};

checks.omnix-source-has-flake = pkgs.runCommand
"omnix-source-has-flake"
{ buildInputs = [ pkgs.lsd ]; } ''
set -e
cd ${self'.packages.omnix-cli.OMNIX_SOURCE.outPath}
pwd
lsd --tree
test -f flake.nix
test -f flake.lock
touch $out
'';
apps.omnix-source-is-buildable.program = pkgs.writeShellApplication
{
name = "omnix-source-is-buildable";
runtimeInputs = [
pkgs.lsd
pkgs.jq
];
text = ''
set -e
cd ${self'.packages.omnix-cli.OMNIX_SOURCE.outPath}
# Make sure the drv evaluates (to test that no files are accidentally excluded)
nix --accept-flake-config --extra-experimental-features "flakes nix-command" \
derivation show "." | jq -r '.[].outputs.out.path'
'';
};
};
}

0 comments on commit bf1806e

Please sign in to comment.