2022-08-25 13:16:26 +00:00
|
|
|
{ makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix>
|
2022-08-26 06:41:58 +00:00
|
|
|
, pkgs ? (import <nixpkgs> { })
|
2022-08-25 13:16:26 +00:00
|
|
|
}@args:
|
2022-08-25 21:12:49 +00:00
|
|
|
let
|
|
|
|
lib = pkgs.lib;
|
|
|
|
makeDiskoTest = (pkgs.callPackage ./lib.nix { inherit makeTest; }).makeDiskoTest;
|
2022-09-04 10:44:38 +00:00
|
|
|
|
|
|
|
evalTest = name: configFile: let
|
|
|
|
disko-config = import configFile;
|
|
|
|
in {
|
|
|
|
"${name}-tsp-create" = pkgs.writeScript "create" ((pkgs.callPackage ../. { }).create disko-config);
|
|
|
|
"${name}-tsp-mount" = pkgs.writeScript "mount" ((pkgs.callPackage ../. { }).mount disko-config);
|
|
|
|
};
|
|
|
|
|
2022-08-25 21:12:49 +00:00
|
|
|
allTestFilenames =
|
|
|
|
builtins.map (lib.removeSuffix ".nix") (
|
|
|
|
builtins.filter
|
|
|
|
(x: lib.hasSuffix ".nix" x && x != "default.nix" && x != "lib.nix")
|
|
|
|
(lib.attrNames (builtins.readDir ./.))
|
|
|
|
);
|
|
|
|
|
2022-09-04 10:44:38 +00:00
|
|
|
allTests = lib.genAttrs (allTestFilenames) (test: import (./. + "/${test}.nix") { inherit makeDiskoTest; }) //
|
|
|
|
evalTest "lvm-luks-example" ../example/config.nix;
|
2022-08-26 06:41:58 +00:00
|
|
|
in
|
|
|
|
allTests
|