107 lines
2.7 KiB
Nix
107 lines
2.7 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
homeModules = config.flake.modules.homeManager;
|
|
mkPortableSettings =
|
|
baseSettings:
|
|
lib.recursiveUpdate baseSettings {
|
|
bar.widgets.right = baseSettings.bar.widgets.right ++ [
|
|
{
|
|
id = "Battery";
|
|
}
|
|
];
|
|
};
|
|
in
|
|
{
|
|
flake.modules.homeManager.noctalia =
|
|
{
|
|
inputs,
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
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;
|
|
baseSettings =
|
|
if hasMainProgram then
|
|
import ./_noctalia-config.nix {
|
|
inherit
|
|
lib
|
|
terminalPackage
|
|
;
|
|
}
|
|
else
|
|
{ };
|
|
in
|
|
{
|
|
imports = [ inputs.noctalia.homeModules.default ];
|
|
|
|
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`.";
|
|
}
|
|
];
|
|
|
|
programs.noctalia-shell = {
|
|
enable = true;
|
|
package = lib.mkForce (
|
|
inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
|
|
calendarSupport = true;
|
|
}
|
|
);
|
|
|
|
settings = baseSettings;
|
|
};
|
|
};
|
|
|
|
flake.modules.homeManager.noctalia-portable =
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
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;
|
|
baseSettings =
|
|
if hasMainProgram then
|
|
import ./_noctalia-config.nix {
|
|
inherit
|
|
lib
|
|
terminalPackage
|
|
;
|
|
}
|
|
else
|
|
{ };
|
|
in
|
|
{
|
|
imports = [ homeModules.noctalia ];
|
|
programs.noctalia-shell.settings = lib.mkForce (
|
|
if hasMainProgram then mkPortableSettings baseSettings else { }
|
|
);
|
|
};
|
|
}
|