[fix] home: revamp options
Query the system configuration for defaults for the options.
This commit is contained in:
parent
1da87b1153
commit
a639e4e214
3 changed files with 45 additions and 27 deletions
|
@ -14,11 +14,7 @@ in {
|
||||||
imports =
|
imports =
|
||||||
[
|
[
|
||||||
# Apply overlays
|
# Apply overlays
|
||||||
{
|
{nixpkgs = {inherit overlays;};}
|
||||||
nixpkgs = {
|
|
||||||
inherit overlays;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
nvim-config
|
nvim-config
|
||||||
./options.nix
|
./options.nix
|
||||||
./gui
|
./gui
|
||||||
|
@ -26,12 +22,11 @@ in {
|
||||||
]
|
]
|
||||||
++ lib.optionals (stylix != null) [
|
++ lib.optionals (stylix != null) [
|
||||||
stylix.homeManagerModules.stylix
|
stylix.homeManagerModules.stylix
|
||||||
{
|
{stylix.image = cfg.sway.background;}
|
||||||
stylix.image = cfg.sway.background;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf (cfg.enable && cfg.styling.enable) {stylix.enable = true;})
|
||||||
(lib.mkIf cfg.enable {
|
(lib.mkIf cfg.enable {
|
||||||
programs = {
|
programs = {
|
||||||
# Better cat (bat)
|
# Better cat (bat)
|
||||||
|
|
|
@ -41,7 +41,7 @@ in {
|
||||||
++ lib.optional flatpakEnabled flatpak;
|
++ lib.optional flatpakEnabled flatpak;
|
||||||
fonts.fontconfig = {
|
fonts.fontconfig = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultFonts = {
|
defaultFonts = lib.mkIf config.jhome.styling.enable {
|
||||||
emoji = ["Noto Color Emoji"];
|
emoji = ["Noto Color Emoji"];
|
||||||
monospace = ["JetBrains Mono" "Symbols Nerd Font"];
|
monospace = ["JetBrains Mono" "Symbols Nerd Font"];
|
||||||
serif = ["Noto Serif" "Symbols Nerd Font"];
|
serif = ["Noto Serif" "Symbols Nerd Font"];
|
||||||
|
@ -54,7 +54,7 @@ in {
|
||||||
# Dynamic Menu
|
# Dynamic Menu
|
||||||
fuzzel = {
|
fuzzel = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.main = {
|
settings.main = lib.mkIf config.jhome.styling.enable {
|
||||||
icon-theme = "Papirus-Dark";
|
icon-theme = "Papirus-Dark";
|
||||||
inherit (cfg) terminal;
|
inherit (cfg) terminal;
|
||||||
layer = "overlay";
|
layer = "overlay";
|
||||||
|
@ -69,8 +69,8 @@ in {
|
||||||
waybar = {
|
waybar = {
|
||||||
enable = true;
|
enable = true;
|
||||||
systemd.enable = true;
|
systemd.enable = true;
|
||||||
settings = import ./waybar-settings.nix {inherit config lib;};
|
settings = lib.mkIf config.jhome.styling.enable (import ./waybar-settings.nix {inherit config lib;});
|
||||||
style = ''
|
style = lib.optionalString config.jhome.styling.enable ''
|
||||||
.modules-left #workspaces button {
|
.modules-left #workspaces button {
|
||||||
border-bottom: 3px solid @base01;
|
border-bottom: 3px solid @base01;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ in {
|
||||||
# Terminal
|
# Terminal
|
||||||
wezterm = {
|
wezterm = {
|
||||||
enable = cfg.terminal == "wezterm";
|
enable = cfg.terminal == "wezterm";
|
||||||
extraConfig = ''
|
extraConfig = lib.optionalString config.jhome.styling.enable ''
|
||||||
config = {}
|
config = {}
|
||||||
config.hide_tab_bar_if_only_one_tab = true
|
config.hide_tab_bar_if_only_one_tab = true
|
||||||
config.window_padding = { left = 1, right = 1, top = 1, bottom = 1 }
|
config.window_padding = { left = 1, right = 1, top = 1, bottom = 1 }
|
||||||
|
@ -90,7 +90,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
alacritty.enable = cfg.terminal == "alacritty";
|
alacritty.enable = cfg.terminal == "alacritty";
|
||||||
zellij.enable = cfg.terminal == "alacritty"; # alacritty has no terminal multiplexerr built in
|
zellij.enable = cfg.terminal == "alacritty"; # alacritty has no terminal multiplexer built-in
|
||||||
# PDF reader
|
# PDF reader
|
||||||
zathura.enable = true;
|
zathura.enable = true;
|
||||||
# Auto start sway
|
# Auto start sway
|
||||||
|
@ -128,26 +128,26 @@ in {
|
||||||
|
|
||||||
# Window Manager
|
# Window Manager
|
||||||
wayland.windowManager.sway = {
|
wayland.windowManager.sway = {
|
||||||
enable = true;
|
inherit (cfg.sway) enable;
|
||||||
package = swayPkg; # no sway package if it comes from the OS
|
package = swayPkg; # no sway package if it comes from the OS
|
||||||
config = import ./sway-config.nix {inherit config pkgs;};
|
config = import ./sway-config.nix {inherit config pkgs;};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Set cursor style
|
# Set cursor style
|
||||||
stylix = {inherit cursor;};
|
stylix = lib.mkIf config.jhome.styling.enable {inherit cursor;};
|
||||||
home.pointerCursor = {
|
home.pointerCursor = lib.mkIf config.jhome.styling.enable (lib.mkDefault {
|
||||||
gtk.enable = true;
|
gtk.enable = true;
|
||||||
inherit (cursor) name package;
|
inherit (cursor) name package;
|
||||||
};
|
});
|
||||||
# Set Gtk theme
|
# Set Gtk theme
|
||||||
gtk = {
|
gtk = lib.mkIf config.jhome.styling.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit iconTheme;
|
inherit iconTheme;
|
||||||
gtk3.extraConfig.gtk-application-prefer-dark-theme = 1;
|
gtk3.extraConfig.gtk-application-prefer-dark-theme = 1;
|
||||||
gtk4.extraConfig.gtk-application-prefer-dark-theme = 1;
|
gtk4.extraConfig.gtk-application-prefer-dark-theme = 1;
|
||||||
};
|
};
|
||||||
# Set Qt theme
|
# Set Qt theme
|
||||||
qt = {
|
qt = lib.mkIf config.jhome.styling.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
platformTheme.name = "gtk";
|
platformTheme.name = "gtk";
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,8 +2,20 @@
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
} @ attrs: let
|
||||||
|
osConfig = attrs.osConfig or null;
|
||||||
inherit (lib) types;
|
inherit (lib) types;
|
||||||
|
fromOs = let
|
||||||
|
get = path: set:
|
||||||
|
if path == []
|
||||||
|
then set
|
||||||
|
else get (builtins.tail path) (builtins.getAttr (builtins.head path) set);
|
||||||
|
in
|
||||||
|
path: default:
|
||||||
|
if osConfig == null
|
||||||
|
then default
|
||||||
|
else get path osConfig;
|
||||||
|
fromConfig = path: default: fromOs (["jconfig"] ++ path) default;
|
||||||
|
|
||||||
mkExtraPackagesOption = name: defaultPkgsPath: let
|
mkExtraPackagesOption = name: defaultPkgsPath: let
|
||||||
text =
|
text =
|
||||||
|
@ -73,13 +85,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
sway.options = {
|
sway.options = {
|
||||||
|
enable = lib.mkEnableOption "sway" // {default = fromConfig ["gui" "sway"] true;};
|
||||||
background = lib.mkOption {
|
background = lib.mkOption {
|
||||||
description = "The wallpaper to use.";
|
description = "The wallpaper to use.";
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = builtins.fetchurl {
|
default = fromConfig ["styling" "wallpaper"] (builtins.fetchurl {
|
||||||
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
|
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
|
||||||
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
|
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
|
||||||
};
|
});
|
||||||
};
|
};
|
||||||
autostart = lib.mkOption {
|
autostart = lib.mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -117,7 +130,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
gui.options = {
|
gui.options = {
|
||||||
enable = lib.mkEnableOption "GUI applications";
|
enable = lib.mkEnableOption "GUI applications" // {default = fromConfig ["gui" "enable"] false;};
|
||||||
tempInfo = lib.mkOption {
|
tempInfo = lib.mkOption {
|
||||||
description = "Temperature info to display in the statusbar.";
|
description = "Temperature info to display in the statusbar.";
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -148,7 +161,7 @@ in {
|
||||||
hostName = lib.mkOption {
|
hostName = lib.mkOption {
|
||||||
description = "The hostname of this system.";
|
description = "The hostname of this system.";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "nixos";
|
default = fromOs ["networking" "hostName"] "nixos";
|
||||||
example = "my pc";
|
example = "my pc";
|
||||||
};
|
};
|
||||||
dev = lib.mkOption {
|
dev = lib.mkOption {
|
||||||
|
@ -156,7 +169,7 @@ in {
|
||||||
default = {};
|
default = {};
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
enable = lib.mkEnableOption "development settings";
|
enable = lib.mkEnableOption "development settings" // {default = fromConfig ["dev" "enable"] false;};
|
||||||
neovimAsManPager = lib.mkEnableOption "neovim as the man pager";
|
neovimAsManPager = lib.mkEnableOption "neovim as the man pager";
|
||||||
extraPackages = mkExtraPackagesOption "dev" [
|
extraPackages = mkExtraPackagesOption "dev" [
|
||||||
["jq"] # json parser
|
["jq"] # json parser
|
||||||
|
@ -172,7 +185,8 @@ in {
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
options.enable = lib.mkEnableOption "rust development settings";
|
options.enable = lib.mkEnableOption "rust development settings";
|
||||||
options.extraPackages = mkExtraPackagesOption "Rust" [
|
options.extraPackages = mkExtraPackagesOption "Rust" [
|
||||||
["cargo-kcov"] # code coverage
|
["cargo-insta"] # snapshot testing
|
||||||
|
["cargo-llvm-cov"] # code coverage
|
||||||
["cargo-msrv"] # minimum supported version
|
["cargo-msrv"] # minimum supported version
|
||||||
["cargo-nextest"] # better testing harness
|
["cargo-nextest"] # better testing harness
|
||||||
["cargo-sort"] # sort deps and imports
|
["cargo-sort"] # sort deps and imports
|
||||||
|
@ -193,6 +207,15 @@ in {
|
||||||
default = {};
|
default = {};
|
||||||
type = types.submodule gui;
|
type = types.submodule gui;
|
||||||
};
|
};
|
||||||
|
styling = lib.mkOption {
|
||||||
|
description = "My custom styling (uses stylix)";
|
||||||
|
default = {};
|
||||||
|
type = types.submodule {
|
||||||
|
options = {
|
||||||
|
enable = lib.mkEnableOption "styling" // {default = fromConfig ["styling" "enable"] true;};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue