2022-08-25 15:16:26 +02:00
|
|
|
{ makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix>
|
2022-09-30 12:55:28 +02:00
|
|
|
, eval-config ? import <nixpkgs/nixos/lib/eval-config.nix>
|
2022-08-26 08:41:58 +02:00
|
|
|
, pkgs ? (import <nixpkgs> { })
|
2022-08-25 15:16:26 +02:00
|
|
|
}@args:
|
2022-08-25 23:12:49 +02:00
|
|
|
let
|
2023-02-07 15:37:12 +00:00
|
|
|
lib = pkgs.lib;
|
|
|
|
|
makeDiskoTest = (pkgs.callPackage ./lib.nix { inherit makeTest eval-config; }).makeDiskoTest;
|
2022-09-04 12:44:38 +02: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 23:12:49 +02:00
|
|
|
allTestFilenames =
|
|
|
|
|
builtins.map (lib.removeSuffix ".nix") (
|
|
|
|
|
builtins.filter
|
|
|
|
|
(x: lib.hasSuffix ".nix" x && x != "default.nix" && x != "lib.nix")
|
|
|
|
|
(lib.attrNames (builtins.readDir ./.))
|
|
|
|
|
);
|
|
|
|
|
|
2023-02-06 14:24:34 +00:00
|
|
|
allTests = lib.genAttrs allTestFilenames (test: import (./. + "/${test}.nix") { inherit makeDiskoTest pkgs; }) //
|
2022-09-04 13:09:10 +02:00
|
|
|
evalTest "lvm-luks-example" ../example/config.nix // {
|
|
|
|
|
standalone = (pkgs.nixos [ ../example/stand-alone/configuration.nix ]).config.system.build.toplevel;
|
|
|
|
|
};
|
2022-08-26 08:41:58 +02:00
|
|
|
in
|
|
|
|
|
allTests
|