diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/i3.nix | 14 | ||||
-rw-r--r-- | tests/make-test.nix | 28 |
2 files changed, 34 insertions, 8 deletions
diff --git a/tests/i3.nix b/tests/i3.nix index 0505b67f..e0842bc6 100644 --- a/tests/i3.nix +++ b/tests/i3.nix @@ -1,11 +1,12 @@ -import <nixpkgs/nixos/tests/make-test.nix> ({ pkgs, ... }: { +import ./make-test.nix ({ pkgs, ... }: { name = "i3"; machine = { lib, ... }: { - imports = [ - ../common.nix - <nixpkgs/nixos/tests/common/x11.nix> - ]; + imports = [ <nixpkgs/nixos/tests/common/x11.nix> ]; + + vuizvui.user.aszlig.profiles.base.enable = true; + vuizvui.user.aszlig.services.i3.enable = true; + services.xserver.windowManager.default = lib.mkForce "i3"; /* XXX */ fonts = { @@ -18,9 +19,6 @@ import <nixpkgs/nixos/tests/make-test.nix> ({ pkgs, ... }: { ]; }; /* !XXX */ - vuizvui = { - i3.enable = true; - }; }; testScript = { nodes, ... }: '' diff --git a/tests/make-test.nix b/tests/make-test.nix new file mode 100644 index 00000000..9276dae3 --- /dev/null +++ b/tests/make-test.nix @@ -0,0 +1,28 @@ +f: { system ? builtins.currentSystem, ... } @ args: let + lib = import <nixpkgs/lib>; + + testLib = import <nixpkgs/nixos/lib/testing.nix> { + inherit system; + }; + + pkgs = import <nixpkgs> { inherit system; }; + + testArgs = if builtins.isFunction f then f (args // { + pkgs = pkgs // { + vuizvui = import ../pkgs { inherit pkgs; }; + }; + }) else f; + + nodes = testArgs.nodes or (if testArgs ? machine then { + inherit (testArgs) machine; + } else {}); + + injectCommon = name: conf: { + imports = [ conf ] ++ import ../modules/module-list.nix; + }; + + testArgsWithCommon = removeAttrs testArgs [ "machine" ] // { + nodes = lib.mapAttrs injectCommon nodes; + }; + +in testLib.makeTest testArgsWithCommon |