fix(utils): provide clear error for missing role files

This commit is contained in:
Giulio De Pasquale 2025-08-13 10:32:33 +01:00
parent c930ef6328
commit b3368553a2

View File

@ -1,6 +1,24 @@
{ ... }:
let
mkSysRole = role:
let
path = ../roles + "/${role}.nix";
in
if builtins.pathExists path then
import path
else
throw "System role '${role}' not found at ${toString path}";
mkHomeRole = role:
let
path = ../roles/home + "/${role}.nix";
in
if builtins.pathExists path then
import path
else
throw "Home role '${role}' not found at ${toString path}";
in
{
mkSysRole = role: import (../roles/${role}.nix);
mkHomeRole = role: import (../roles/home/${role}.nix);
inherit mkSysRole mkHomeRole;
}