lib: move into lib/config

This commit is contained in:
Astro 2021-03-19 01:24:31 +01:00
parent bf06bbe809
commit 7b7745e376
10 changed files with 30 additions and 15 deletions

View File

@ -12,6 +12,9 @@
forAllSystems = nixpkgs.lib.genAttrs systems;
in
rec {
lib = forAllSystems (system:
import ./nix/lib { inherit nixpkgs system; }
);
packages = forAllSystems (system: {
test_vm = nixpkgs.legacyPackages.${system}.runCommandLocal "test_vm" {

View File

@ -0,0 +1,18 @@
{ pkgs ? import <nixpkgs> {} }:
let
result = pkgs.lib.evalModules {
args.pkgs = pkgs;
modules = [
./options.nix
./legacy.nix
./device-templates.nix
];
};
in
builtins.foldl' (config: warnings:
if warnings == []
then config
else
builtins.trace "WARNING: ${builtins.head warnings}" config
) result.config result.config.warnings

View File

@ -1,18 +1,12 @@
{ pkgs ? import <nixpkgs> {} }:
{ nixpkgs, system }:
let
result = pkgs.lib.evalModules {
args.pkgs = pkgs;
modules = [
./options.nix
./legacy.nix
./device-templates.nix
];
};
pkgs = nixpkgs.legacyPackages.${system};
in
builtins.foldl' (config: warnings:
if warnings == []
then config
else
builtins.trace "WARNING: ${builtins.head warnings}" config
) result.config result.config.warnings
{
config = import ./config { inherit pkgs; };
netmasks = import ./netmasks.nix;
subnet = import ./subnet { inherit pkgs; };
}