diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2024-09-25 00:17:41 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2024-09-25 00:17:41 +0530 |
| commit | 165cde749fc899d4c86eb6de97d3b7c4373eb7b3 (patch) | |
| tree | ec4d3cc00089b815dc0c56761348de4345705c43 /modules | |
| parent | c0c5087218c27e31c3e6f66f3937bff22fa0f647 (diff) | |
| download | home-manager-config-165cde749fc899d4c86eb6de97d3b7c4373eb7b3.tar.gz home-manager-config-165cde749fc899d4c86eb6de97d3b7c4373eb7b3.zip | |
Using more descriptive option names.
Diffstat (limited to 'modules')
28 files changed, 215 insertions, 179 deletions
diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index e15cd53..b4ff4c5 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,11 +1,11 @@ -{ lib, config, ... }: +{ ... }: { imports = [ + ./display-server ./popup-manager ./status-bar ./terminal ./window-manager - ./xresources ]; } diff --git a/modules/desktop/display-server/default.nix b/modules/desktop/display-server/default.nix new file mode 100644 index 0000000..f81358d --- /dev/null +++ b/modules/desktop/display-server/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./x11 + ]; +} diff --git a/modules/desktop/xresources/default.nix b/modules/desktop/display-server/x11/default.nix index 65eb812..b589c35 100644 --- a/modules/desktop/xresources/default.nix +++ b/modules/desktop/display-server/x11/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ ... }: { imports = [ diff --git a/modules/desktop/display-server/x11/xinit/default.nix b/modules/desktop/display-server/x11/xinit/default.nix new file mode 100644 index 0000000..a064f36 --- /dev/null +++ b/modules/desktop/display-server/x11/xinit/default.nix @@ -0,0 +1,14 @@ +{ lib, config, ... }: + +{ + options = { + desktop.display-server.x11.xinit.enable = lib.mkEnableOption "Enables xinit."; + }; + + config = lib.mkIf config.desktop.display-server.x11.xinit.enable { + home.file.".xinitrc" = { + source = ./xinitrc; + executable = true; + }; + }; +} diff --git a/modules/desktop/xresources/xinit/xinitrc b/modules/desktop/display-server/x11/xinit/xinitrc index 2ac4486..2ac4486 100644 --- a/modules/desktop/xresources/xinit/xinitrc +++ b/modules/desktop/display-server/x11/xinit/xinitrc diff --git a/modules/desktop/popup-manager/default.nix b/modules/desktop/popup-manager/default.nix index 8c82ea7..3eacbf6 100644 --- a/modules/desktop/popup-manager/default.nix +++ b/modules/desktop/popup-manager/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ ... }: { imports = [ diff --git a/modules/desktop/popup-manager/rofi/default.nix b/modules/desktop/popup-manager/rofi/default.nix index fdf7d3e..5c839e1 100644 --- a/modules/desktop/popup-manager/rofi/default.nix +++ b/modules/desktop/popup-manager/rofi/default.nix @@ -1,13 +1,13 @@ { config, lib, ... }: { - options = { - rofi.enable = lib.mkEnableOption "Enables rofi."; + options.desktop.popup-manager.rofi = { + enable = lib.mkEnableOption "Enables rofi."; }; - config = lib.mkIf config.rofi.enable { + config = lib.mkIf config.desktop.popup-manager.rofi.enable { programs.rofi.enable = true; programs.rofi.font = "FiraCode Nerd Font 16"; - programs.rofi.theme = import ./theme/default.nix config; + programs.rofi.theme = import ./theme config; }; } diff --git a/modules/desktop/status-bar/default.nix b/modules/desktop/status-bar/default.nix index 124c830..45cb3a0 100644 --- a/modules/desktop/status-bar/default.nix +++ b/modules/desktop/status-bar/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ ... }: { imports = [ diff --git a/modules/desktop/status-bar/polybar/default.nix b/modules/desktop/status-bar/polybar/default.nix index 11f4f1a..7608c38 100644 --- a/modules/desktop/status-bar/polybar/default.nix +++ b/modules/desktop/status-bar/polybar/default.nix @@ -1,18 +1,21 @@ { config, lib, ... }: { - options = { - polybar.enable = lib.mkEnableOption "Enables polybar."; + options.desktop.status-bar.polybar = { + enable = lib.mkEnableOption "Enables polybar."; }; - config = lib.mkIf config.polybar.enable { + config = lib.mkIf config.desktop.status-bar.polybar.enable { services.polybar.enable = true; services.polybar.script = "polybar main &"; services.polybar.config = { "bar/main" = import ./bars/main.nix config; "module/xwindow" = import ./modules/xwindow.nix config; - "module/bspwm" = import ./modules/bspwm.nix config; + "module/bspwm" = + if config.desktop.window-manager.bspwm.enable then + import ./modules/bspwm.nix config + else null; "module/cpu" = import ./modules/cpu.nix config; "module/memory" = import ./modules/memory.nix config; "module/date" = import ./modules/date.nix config; diff --git a/modules/desktop/terminal/alacritty/default.nix b/modules/desktop/terminal/alacritty/default.nix index 0fe56e0..a1f521a 100644 --- a/modules/desktop/terminal/alacritty/default.nix +++ b/modules/desktop/terminal/alacritty/default.nix @@ -1,12 +1,13 @@ { pkgs, config, lib, ... }: { - options = { - alacritty.enable = lib.mkEnableOption "Enables alacritty."; + options.desktop.terminal.alacritty = { + enable = lib.mkEnableOption "Enables alacritty."; }; - config = lib.mkIf config.alacritty.enable { + config = lib.mkIf config.desktop.terminal.alacritty.enable { programs.alacritty.enable = true; + desktop.terminal.default = "${pkgs.alacritty}/bin/alacritty"; programs.alacritty.settings = { window = { @@ -71,7 +72,7 @@ }; shell = { - program = "${pkgs.zsh}/bin/zsh"; + program = config.shell.default; }; }; }; diff --git a/modules/desktop/terminal/default.nix b/modules/desktop/terminal/default.nix index 6a0cfc8..534b742 100644 --- a/modules/desktop/terminal/default.nix +++ b/modules/desktop/terminal/default.nix @@ -4,4 +4,11 @@ imports = [ ./alacritty ]; + + options = { + desktop.terminal.default = lib.mkOption { + type = lib.types.string; + description = "Path to the default terminal program."; + }; + }; } diff --git a/modules/desktop/window-manager/bspwm/default.nix b/modules/desktop/window-manager/bspwm/default.nix index 643d78b..da9aa12 100644 --- a/modules/desktop/window-manager/bspwm/default.nix +++ b/modules/desktop/window-manager/bspwm/default.nix @@ -1,11 +1,11 @@ { config, lib, ... }: { - options = { - bspwm.enable = lib.mkEnableOption "Enables bspwm."; + options.desktop.window-manager.bspwm = { + enable = lib.mkEnableOption "Enables bspwm."; }; - config = lib.mkIf config.bspwm.enable { + config = lib.mkIf config.desktop.window-manager.bspwm.enable { xsession.windowManager.bspwm.enable = true; xsession.windowManager.bspwm.settings = with config.scheme.withHashtag; { diff --git a/modules/desktop/window-manager/default.nix b/modules/desktop/window-manager/default.nix index 6e9b9f8..c1de8c5 100644 --- a/modules/desktop/window-manager/default.nix +++ b/modules/desktop/window-manager/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ ... }: { imports = [ diff --git a/modules/desktop/window-manager/sxhkd/default.nix b/modules/desktop/window-manager/sxhkd/default.nix index 29261b9..3673b48 100644 --- a/modules/desktop/window-manager/sxhkd/default.nix +++ b/modules/desktop/window-manager/sxhkd/default.nix @@ -1,11 +1,11 @@ { pkgs, config, lib, ... }: { - options = { - sxhkd.enable = lib.mkEnableOption "Enables sxhkd."; + options.desktop.window-manager.sxhkd = { + enable = lib.mkEnableOption "Enables sxhkd."; }; - config = lib.mkIf config.sxhkd.enable { + config = lib.mkIf config.desktop.window-manager.sxhkd.enable { services.sxhkd.enable = true; services.sxhkd.keybindings = @@ -28,12 +28,12 @@ ${(createKeybinding "t" "Launch terminal.")} - = "alacritty"; + = config.desktop.terminal.default; ${(createKeybinding "f" "Launch File Explorer.")} - = "alacritty -t 'File Explorer' --class 'popup' -e lf"; + = "${config.desktop.terminal.default} -t 'File Explorer' --class 'popup' -e lf"; ${(createKeybinding "q" diff --git a/modules/desktop/xresources/xinit/default.nix b/modules/desktop/xresources/xinit/default.nix deleted file mode 100644 index f5069fa..0000000 --- a/modules/desktop/xresources/xinit/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ lib, config, ... }: - -{ - options = { - xinit.enable = lib.mkEnableOption "Enables xinit."; - }; - - config = lib.mkIf config.xinit.enable { - home.file.".xinitrc" = { - source = ./xinitrc; - executable = true; - }; - }; -} diff --git a/modules/shell/bash/default.nix b/modules/shell/bash/default.nix index f26e3d8..ee3b4a8 100644 --- a/modules/shell/bash/default.nix +++ b/modules/shell/bash/default.nix @@ -1,13 +1,14 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: { - options = { - bash.enable = lib.mkEnableOption "Enables bash."; + options.shell.bash = { + enable = lib.mkEnableOption "Enables bash."; }; - config = lib.mkIf config.bash.enable { + config = lib.mkIf config.shell.bash.enable { programs.bash.enable = true; programs.bash.historyFile = "${config.xdg.cacheHome}/bash/history"; + programs.bash.shellAliases = config.shell.alias; home.file."${config.xdg.cacheHome}/bash/histroy".text = ""; # Create the cache directory and histroy file }; } diff --git a/modules/shell/default.nix b/modules/shell/default.nix index e4c3964..2dbd054 100644 --- a/modules/shell/default.nix +++ b/modules/shell/default.nix @@ -1,8 +1,24 @@ -{ lib, config, ... }: +{ lib, pkgs, ... }: { imports = [ ./bash ./zsh ]; + + options.shell = { + default = lib.mkOption { + type = lib.types.string; + description = "Path to the default shell program."; + }; + alias = lib.mkOption { + type = lib.types.attrs; + description = "Shell aliases."; + }; + }; + + config = { + shell.default = lib.mkDefault "${pkgs.bash}/bin/bash"; # Set bash as default shell + shell.bash.enable = lib.mkDefault true; # Enable bash by default + }; } diff --git a/modules/shell/zsh/default.nix b/modules/shell/zsh/default.nix index b4ea77a..c553ec4 100644 --- a/modules/shell/zsh/default.nix +++ b/modules/shell/zsh/default.nix @@ -1,15 +1,16 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: { - options = { - zsh.enable = lib.mkEnableOption "Enables zsh."; + options.shell.zsh = { + enable = lib.mkEnableOption "Enables zsh."; }; - config = lib.mkIf config.zsh.enable { + config = lib.mkIf config.shell.zsh.enable { programs.zsh.enable = true; programs.zsh.dotDir = ".config/zsh"; programs.zsh.history.path = "${config.xdg.cacheHome}/zsh/history"; programs.zsh.initExtra = builtins.readFile ./zshrc; - programs.zsh.shellAliases = config.programs.bash.shellAliases; + programs.zsh.shellAliases = config.shell.alias; + shell.default = "${pkgs.zsh}/bin/zsh"; }; } diff --git a/modules/tools/editor/default.nix b/modules/tools/editor/default.nix index 1a146bf..fd2da1a 100644 --- a/modules/tools/editor/default.nix +++ b/modules/tools/editor/default.nix @@ -1,4 +1,4 @@ -{ lib, config, ... }: +{ ... }: { imports = [ diff --git a/modules/tools/editor/neovim/default.nix b/modules/tools/editor/neovim/default.nix index e06ec88..6cf3b50 100644 --- a/modules/tools/editor/neovim/default.nix +++ b/modules/tools/editor/neovim/default.nix @@ -1,11 +1,11 @@ { pkgs, config, lib, ... }: { - options = { - neovim.enable = lib.mkEnableOption "Enables neovim."; + options.tools.editor.neovim = { + enable = lib.mkEnableOption "Enables neovim."; }; - config = lib.mkIf config.neovim.enable { + config = lib.mkIf config.tools.editor.neovim.enable { programs.neovim.enable = true; programs.neovim.viAlias = true; programs.neovim.vimAlias = true; diff --git a/modules/tools/file-manager/default.nix b/modules/tools/file-manager/default.nix index d127a66..fc5eb46 100644 --- a/modules/tools/file-manager/default.nix +++ b/modules/tools/file-manager/default.nix @@ -1,4 +1,4 @@ -{ lib, config, ... }: +{ ... }: { imports = [ diff --git a/modules/tools/file-manager/lf/default.nix b/modules/tools/file-manager/lf/default.nix index 00784cf..30ed421 100644 --- a/modules/tools/file-manager/lf/default.nix +++ b/modules/tools/file-manager/lf/default.nix @@ -1,11 +1,11 @@ { config, pkgs, lib, ... }: { - options = { - lf.enable = lib.mkEnableOption "Enables lf."; + options.tools.file-manager.lf = { + enable = lib.mkEnableOption "Enables lf."; }; - config = lib.mkIf config.lf.enable { + config = lib.mkIf config.tools.file-manager.lf.enable { programs.lf.enable = true; programs.lf.settings = { hidden = true; diff --git a/modules/tools/file-manager/lsd/default.nix b/modules/tools/file-manager/lsd/default.nix index 0f57e6b..5b940ab 100644 --- a/modules/tools/file-manager/lsd/default.nix +++ b/modules/tools/file-manager/lsd/default.nix @@ -1,14 +1,14 @@ { pkgs, lib, config, ... }: { - options = { - lsd.enable = lib.mkEnableOption "Enables lsd."; + options.tools.file-manager.lsd = { + enable = lib.mkEnableOption "Enables lsd."; }; - config = lib.mkIf config.lsd.enable { + config = lib.mkIf config.tools.file-manager.lsd.enable { programs.lsd.enable = true; programs.lsd.enableAliases = true; - programs.bash.shellAliases."tree" = "${pkgs.lsd}/bin/lsd -a --tree"; + shell.alias."tree" = "${pkgs.lsd}/bin/lsd -a --tree"; programs.lsd.settings = { icons.separator = " "; diff --git a/modules/tools/git/default.nix b/modules/tools/git/default.nix index 7396cb8..1dadacf 100644 --- a/modules/tools/git/default.nix +++ b/modules/tools/git/default.nix @@ -1,11 +1,11 @@ { lib, config, ... }: { - options = { - git.enable = lib.mkEnableOption "Enables git."; + options.tools.git = { + enable = lib.mkEnableOption "Enables git."; }; - config = lib.mkIf config.git.enable { + config = lib.mkIf config.tools.git.enable { programs.git.enable = true; programs.git.userEmail = "54011232+arpitchakladar@users.noreply.github.com"; programs.git.userName = "Arpit Chakladar"; diff --git a/modules/tools/system-monitor/htop/default.nix b/modules/tools/system-monitor/htop/default.nix index f27174a..c19ab60 100644 --- a/modules/tools/system-monitor/htop/default.nix +++ b/modules/tools/system-monitor/htop/default.nix @@ -1,11 +1,11 @@ { pkgs, lib, config, ... }: { - options = { - htop.enable = lib.mkEnableOption "Enables htop."; + options.tools.system-monitor.htop = { + enable = lib.mkEnableOption "Enables htop."; }; - config = lib.mkIf config.htop.enable { + config = lib.mkIf config.tools.system-monitor.htop.enable { programs.htop.enable = true; programs.htop.package = pkgs.htop-vim; }; diff --git a/modules/tools/viewer/bat/default.nix b/modules/tools/viewer/bat/default.nix index cc01f82..915b4b2 100644 --- a/modules/tools/viewer/bat/default.nix +++ b/modules/tools/viewer/bat/default.nix @@ -1,11 +1,11 @@ { config, lib, ... }: { - options = { - bat.enable = lib.mkEnableOption "Enables bat."; + options.tools.viewer.bat = { + enable = lib.mkEnableOption "Enables bat."; }; - config = lib.mkIf config.bat.enable { + config = lib.mkIf config.tools.viewer.bat.enable { programs.bat.enable = true; programs.bat.config.theme = "customTheme"; xdg.configFile."bat/themes/customTheme.tmTheme".text diff --git a/modules/tools/viewer/bat/theme.nix b/modules/tools/viewer/bat/theme.nix index e345ee4..dc22ceb 100644 --- a/modules/tools/viewer/bat/theme.nix +++ b/modules/tools/viewer/bat/theme.nix @@ -5,120 +5,120 @@ with config.scheme.withHashtag; <?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> <dict> - <key>name</key> - <string>customTheme</string> - <key>settings</key> - <array> - <!-- General Colors --> - <dict> - <key>settings</key> - <dict> - <key>background</key> - <string>#0F1419</string> <!-- Background (base00) --> - <key>foreground</key> - <string>#E6E1CF</string> <!-- Foreground (base05) --> - <key>caret</key> - <string>#F3F4F5</string> <!-- Caret (base07) --> - <key>invisibles</key> - <string>#3E4B59</string> <!-- Invisibles (base03) --> - <key>lineHighlight</key> - <string>#272D38</string> <!-- Line highlight (base02) --> - <key>selection</key> - <string>#3E4B59</string> <!-- Selection (base03) --> - </dict> - </dict> - - <!-- Syntax-Specific Colors --> - <dict> - <key>scope</key> - <string>comment</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#BFBDB6</string> <!-- Comments (base04) --> - </dict> - </dict> - - <dict> - <key>scope</key> - <string>string</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#FFB454</string> <!-- Strings (base0A) --> - </dict> - </dict> + <key>name</key> + <string>customTheme</string> + <key>settings</key> + <array> + <!-- General Colors --> + <dict> + <key>settings</key> + <dict> + <key>background</key> + <string>${base00}</string> + <key>foreground</key> + <string>${base05}</string> + <key>caret</key> + <string>${base07}</string> + <key>invisibles</key> + <string>${base03}</string> + <key>lineHighlight</key> + <string>${base02}</string> + <key>selection</key> + <string>${base03}</string> + </dict> + </dict> + + <!-- Syntax-Specific Colors --> + <dict> + <key>scope</key> + <string>comment</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base04}</string> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>string</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base0A}</string> + </dict> + </dict> - <dict> - <key>scope</key> - <string>constant.numeric</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#FF8F40</string> <!-- Numbers (base09) --> - </dict> - </dict> + <dict> + <key>scope</key> + <string>constant.numeric</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base09}</string> + </dict> + </dict> - <dict> - <key>scope</key> - <string>variable</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#F07178</string> <!-- Variables (base08) --> - </dict> - </dict> + <dict> + <key>scope</key> + <string>variable</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base08}</string> + </dict> + </dict> - <dict> - <key>scope</key> - <string>keyword</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#59C2FF</string> <!-- Keywords (base0D) --> - </dict> - </dict> + <dict> + <key>scope</key> + <string>keyword</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base0D}</string> + </dict> + </dict> - <dict> - <key>scope</key> - <string>support.function</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#D2A6FF</string> <!-- Functions (base0E) --> - </dict> - </dict> + <dict> + <key>scope</key> + <string>support.function</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base0E}</string> + </dict> + </dict> - <dict> - <key>scope</key> - <string>constant.language</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#B8CC52</string> <!-- Constants (base0B) --> - </dict> - </dict> + <dict> + <key>scope</key> + <string>constant.language</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base0B}</string> + </dict> + </dict> - <dict> - <key>scope</key> - <string>entity.name.tag</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#95E6CB</string> <!-- Tags (base0C) --> - </dict> - </dict> + <dict> + <key>scope</key> + <string>entity.name.tag</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base0C}</string> + </dict> + </dict> - <dict> - <key>scope</key> - <string>invalid</string> - <key>settings</key> - <dict> - <key>foreground</key> - <string>#E6B673</string> <!-- Invalid (base0F) --> - </dict> - </dict> - </array> + <dict> + <key>scope</key> + <string>invalid</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>${base0F}</string> + </dict> + </dict> + </array> </dict> </plist> '' diff --git a/modules/tools/viewer/default.nix b/modules/tools/viewer/default.nix index dde782b..7784a99 100644 --- a/modules/tools/viewer/default.nix +++ b/modules/tools/viewer/default.nix @@ -1,4 +1,4 @@ -{ lib, config, ... }: +{ ... }: { imports = [ |
