refactor to fix dependency on 'osConfig' arg

This commit is contained in:
greyweather committed 2026-08-28 05:26:46 +01:00
1 parent 1c1174edd3
commit 22d431e271
11 files changed
+86 -55

No files matched your search

+20 -20
View File
@@ -6,26 +6,26 @@
];
programs.noctalia.enable = true;
home-manager.sharedModules = [
{
home.activation = {
symlinkNoctaliaState = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
target = ".local/state/noctalia/settings.toml";
source = "dotfiles/${config.info.hostName}/noctalia/settings.toml";
});
symlinkNoctaliaStatePlugins = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
target = ".local/state/noctalia/plugins";
source = "dotfiles/${config.info.hostName}/noctalia/plugins";
isDir = true;
});
};
xdg.configFile."noctalia/settings.toml".source = "${self}/dotfiles/${config.info.hostName}/noctalia/settings.toml";
xdg.configFile."noctalia/plugins".source = "${self}/dotfiles/${config.info.hostName}/noctalia/plugins";
}
];
};
};
flake.homeModules.graphics = { lib, pkgs, osConfig, config, ... }: {
config = lib.mkIf (builtins.tryEval osConfig).success (lib.mkIf ((osConfig.components.shells == "noctalia")||(builtins.elem "noctalia" osConfig.components.shells)) {
home.activation = {
symlinkNoctaliaState = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
target = ".local/state/noctalia/settings.toml";
source = "dotfiles/${config.info.hostName}/noctalia/settings.toml";
});
symlinkNoctaliaStatePlugins = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
target = ".local/state/noctalia/plugins";
source = "dotfiles/${config.info.hostName}/noctalia/plugins";
isDir = true;
});
};
xdg.configFile."noctalia/settings.toml".source = "${self}/dotfiles/${config.info.hostName}/noctalia/settings.toml";
xdg.configFile."noctalia/plugins".source = "${self}/dotfiles/${config.info.hostName}/noctalia/plugins";
});
};
}
+9 -9
View File
@@ -36,15 +36,15 @@
}
));
};
home-manager.sharedModules = [
{
home.activation.symlinkNiriConfig = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
target = ".config/niri/config.kdl";
source = "dotfiles/${config.info.hostName}/niri.kdl";
});
}
];
};
};
flake.homeModules.graphics = { lib, osConfig, config, ... }: {
config = lib.mkIf (builtins.tryEval osConfig).success (lib.mkIf ((osConfig.components.windowManagers == "niri")||(builtins.elem "niri" osConfig.components.windowManagers)) {
home.activation.symlinkNiriConfig = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
target = ".config/niri/config.kdl";
source = "dotfiles/${config.info.hostName}/niri.kdl";
});
});
};
}
+9 -3
View File
@@ -1,13 +1,19 @@
{ inputs, self, ... }: {
flake.homeModules.graphics = { pkgs, lib, config, osConfig, ... }: {
flake.nixosModules.graphics = { pkgs, lib, config, ... }: {
home-manager.sharedModules = lib.mkIf (config.features.nixos.stylix.enable) [
({ config, lib, ... }: {
stylix.targets.floorp.profileNames = lib.mkIf (config.features.applications.gui.floorp.enable) [ "default" ];
})
];
};
flake.homeModules.graphics = { pkgs, lib, config, ... }: {
options.features.applications.gui.floorp.enable = lib.mkEnableOption "floorp";
config = lib.mkIf (config.features.applications.gui.floorp.enable) (
let
firefox-addons = with pkgs; inputs.firefox-addons.packages.${system};
in {
stylix.targets.floorp.profileNames = [ "default" ];
programs.floorp = {
enable = true;
nativeMessagingHosts = [
+7 -1
View File
@@ -1,10 +1,16 @@
{ inputs, self, ... }: {
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
options.features.applications.gui.kitty.enable = lib.mkEnableOption "kitty";
config.home-manager.sharedModules = lib.mkIf (config.features.applications.gui.kitty.enable) [
{
features.applications.gui.kitty.enable = true;
}
];
};
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
options.features.applications.gui.kitty.enable = lib.mkOption (config.helpers.inheritOsConfigToHome "features.applications.gui.kitty.enable");
options.features.applications.gui.kitty.enable = lib.mkEnableOption "kitty";
config = lib.mkIf (config.features.applications.gui.kitty.enable) {
programs.kitty = {
@@ -16,11 +16,17 @@
enable = true;
terminal = "kitty";
};
home-manager.sharedModules = [
{
features.applications.gui.nautilus.enable = true;
}
];
};
};
flake.homeModules.graphics = { pkgs, osConfig, config, lib, ... }: {
options.features.applications.gui.nautilus.enable = lib.mkOption (config.helpers.inheritOsConfigToHome "features.applications.gui.nautilus.enable");
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
options.features.applications.gui.nautilus.enable = lib.mkEnableOption "nautilus";
config = lib.mkIf (config.features.applications.gui.nautilus.enable) {
gtk.gtk3.bookmarks = [
+7 -1
View File
@@ -1,10 +1,16 @@
{ inputs, self, ... }: {
flake.nixosModules.graphics = { config, pkgs, lib, ... }: {
options.features.applications.gui.vscode.enable = lib.mkEnableOption "vscode";
config.home-manager.sharedModules = lib.mkIf (config.features.applications.gui.vscode.enable) [
{
features.applications.gui.vscode.enable = true;
}
];
};
flake.homeModules.graphics = { config, pkgs, lib, ... }: {
options.features.applications.gui.vscode.enable = lib.mkOption (config.helpers.inheritOsConfigToHome "features.applications.gui.vscode.enable");
options.features.applications.gui.vscode.enable = lib.mkEnableOption "vscode";
config = lib.mkIf (config.features.applications.gui.vscode.enable) {
home.packages = [ pkgs.vscode ];
+10 -3
View File
@@ -9,16 +9,23 @@
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
users.users."grey".shell = pkgs.zsh;
home-manager.sharedModules = [
{
features.shells.zsh.enable = true;
features.shells.zsh.antidote.enable = lib.mkIf (config.features.shells.zsh.antidote.enable) true;
}
];
};
};
flake.homeModules.global = { pkgs, osConfig, config, lib, ... }: {
flake.homeModules.global = { pkgs, config, lib, ... }: {
options.features.shells.zsh = {
enable = lib.mkEnableOption "zsh";
antidote.enable = lib.mkEnableOption "antidote";
};
config = (if (builtins.tryEval osConfig).success then (lib.mkIf (osConfig.features.shells.zsh.enable || config.features.shells.zsh.enable)) else (lib.mkIf (config.features.shells.zsh.enable))) {
config = lib.mkIf (config.features.shells.zsh.enable) {
home.shell.enableZshIntegration = true;
programs.kitty.shellIntegration.enableZshIntegration = true;
@@ -26,7 +33,7 @@
programs.zsh = {
enable = true;
completionInit = "";
antidote = (if (builtins.tryEval osConfig).success then (lib.mkIf (osConfig.features.shells.zsh.antidote.enable || config.features.shells.zsh.antidote.enable)) else (lib.mkIf (config.features.shells.zsh.antidote.enable))) {
antidote = lib.mkIf (config.features.shells.zsh.antidote.enable) {
enable = true;
plugins = [
"getantidote/use-omz"
+1 -13
View File
@@ -31,7 +31,7 @@
};
};
flake.homeModules.global = { pkgs, config, osConfig, lib, ... }: {
flake.homeModules.global = { pkgs, config, lib, ... }: {
options.helpers = {
mkSymlinkActivationScript = lib.mkOption {
type = lib.types.functionTo lib.types.str;
@@ -43,18 +43,6 @@
'';
readOnly = true;
};
inheritOsConfigToHome = lib.mkOption {
type = lib.types.functionTo lib.types.attrs;
default = let
safeOsConfig = builtins.tryEval osConfig;
in option: {
type = if safeOsConfig.success then safeOsConfig.value.helpers.attrByStrPath (safeOsConfig.value.helpers.typeOf (safeOsConfig.value.helpers.attrByStrPath option safeOsConfig.value)) lib.types else null;
default = (lib.mkIf (safeOsConfig.success) (safeOsConfig.value.helpers.attrByStrPath option safeOsConfig.value)).content;
readOnly = true;
};
readOnly = true;
};
};
};
}
+5 -3
View File
@@ -1,18 +1,20 @@
{ inputs, self, ... }: {
flake.homeModules.global = { config, pkgs, osConfig, ... }: {
flake.homeModules.global = { config, pkgs, ... }: {
nix.gc = {
automatic = true;
persistent = true;
dates = "Sun 05:00";
};
nixpkgs.config.allowUnfree = true;
home = {
stateVersion = config.info.stateVersion;
packages = with pkgs; [
speedtest-go
] ++ config.features.applications.extraPackages
++ (if !(builtins.tryEval osConfig).success then [
++ (if config.info.isStandalone then [
pkgs.home-manager
] else []);
@@ -24,7 +26,7 @@
xdg = {
enable = true;
localBinInPath = !(builtins.tryEval osConfig).success;
localBinInPath = true;
};
programs = {
+5
View File
@@ -49,6 +49,11 @@
type = lib.types.str;
default = "";
};
isStandalone = lib.mkOption {
type = lib.types.bool;
default = false;
};
};
features.applications.extraPackages = lib.mkOption {
+5
View File
@@ -13,6 +13,7 @@
rootPath = "/home/grey/flake";
hostName = "takamaki";
stateVersion = "26.11";
isStandalone = true;
};
features = {
@@ -26,6 +27,10 @@
fastfetch.enable = true;
};
gui = {
vscode.enable = true;
};
extraPackages = with pkgs; [
(writeShellScriptBin "switch-os" ''
sudo efibootmgr --bootnext 0000