inline lib/merge-modules.nix
it wasn't really adding value once I learned that evalModules is at nixpkgs.lib https://github.com/telent/liminix/compare/main...vesim987:liminix:main#diff-8ebcd005c04c8eddff72aa83f26a9ee6cfef3c04ce16b8f051aa6c6f4b0c9e73L1
This commit is contained in:
parent
8915f828a5
commit
b60ce985b7
7 changed files with 11 additions and 67 deletions
|
@ -11,14 +11,17 @@ let
|
||||||
config = {allowUnsupportedSystem = true; };
|
config = {allowUnsupportedSystem = true; };
|
||||||
});
|
});
|
||||||
|
|
||||||
config = (import ./lib/merge-modules.nix) [
|
config = (pkgs.lib.evalModules {
|
||||||
|
modules = [
|
||||||
|
{ _module.args = { inherit pkgs; lib = pkgs.lib; }; }
|
||||||
./modules/base.nix
|
./modules/base.nix
|
||||||
device.module
|
device.module
|
||||||
liminix-config
|
liminix-config
|
||||||
./modules/s6
|
./modules/s6
|
||||||
./modules/users.nix
|
./modules/users.nix
|
||||||
./modules/outputs.nix
|
./modules/outputs.nix
|
||||||
] pkgs;
|
];
|
||||||
|
}).config;
|
||||||
|
|
||||||
borderVm = ((import <nixpkgs/nixos/lib/eval-config.nix>) {
|
borderVm = ((import <nixpkgs/nixos/lib/eval-config.nix>) {
|
||||||
system = builtins.currentSystem;
|
system = builtins.currentSystem;
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
modules : pkgs :
|
|
||||||
let evalModules = (import <nixpkgs/lib>).evalModules;
|
|
||||||
in (evalModules {
|
|
||||||
modules =
|
|
||||||
[
|
|
||||||
{ _module.args = { inherit pkgs; lib = pkgs.lib; }; }
|
|
||||||
] ++ modules;
|
|
||||||
}).config
|
|
|
@ -1,10 +0,0 @@
|
||||||
{ config, pkgs, ... } :
|
|
||||||
{
|
|
||||||
imports = [ ./defs.nix ./module.nix ];
|
|
||||||
config = {
|
|
||||||
services.a.enable = true;
|
|
||||||
services.b.enable = true;
|
|
||||||
|
|
||||||
systemPackages = [ pkgs.hello ] ;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
{ lib, ...}:
|
|
||||||
let inherit (lib) mkEnableOption mkOption types;
|
|
||||||
in {
|
|
||||||
options = {
|
|
||||||
services.a = {
|
|
||||||
enable = mkEnableOption "hello service";
|
|
||||||
};
|
|
||||||
services.b = {
|
|
||||||
enable = mkEnableOption "other service";
|
|
||||||
};
|
|
||||||
services.z = mkOption { };
|
|
||||||
systemPackages = mkOption {
|
|
||||||
type = types.listOf types.package;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{ config, pkgs, ... } :
|
|
||||||
{
|
|
||||||
services.z = pkgs.figlet;
|
|
||||||
|
|
||||||
systemPackages = [ pkgs.units ] ;
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
set -e
|
|
||||||
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix-build --arg device "import <liminix/devices/qemu>" test.nix
|
|
|
@ -1,17 +0,0 @@
|
||||||
{ device }:
|
|
||||||
let
|
|
||||||
overlay = import <liminix/overlay.nix> ;
|
|
||||||
nixpkgs = import <nixpkgs> ( device.system // {overlays = [overlay]; });
|
|
||||||
inherit (nixpkgs) lib pkgs;
|
|
||||||
inherit (lib.asserts) assertMsg;
|
|
||||||
config =
|
|
||||||
(import <liminix/merge-modules.nix>) [./configuration.nix] pkgs;
|
|
||||||
res1 = assertMsg
|
|
||||||
# check we have packages from both modules
|
|
||||||
(config.systemPackages == ( with pkgs; [ units hello ])) "failed";
|
|
||||||
res2 = let s = config.services;
|
|
||||||
in assertMsg (s.a.enable && s.b.enable && (s.z != null) ) "failed";
|
|
||||||
in pkgs.writeText "foo" ''
|
|
||||||
${if res1 then "OK" else "not OK"}
|
|
||||||
${if res2 then "OK" else "not OK"}
|
|
||||||
''
|
|
Loading…
Reference in a new issue