fix(utils): provide clear error for missing role files
This commit is contained in:
parent
c930ef6328
commit
b3368553a2
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user