Issue #6161 - Add tests for NixOS modules.

This commit is contained in:
Nicolas B. Pierron
2015-02-08 21:48:38 +01:00
parent d54611bde7
commit 6d15e32536
15 changed files with 192 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
{ lib, ... }:
{
options = {
enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Some descriptive text
'';
};
};
}

View File

@@ -0,0 +1,29 @@
{ lib, ... }:
let
submod = { ... }: {
options = {
enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Some descriptive text
'';
};
};
};
in
{
options = {
loaOfSub = lib.mkOption {
default = {};
example = {};
type = lib.types.loaOf (lib.types.submodule [ submod ]);
description = ''
Some descriptive text
'';
};
};
}

View File

@@ -0,0 +1,7 @@
{ lib ? import <nixpkgs/lib>, modules ? [] }:
{
inherit (lib.evalModules {
inherit modules;
}) config options;
}

View File

@@ -0,0 +1,5 @@
{ lib, ... }:
{
enable = lib.mkForce false;
}

View File

@@ -0,0 +1,3 @@
{
enable = true;
}

View File

@@ -0,0 +1,5 @@
{ lib, ... }:
lib.mkForce {
enable = false;
}

View File

@@ -0,0 +1,5 @@
{ lib, ... }:
lib.mkForce {
loaOfSub.foo.enable = false;
}

View File

@@ -0,0 +1,3 @@
{
loaOfSub.bar.enable = true;
}

View File

@@ -0,0 +1,3 @@
{
loaOfSub.bar = {};
}

View File

@@ -0,0 +1,5 @@
{ lib, ... }:
{
loaOfSub.foo.enable = lib.mkForce false;
}

View File

@@ -0,0 +1,3 @@
{
loaOfSub.foo.enable = true;
}

View File

@@ -0,0 +1,7 @@
{ lib, ... }:
{
loaOfSub.foo = lib.mkForce {
enable = false;
};
}

View File

@@ -0,0 +1,3 @@
{
loaOfSub.foo = {};
}

View File

@@ -0,0 +1,7 @@
{ lib, ... }:
{
loaOfSub = lib.mkForce {
foo.enable = false;
};
}