diff --git a/configuration.nix b/configuration.nix index f9774192749ea31e9dd5805bffa66d8396d31864..7537d375c55cac5fa7880b3df9830e2b07a6901b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,5 +1,5 @@ # 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 ({ diff --git a/machine-manager.nix b/machine-manager.nix index 54453148e183c5746d6e737278da3e38b1fabe7d..a92a70283c8bfcb742b2a1df661475b040500eb0 100644 --- a/machine-manager.nix +++ b/machine-manager.nix @@ -1,7 +1,7 @@ # 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 +}