centralized hypr & noctalia config control + added fws1 correct hardware
This commit is contained in:
1 parent
bdfcb9e814
commit
76e396cd43
11 files changed
+94
-159
No files matched your search
@@ -10,55 +10,18 @@ let
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
hyprlandPkg = hyprland.packages.${system}.hyprland;
|
||||
hyprlandPortal = hyprland.packages.${system}.xdg-desktop-portal-hyprland;
|
||||
|
||||
# When mountAsSource is set, build a real, GC-protected copy of the hypr config
|
||||
# dir. The flake self-source path (skyg.rootDir) is not referenced by the system
|
||||
# closure, so it gets garbage-collected and the ~/.config/hypr symlink dangles.
|
||||
# This derivation is added to the system profile, pinning it against GC.
|
||||
bakedHyprConfig = pkgs.stdenv.mkDerivation {
|
||||
pname = "${cfg.configName}-hypr-config";
|
||||
version = "1";
|
||||
src = "${config.skyg.rootDir}/configs/${cfg.configName}/hypr";
|
||||
buildPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p "$out/${cfg.configName}"
|
||||
cp -r "$src" "$out/${cfg.configName}/hypr"
|
||||
'';
|
||||
bakedConfig = skygUtils.bakeConfig {
|
||||
configName = cfg.configLink.name;
|
||||
configType = "hypr";
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
skyg.nixos.desktop.tiler.hyprland = {
|
||||
enable = lib.mkEnableOption "hyprland";
|
||||
configName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = config.skyg.core.hostName;
|
||||
description = ''
|
||||
Name of the per-host Hyprland config directory under `configs/`.
|
||||
The module symlinks `~/.config/hypr` -> `configs/<configName>/hypr`.
|
||||
Defaults to the machine's hostName (e.g. `fwbook` -> `configs/fwbook/hypr`).
|
||||
'';
|
||||
};
|
||||
configLink = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to symlink `~/.config/hypr` -> `configs/<configName>/hypr`.
|
||||
Disable on hosts that manage their own Hyprland config elsewhere.
|
||||
'';
|
||||
};
|
||||
mountAsSource = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
If `configLink.enable` is true, embed the config dir in the build.
|
||||
A GC-protected copy of the config is baked into the system closure
|
||||
(via a derivation added to the system profile) instead of symlinking
|
||||
to the live `~/nixos-setup/configs` checkout, making the config part
|
||||
of the built system and reproducible.
|
||||
'';
|
||||
};
|
||||
configLink = skygUtils.makeConfigLinkOptions {
|
||||
hostName = config.skyg.core.hostName;
|
||||
configType = "hypr";
|
||||
};
|
||||
tools = {
|
||||
enable = lib.mkEnableOption "Hyprland shell tools (hypridle, wofi, rofi, grim, slurp, satty)";
|
||||
@@ -93,16 +56,16 @@ in
|
||||
grim
|
||||
slurp
|
||||
satty
|
||||
]) ++ (lib.optionals cfg.configLink.mountAsSource [ bakedHyprConfig ]);
|
||||
]) ++ (lib.optionals cfg.configLink.mountAsSource [ bakedConfig ]);
|
||||
|
||||
# Symlink ~/.config/hypr -> configs/<configName>/hypr (host-specific).
|
||||
system.userActivationScripts.hyprlandConfig = lib.mkIf cfg.configLink.enable {
|
||||
text = skygUtils.makeHyperlinkScriptToConfigs {
|
||||
filePath = "${cfg.configName}/hypr";
|
||||
filePath = "${cfg.configLink.name}/hypr";
|
||||
targetPath = "hypr";
|
||||
configSource =
|
||||
if cfg.configLink.mountAsSource then
|
||||
"${bakedHyprConfig}"
|
||||
"${bakedConfig}"
|
||||
else
|
||||
"/home/${config.skyg.user.name}/nixos-setup/configs";
|
||||
};
|
||||
|
||||
@@ -9,30 +9,35 @@ let
|
||||
cfg = config.skyg.nixos.desktop.tiler.noctalia;
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
noctaliaPkg = noctalia.packages.${system}.default;
|
||||
bakedConfig = skygUtils.bakeConfig {
|
||||
configName = cfg.configLink.name;
|
||||
configType = "noctalia";
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
skyg.nixos.desktop.tiler.noctalia = {
|
||||
enable = lib.mkEnableOption "noctalia";
|
||||
configName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = config.skyg.core.hostName;
|
||||
description = ''
|
||||
Name of the per-host noctalia config directory under `configs/`.
|
||||
The module symlinks `~/.config/noctalia` -> `configs/<configName>/noctalia`.
|
||||
Defaults to the machine's hostName (e.g. `fwbook` -> `configs/fwbook/noctalia`).
|
||||
'';
|
||||
configLink = skygUtils.makeConfigLinkOptions {
|
||||
hostName = config.skyg.core.hostName;
|
||||
configType = "noctalia";
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ noctaliaPkg ];
|
||||
environment.systemPackages = [ noctaliaPkg ] ++ (lib.optionals cfg.configLink.mountAsSource [ bakedConfig ]);
|
||||
|
||||
# Symlink ~/.config/noctalia -> configs/<configName>/noctalia (host-specific).
|
||||
system.userActivationScripts.noctaliaCfg.text = skygUtils.makeHyperlinkScriptToConfigs {
|
||||
filePath = "${cfg.configName}/noctalia";
|
||||
targetPath = "noctalia";
|
||||
configSource = "/home/${config.skyg.user.name}/nixos-setup/configs";
|
||||
system.userActivationScripts.noctaliaCfg = lib.mkIf cfg.configLink.enable {
|
||||
text = skygUtils.makeHyperlinkScriptToConfigs {
|
||||
filePath = "${cfg.configLink.name}/noctalia";
|
||||
targetPath = "noctalia";
|
||||
configSource =
|
||||
if cfg.configLink.mountAsSource then
|
||||
"${bakedConfig}"
|
||||
else
|
||||
"/home/${config.skyg.user.name}/nixos-setup/configs";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user