refactor: centralize workstation HM base and derive terminal from user metadata
This commit is contained in:
@@ -41,8 +41,27 @@
|
||||
inherit (display) mode;
|
||||
}
|
||||
) config.meta.host.displays;
|
||||
rawTerminalAttrPath = lib.splitString "." config.meta.user.terminalPackageAttr;
|
||||
terminalAttrPath =
|
||||
if rawTerminalAttrPath != [ ] && builtins.head rawTerminalAttrPath == "pkgs" then
|
||||
builtins.tail rawTerminalAttrPath
|
||||
else
|
||||
rawTerminalAttrPath;
|
||||
terminalPackage = lib.attrByPath terminalAttrPath null pkgs;
|
||||
hasMainProgram = terminalPackage != null && terminalPackage ? meta.mainProgram;
|
||||
in
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = terminalPackage != null;
|
||||
message = "Unknown terminal package `${config.meta.user.terminalPackageAttr}` for user `${config.meta.user.name}`.";
|
||||
}
|
||||
{
|
||||
assertion = hasMainProgram;
|
||||
message = "Terminal package `${config.meta.user.terminalPackageAttr}` must define `meta.mainProgram`.";
|
||||
}
|
||||
];
|
||||
|
||||
home.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
|
||||
dconf.settings = {
|
||||
@@ -123,7 +142,16 @@
|
||||
mouse.accel-speed = 0.4;
|
||||
};
|
||||
|
||||
binds = import ./_bindings.nix;
|
||||
binds =
|
||||
if hasMainProgram then
|
||||
import ./_bindings.nix {
|
||||
inherit
|
||||
lib
|
||||
terminalPackage
|
||||
;
|
||||
}
|
||||
else
|
||||
{ };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user