add function to mirror system config in home config

This commit is contained in:
greyweather committed 2026-08-28 04:07:48 +01:00
1 parent 3af64e993c
commit 1c1174edd3
10 files changed
+69 -20

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@
};
flake.homeModules.graphics = { lib, pkgs, osConfig, config, ... }: {
config = lib.mkIf (builtins.hasAttr "osConfig" self) (lib.mkIf ((osConfig.components.shells == "noctalia")||(builtins.elem "noctalia" osConfig.components.shells)) {
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";
+1 -1
View File
@@ -40,7 +40,7 @@
};
flake.homeModules.graphics = { lib, osConfig, config, ... }: {
config = lib.mkIf (builtins.hasAttr "osConfig" self) (lib.mkIf ((osConfig.components.windowManagers == "niri")||(builtins.elem "niri" osConfig.components.windowManagers)) {
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";
+3 -3
View File
@@ -6,6 +6,8 @@
let
firefox-addons = with pkgs; inputs.firefox-addons.packages.${system};
in {
stylix.targets.floorp.profileNames = [ "default" ];
programs.floorp = {
enable = true;
nativeMessagingHosts = [
@@ -206,8 +208,6 @@
};
};
};
}) // lib.optionalAttrs (builtins.hasAttr "osConfig" self) {
stylix.targets.floorp.profileNames = lib.mkIf (config.features.applications.gui.floorp.enable) [ "default" ];
};
});
};
}
+5 -1
View File
@@ -1,6 +1,10 @@
{ inputs, self, ... }: {
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
options.features.applications.gui.kitty.enable = lib.mkEnableOption "kitty";
};
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
options.features.applications.gui.kitty.enable = lib.mkOption (config.helpers.inheritOsConfigToHome "features.applications.gui.kitty.enable");
config = lib.mkIf (config.features.applications.gui.kitty.enable) {
programs.kitty = {
@@ -20,7 +20,9 @@
};
flake.homeModules.graphics = { pkgs, osConfig, config, lib, ... }: {
config = lib.mkIf (builtins.hasAttr "osConfig" self) (lib.mkIf (osConfig.features.applications.gui.nautilus.enable) {
options.features.applications.gui.nautilus.enable = lib.mkOption (config.helpers.inheritOsConfigToHome "features.applications.gui.nautilus.enable");
config = lib.mkIf (config.features.applications.gui.nautilus.enable) {
gtk.gtk3.bookmarks = [
"file://${config.info.rootPath} NixOS"
"file:///home/grey/Downloads Downloads"
@@ -30,6 +32,6 @@
"file:///home/grey/Videos Videos"
"file:/// Root"
];
});
};
};
}
+5 -1
View File
@@ -1,6 +1,10 @@
{ inputs, self, ... }: {
flake.homeModules.graphics = { config, pkgs, lib, ... }: {
flake.nixosModules.graphics = { config, pkgs, lib, ... }: {
options.features.applications.gui.vscode.enable = lib.mkEnableOption "vscode";
};
flake.homeModules.graphics = { config, pkgs, lib, ... }: {
options.features.applications.gui.vscode.enable = lib.mkOption (config.helpers.inheritOsConfigToHome "features.applications.gui.vscode.enable");
config = lib.mkIf (config.features.applications.gui.vscode.enable) {
home.packages = [ pkgs.vscode ];
+2 -2
View File
@@ -18,7 +18,7 @@
antidote.enable = lib.mkEnableOption "antidote";
};
config = (if builtins.hasAttr "osConfig" self then (lib.mkIf (osConfig.features.shells.zsh.enable || config.features.shells.zsh.enable)) else (lib.mkIf (config.features.shells.zsh.enable))) {
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))) {
home.shell.enableZshIntegration = true;
programs.kitty.shellIntegration.enableZshIntegration = true;
@@ -26,7 +26,7 @@
programs.zsh = {
enable = true;
completionInit = "";
antidote = (if builtins.hasAttr "osConfig" self 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 = (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))) {
enable = true;
plugins = [
"getantidote/use-omz"
+41 -2
View File
@@ -1,11 +1,37 @@
{ inputs, self, ... }: {
flake.nixosModules.global = { pkgs, config, lib, ... }: {
options.helpers = {
# nothing here yet
typeOf = lib.mkOption {
type = lib.types.functionTo lib.types.str;
default = value: (
if builtins.isAttrs value then "attrs" else (
if builtins.isBool value then "bool" else (
if builtins.isFloat value then "float" else (
if builtins.isFunction value then "function" else (
if builtins.isInt value then "int" else (
if builtins.isList value then "list" else (
if builtins.isPath value then "path" else (
if builtins.isString value then "str" else ""
)
)
)
)
)
)
)
);
readOnly = true;
};
attrByStrPath = lib.mkOption {
default = strPath: set:
lib.attrsets.attrByPath (lib.strings.splitString "." strPath) null set;
readOnly = true;
};
};
};
flake.homeModules.global = { pkgs, config, lib, ... }: {
flake.homeModules.global = { pkgs, config, osConfig, lib, ... }: {
options.helpers = {
mkSymlinkActivationScript = lib.mkOption {
type = lib.types.functionTo lib.types.str;
@@ -15,6 +41,19 @@
fi
ln -s ${config.info.rootPath}/${source} /home/grey/${target}
'';
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;
};
};
};
+2 -2
View File
@@ -12,7 +12,7 @@
packages = with pkgs; [
speedtest-go
] ++ config.features.applications.extraPackages
++ (if !(builtins.hasAttr "osConfig" self) then [
++ (if !(builtins.tryEval osConfig).success then [
pkgs.home-manager
] else []);
@@ -24,7 +24,7 @@
xdg = {
enable = true;
localBinInPath = !(builtins.hasAttr "osConfig" self);
localBinInPath = !(builtins.tryEval osConfig).success;
};
programs = {
+5 -5
View File
@@ -33,10 +33,7 @@
applications = {
gui = {
spotify = {
enable = true;
spicetify.enable = true;
};
kitty.enable = true;
vscode.enable = true;
};
@@ -102,8 +99,11 @@
gui = {
equibop.enable = true;
floorp.enable = true;
kitty.enable = true;
remmina.enable = true;
spotify = {
enable = true;
spicetify.enable = true;
};
};
extraPackages = with pkgs; [