add function to mirror system config in home config
This commit is contained in:
10 files changed
+69
-20
No files matched your search
@@ -10,7 +10,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
flake.homeModules.graphics = { lib, pkgs, osConfig, config, ... }: {
|
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 = {
|
home.activation = {
|
||||||
symlinkNoctaliaState = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
symlinkNoctaliaState = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||||
target = ".local/state/noctalia/settings.toml";
|
target = ".local/state/noctalia/settings.toml";
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
flake.homeModules.graphics = { lib, osConfig, config, ... }: {
|
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 {
|
home.activation.symlinkNiriConfig = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||||
target = ".config/niri/config.kdl";
|
target = ".config/niri/config.kdl";
|
||||||
source = "dotfiles/${config.info.hostName}/niri.kdl";
|
source = "dotfiles/${config.info.hostName}/niri.kdl";
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
let
|
let
|
||||||
firefox-addons = with pkgs; inputs.firefox-addons.packages.${system};
|
firefox-addons = with pkgs; inputs.firefox-addons.packages.${system};
|
||||||
in {
|
in {
|
||||||
|
stylix.targets.floorp.profileNames = [ "default" ];
|
||||||
|
|
||||||
programs.floorp = {
|
programs.floorp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
nativeMessagingHosts = [
|
nativeMessagingHosts = [
|
||||||
@@ -206,8 +208,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}) // lib.optionalAttrs (builtins.hasAttr "osConfig" self) {
|
});
|
||||||
stylix.targets.floorp.profileNames = lib.mkIf (config.features.applications.gui.floorp.enable) [ "default" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
{ inputs, self, ... }: {
|
{ inputs, self, ... }: {
|
||||||
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
|
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
|
||||||
options.features.applications.gui.kitty.enable = lib.mkEnableOption "kitty";
|
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) {
|
config = lib.mkIf (config.features.applications.gui.kitty.enable) {
|
||||||
programs.kitty = {
|
programs.kitty = {
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
flake.homeModules.graphics = { pkgs, osConfig, config, lib, ... }: {
|
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 = [
|
gtk.gtk3.bookmarks = [
|
||||||
"file://${config.info.rootPath} NixOS"
|
"file://${config.info.rootPath} NixOS"
|
||||||
"file:///home/grey/Downloads Downloads"
|
"file:///home/grey/Downloads Downloads"
|
||||||
@@ -30,6 +32,6 @@
|
|||||||
"file:///home/grey/Videos Videos"
|
"file:///home/grey/Videos Videos"
|
||||||
"file:/// Root"
|
"file:/// Root"
|
||||||
];
|
];
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
{ inputs, self, ... }: {
|
{ inputs, self, ... }: {
|
||||||
flake.homeModules.graphics = { config, pkgs, lib, ... }: {
|
flake.nixosModules.graphics = { config, pkgs, lib, ... }: {
|
||||||
options.features.applications.gui.vscode.enable = lib.mkEnableOption "vscode";
|
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) {
|
config = lib.mkIf (config.features.applications.gui.vscode.enable) {
|
||||||
home.packages = [ pkgs.vscode ];
|
home.packages = [ pkgs.vscode ];
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
antidote.enable = lib.mkEnableOption "antidote";
|
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;
|
home.shell.enableZshIntegration = true;
|
||||||
|
|
||||||
programs.kitty.shellIntegration.enableZshIntegration = true;
|
programs.kitty.shellIntegration.enableZshIntegration = true;
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
completionInit = "";
|
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;
|
enable = true;
|
||||||
plugins = [
|
plugins = [
|
||||||
"getantidote/use-omz"
|
"getantidote/use-omz"
|
||||||
|
|||||||
@@ -1,11 +1,37 @@
|
|||||||
{ inputs, self, ... }: {
|
{ inputs, self, ... }: {
|
||||||
flake.nixosModules.global = { pkgs, config, lib, ... }: {
|
flake.nixosModules.global = { pkgs, config, lib, ... }: {
|
||||||
options.helpers = {
|
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 = {
|
options.helpers = {
|
||||||
mkSymlinkActivationScript = lib.mkOption {
|
mkSymlinkActivationScript = lib.mkOption {
|
||||||
type = lib.types.functionTo lib.types.str;
|
type = lib.types.functionTo lib.types.str;
|
||||||
@@ -15,6 +41,19 @@
|
|||||||
fi
|
fi
|
||||||
ln -s ${config.info.rootPath}/${source} /home/grey/${target}
|
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;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
speedtest-go
|
speedtest-go
|
||||||
] ++ config.features.applications.extraPackages
|
] ++ config.features.applications.extraPackages
|
||||||
++ (if !(builtins.hasAttr "osConfig" self) then [
|
++ (if !(builtins.tryEval osConfig).success then [
|
||||||
pkgs.home-manager
|
pkgs.home-manager
|
||||||
] else []);
|
] else []);
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
xdg = {
|
xdg = {
|
||||||
enable = true;
|
enable = true;
|
||||||
localBinInPath = !(builtins.hasAttr "osConfig" self);
|
localBinInPath = !(builtins.tryEval osConfig).success;
|
||||||
};
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
|
|||||||
@@ -33,10 +33,7 @@
|
|||||||
|
|
||||||
applications = {
|
applications = {
|
||||||
gui = {
|
gui = {
|
||||||
spotify = {
|
kitty.enable = true;
|
||||||
enable = true;
|
|
||||||
spicetify.enable = true;
|
|
||||||
};
|
|
||||||
vscode.enable = true;
|
vscode.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -102,8 +99,11 @@
|
|||||||
gui = {
|
gui = {
|
||||||
equibop.enable = true;
|
equibop.enable = true;
|
||||||
floorp.enable = true;
|
floorp.enable = true;
|
||||||
kitty.enable = true;
|
|
||||||
remmina.enable = true;
|
remmina.enable = true;
|
||||||
|
spotify = {
|
||||||
|
enable = true;
|
||||||
|
spicetify.enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
|
|||||||
Reference in new issue
Block a user