diff --git a/checks/default.nix b/checks/default.nix index 7ddba15..dd01e89 100644 --- a/checks/default.nix +++ b/checks/default.nix @@ -72,24 +72,17 @@ onlyDrvs (lib.makeScope myLib.newScope (self: src = ./simple; }; - smokeSimple = pkgs.runCommand "smoke-simple" { } '' - # does it run? - ${self.simple}/bin/simple - touch $out - ''; + smoke = callPackage ./smoke.nix { }; + smokeSimple = self.smoke [ "simple" ] self.simple; - smokeOverlappingTargets = - let - overlappingTargets = myLib.buildPackage { - src = ./overlapping-targets; - }; - in - pkgs.runCommand "smoke-overlapping-targets" { } '' - # does it run? - ${overlappingTargets}/bin/foo - ${overlappingTargets}/bin/bar - ${overlappingTargets}/bin/baz - touch $out - ''; + smokeOverlappingTargets = self.smoke [ "foo" "bar" "baz" ] (myLib.buildPackage { + src = ./overlapping-targets; + }); + + smokeWorkspace = self.smoke [ "print" ] self.workspace; + + workspace = myLib.buildPackage { + src = ./workspace; + }; }) ) diff --git a/checks/smoke.nix b/checks/smoke.nix new file mode 100644 index 0000000..690df44 --- /dev/null +++ b/checks/smoke.nix @@ -0,0 +1,13 @@ +{ runCommand +}: + +bins: drv: +let + testList = map (b: "${drv}/bin/${b}") bins; + tests = builtins.concatStringsSep "\n" testList; +in +runCommand "smoke-${drv.name}" { } '' + # does it run? + ${tests} + touch $out +'' diff --git a/checks/workspace/Cargo.lock b/checks/workspace/Cargo.lock new file mode 100644 index 0000000..65b07e1 --- /dev/null +++ b/checks/workspace/Cargo.lock @@ -0,0 +1,19 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "hello" +version = "0.1.0" + +[[package]] +name = "print" +version = "0.1.0" +dependencies = [ + "hello", + "world", +] + +[[package]] +name = "world" +version = "0.1.0" diff --git a/checks/workspace/Cargo.toml b/checks/workspace/Cargo.toml new file mode 100644 index 0000000..44033c4 --- /dev/null +++ b/checks/workspace/Cargo.toml @@ -0,0 +1,4 @@ +[workspace] +# NB: hello and world are intentionally left out cargo will +# promote them to members since they are listed as path deps +members = ["print"] diff --git a/checks/workspace/hello/Cargo.toml b/checks/workspace/hello/Cargo.toml new file mode 100644 index 0000000..60a3916 --- /dev/null +++ b/checks/workspace/hello/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "hello" +version = "0.1.0" +edition = "2021" diff --git a/checks/workspace/hello/src/lib.rs b/checks/workspace/hello/src/lib.rs new file mode 100644 index 0000000..8fd0518 --- /dev/null +++ b/checks/workspace/hello/src/lib.rs @@ -0,0 +1,3 @@ +pub fn hello() -> &'static str { + "hello" +} diff --git a/checks/workspace/print/Cargo.toml b/checks/workspace/print/Cargo.toml new file mode 100644 index 0000000..c81adea --- /dev/null +++ b/checks/workspace/print/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "print" +version = "0.1.0" +edition = "2021" + +[dependencies] +hello = { version = "*", path = "../hello" } +world = { version = "*", path = "../world" } diff --git a/checks/workspace/print/src/main.rs b/checks/workspace/print/src/main.rs new file mode 100644 index 0000000..4e560bf --- /dev/null +++ b/checks/workspace/print/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("{}, {}", hello::hello(), world::world()); +} diff --git a/checks/workspace/world/Cargo.toml b/checks/workspace/world/Cargo.toml new file mode 100644 index 0000000..deb61af --- /dev/null +++ b/checks/workspace/world/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "world" +version = "0.1.0" +edition = "2021" diff --git a/checks/workspace/world/src/lib.rs b/checks/workspace/world/src/lib.rs new file mode 100644 index 0000000..45475d5 --- /dev/null +++ b/checks/workspace/world/src/lib.rs @@ -0,0 +1,3 @@ +pub fn world() -> &'static str { + "world!" +}