Allow dynamically loading user home configs

This commit is contained in:
Manuel Thalmann 2024-05-09 01:10:26 +02:00
parent 742b1d2029
commit b0a08d549f
2 changed files with 13 additions and 7 deletions

View file

@ -112,13 +112,8 @@
"${username}@${hostname}" = {
modules =
let
userConfigPath = (
tryFiles [
./lib/users/${username}/${hostname}.nix
./lib/users/${username}/common.nix
./lib/users/${username}.nix
]
null);
getUserConfig = import ./lib/utils/user-config.nix { inherit lib; };
userConfigPath = getUserConfig { inherit hostname username; };
in [
(
{ pkgs, ... }: {

11
lib/utils/user-config.nix Normal file
View file

@ -0,0 +1,11 @@
{ lib, ... }:
let
tryFiles = import ./try-files.nix { inherit lib; };
in
{ hostname, username, ... }:
tryFiles [
../users/${username}/${hostname}.nix
../users${username}/common.nix
../users/${username}.nix
]
null