]> Git — Sourcephile - sourcephile-nix.git/blob - tests.nix
nix: add tests.nix
[sourcephile-nix.git] / tests.nix
1 # Run with : nix -L run -f tests.nix
2 # Debug with : nix run -f tests.nix driver nixos-test-driver
3 { system ? builtins.currentSystem,
4 config ? {},
5 overlays ? import ./overlays.nix,
6 pkgs ? import <nixpkgs> { inherit system config overlays; },
7 lib ? pkgs.lib,
8 }:
9
10 let nixosTest =
11 (import (pkgs.path + /nixos/lib/testing-python.nix)) {
12 inherit system pkgs;
13 extraConfigurations = [
14 ({ lib, ... }: {
15 # Propagate pkgs and its overlays to the VM,
16 # instead of reloading nixpkgs.
17 config.nixpkgs.pkgs = lib.mkDefault pkgs;
18 config.documentation.enable = false;
19 })
20 ];
21 };
22 deployment = "staging";
23 in
24
25 nixosTest.makeTest {
26 nodes = {
27 mermet = {pkgs, ...}@attrs: {};
28 };
29
30 #enableOCR = true;
31 #skipLint = true;
32 testScript = ''
33 # start_all()
34 mermet.start()
35 mermet.wait_for_unit("multi-user.target")
36 mermet.succeed(
37 "mkdir /tmp/test",
38 "mount -t tmpfs none /tmp/test",
39 "touch /tmp/test/hello",
40 "test -f /tmp/test/hello",
41 )
42 '';
43 }