Skip to content
Snippets Groups Projects
Commit 5364cba1 authored by Jens Nolte's avatar Jens Nolte
Browse files

Load extra layers from machines repo

parent cb544b05
No related branches found
No related tags found
No related merge requests found
# This is the entry point for my NixOS configuration.
{ name, path, channel, isIso }:
{ name, path, channel, isIso, extraLayersDir }:
{ lib, config, pkgs, ... }:
let
......@@ -8,8 +8,19 @@ let
layerPath = layerName: let
filePath = ./layers + "/${layerName}.nix";
dirPath = ./layers + "/${layerName}";
extraDirFilePath = extraLayersDir + "/${layerName}.nix";
extraDirDirPath = extraLayersDir + "/${layerName}";
in
if builtins.pathExists filePath then filePath else dirPath;
if builtins.pathExists filePath
then filePath
else if builtins.pathExists dirPath
then dirPath
else if builtins.pathExists extraDirFilePath
then extraDirFilePath
else if builtins.pathExists extraDirDirPath
then extraDirDirPath
else builtins.throw "Cannot find layer `${layerName}`";
layerImports = map layerPath dotfilesConfig.layers;
in
({
......
# entry point for machine configurations:
# (import <repo-path> { machinesDir=./machines }).<netname>.configurations.<hostname>
{ machinesDir }:
{ machinesDir, extraLayersDir }:
with builtins;
let
......@@ -33,7 +33,7 @@ let
withMachines = lambda: listToAttrs (map (m: {name = m; value = lambda { name = m; path = (machinesDir + "/${m}"); }; }) machineNames);
mkMachineConfig = { name, path, isIso ? false }: (
import ./configuration.nix {
inherit name path isIso;
inherit name path isIso extraLayersDir;
channel = machineChannels.${name};
}
);
......@@ -82,4 +82,4 @@ in
nixosIsoDerivations = withMachines mkNixosIsoDerivation;
machineTemplates = withMachines ({name, path}: import (path + /template.nix));
channels = machineChannels;
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment