diff --git a/home/programs/trayer/default.nix b/home/programs/trayer/default.nix deleted file mode 100644 index 6eafdc0b..00000000 --- a/home/programs/trayer/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - cfg = config.custom.programs.trayer; - -in - -{ - options = { - custom.programs.trayer = { - enable = mkEnableOption "Trayer"; - }; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - networkmanagerapplet - trayer - ]; - }; -} - diff --git a/home/programs/xmonad/default.nix b/home/programs/xmonad/default.nix deleted file mode 100644 index 874ae20e..00000000 --- a/home/programs/xmonad/default.nix +++ /dev/null @@ -1,161 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - cfg = config.custom.programs.xmonad; - -in - -{ - options = { - custom.programs.xmonad = { - enable = mkEnableOption "Xmonad window manager"; - - modKey = mkOption { - type = types.enum [ "mod1" "mod2" "mod4" ]; - default = "mod4"; - description = '' - The window manager mod key. - - Alt key is mod1 - Apple key on OSX is mod2 - Windows key is mod4 - - ''; - }; - - autoruns = mkOption { - type = with types; attrsOf int; - default = { }; - description = '' - applications to be launched in a workspace of choice. - ''; - example = literalExpression '' - { - "firefox" = 1; - "slack" = 2; - "spotify" = 3; - } - ''; - }; - - colorScheme = { - foreground = mkOption { - type = types.str; - default = "#BBBBBB"; - }; - - background = mkOption { - type = types.str; - default = "#000000"; - }; - - base = mkOption { - type = types.str; - default = "#6586c8"; - }; - - accent = mkOption { - type = types.str; - default = "#FF7F00"; - }; - - warn = mkOption { - type = types.str; - default = "#FF5555"; - }; - }; - - launcherCmd = mkOption { - type = types.str; - default = "${pkgs.dmenu}/bin/dmenu_run"; - description = "Command to run dmenu"; - }; - - locker = { - package = mkOption { - type = types.package; - default = pkgs.i3lock; - description = "Locker util"; - }; - - lockCmd = mkOption { - type = types.str; - default = "${pkgs.i3lock}/bin/i3lock"; - description = "Command for locking screen"; - }; - }; - - screenshot = { - package = mkOption { - type = types.package; - default = pkgs.scrot; - description = "Screenshot util"; - }; - - runCmdFull = mkOption { - type = types.str; - default = "${./scripts/screenshot.sh} full"; - description = "Command for taking full-screen screenshots"; - }; - - runCmdSelect = mkOption { - type = types.str; - default = "${./scripts/screenshot.sh} select"; - description = "Command for taking selection screenshots"; - }; - - runCmdWindow = mkOption { - type = types.str; - default = "${./scripts/screenshot.sh} window"; - description = "Command for taking window screenshots"; - }; - }; - - passwordManager = { - command = mkOption { - type = types.str; - description = "Command to spawn the default password manager"; - }; - wmClassName = mkOption { - type = types.str; - description = "Window manager class name retrieved via `xprop` utility"; - }; - }; - - terminalCmd = mkOption { - type = types.str; - description = "Command to spawn the default terminal emulator"; - }; - - wiki = { - command = mkOption { - type = types.str; - description = "Command to spawn the default wiki app"; - }; - wmClassName = mkOption { - type = types.str; - description = "Window manager class name retrieved via `xprop` utility"; - }; - }; - - }; - }; - - config = mkIf cfg.enable { - home = { - packages = [ - cfg.locker.package - cfg.screenshot.package - ]; - }; - - xsession.windowManager.xmonad = { - enable = true; - enableContribAndExtras = true; - config = import ./xmonad.hs.nix { inherit lib pkgs cfg; }; - }; - }; -} diff --git a/home/roles/desktop/xserver/default.nix b/home/roles/desktop/xserver/default.nix index a888ebd2..26c32338 100644 --- a/home/roles/desktop/xserver/default.nix +++ b/home/roles/desktop/xserver/default.nix @@ -4,7 +4,8 @@ with lib; let - cfg = config.custom.roles.desktop.xserver; + desktopCfg = config.custom.roles.desktop; + cfg = desktopCfg.xserver; in @@ -51,7 +52,29 @@ in cursors.enable = true; grobi.enable = true; redshift.enable = true; - xmonad.enable = true; + + xmonad = { + inherit (cfg) colorScheme; + + enable = true; + autoruns = { + "${desktopCfg.terminal.spawnCmd}" = 1; + "blueberry-tray" = 1; + "nm-applet" = 1; + "parcellite" = 1; + "steam -silent" = 8; + }; + launcherCmd = "dmenu_run -c -i -fn \"${desktopCfg.font.family}:style=Bold:size=20:antialias=true\" -l 8 -nf \"#C5C8C6\" -sb \"#373B41\" -sf \"#C5C8C6\" -p \"run:\""; + terminalCmd = mkDefault desktopCfg.terminal.spawnCmd; + passwordManager = { + command = mkDefault "1password"; + wmClassName = mkDefault "1Password"; + }; + wiki = { + command = mkDefault "logseq"; + wmClassName = mkDefault "Logseq"; + }; + }; }; }; }; diff --git a/home/programs/dmenu/default.nix b/home/roles/desktop/xserver/dmenu/default.nix similarity index 90% rename from home/programs/dmenu/default.nix rename to home/roles/desktop/xserver/dmenu/default.nix index c47f17d0..ad207f1f 100644 --- a/home/programs/dmenu/default.nix +++ b/home/roles/desktop/xserver/dmenu/default.nix @@ -4,7 +4,7 @@ with lib; let - cfg = config.custom.programs.dmenu; + cfg = config.custom.roles.desktop.xserver.dmenu; dmenuPatched = pkgs.dmenu.override { patches = builtins.map builtins.fetchurl [ @@ -23,7 +23,7 @@ in { options = { - custom.programs.dmenu = { + custom.roles.desktop.xserver.dmenu = { enable = mkEnableOption "Dmenu launcher"; font = { diff --git a/home/programs/dunst/default.nix b/home/roles/desktop/xserver/dunst/default.nix similarity index 96% rename from home/programs/dunst/default.nix rename to home/roles/desktop/xserver/dunst/default.nix index 6acbc561..aa6bcec8 100644 --- a/home/programs/dunst/default.nix +++ b/home/roles/desktop/xserver/dunst/default.nix @@ -4,13 +4,13 @@ with lib; let - cfg = config.custom.programs.dunst; + cfg = config.custom.roles.desktop.xserver.dunst; in { options = { - custom.programs.dunst = { + custom.roles.desktop.xserver.dunst = { enable = mkEnableOption "Dunst desktop notification daemon"; font = { diff --git a/home/programs/picom/default.nix b/home/roles/desktop/xserver/picom/default.nix similarity index 95% rename from home/programs/picom/default.nix rename to home/roles/desktop/xserver/picom/default.nix index 50c3ce06..b5f5d261 100644 --- a/home/programs/picom/default.nix +++ b/home/roles/desktop/xserver/picom/default.nix @@ -4,13 +4,13 @@ with lib; let - cfg = config.custom.programs.picom; + cfg = config.custom.roles.desktop.xserver.picom; in { options = { - custom.programs.picom = { + custom.roles.desktop.xserver.picom = { enable = mkEnableOption "Picom compositor"; }; }; diff --git a/home/programs/polybar/config/weather-plugin.nix b/home/roles/desktop/xserver/polybar/config/weather-plugin.nix similarity index 100% rename from home/programs/polybar/config/weather-plugin.nix rename to home/roles/desktop/xserver/polybar/config/weather-plugin.nix diff --git a/home/programs/polybar/default.nix b/home/roles/desktop/xserver/polybar/default.nix similarity index 99% rename from home/programs/polybar/default.nix rename to home/roles/desktop/xserver/polybar/default.nix index 823d7598..35409775 100644 --- a/home/programs/polybar/default.nix +++ b/home/roles/desktop/xserver/polybar/default.nix @@ -4,7 +4,7 @@ with lib; let - cfg = config.custom.programs.polybar; + cfg = config.custom.roles.desktop.xserver.polybar; package = pkgs.polybar.override { pulseSupport = true; @@ -14,7 +14,7 @@ in { options = { - custom.programs.polybar = { + custom.roles.desktop.xserver.polybar = { enable = mkEnableOption "Polybar status bar"; colorScheme = { diff --git a/home/roles/desktop/xserver/xmonad/default.nix b/home/roles/desktop/xserver/xmonad/default.nix index 64daf75d..4278230c 100644 --- a/home/roles/desktop/xserver/xmonad/default.nix +++ b/home/roles/desktop/xserver/xmonad/default.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: with lib; @@ -14,13 +14,142 @@ in options = { custom.roles.desktop.xserver.xmonad = { enable = mkEnableOption "Xmonad window manager"; + lightweight = mkEnableOption "Disable resource intensive effects"; + + modKey = mkOption { + type = types.enum [ "mod1" "mod2" "mod4" ]; + default = "mod4"; + description = '' + The window manager mod key. + + Alt key is mod1 + Apple key on OSX is mod2 + Windows key is mod4 + + ''; + }; + + autoruns = mkOption { + type = with types; attrsOf int; + default = { }; + description = '' + applications to be launched in a workspace of choice. + ''; + example = literalExpression '' + { + "firefox" = 1; + "slack" = 2; + "spotify" = 3; + } + ''; + }; + + colorScheme = { + foreground = mkOption { + type = types.str; + default = "#BBBBBB"; + }; + + background = mkOption { + type = types.str; + default = "#000000"; + }; + + base = mkOption { + type = types.str; + default = "#6586c8"; + }; + + accent = mkOption { + type = types.str; + default = "#FF7F00"; + }; + + warn = mkOption { + type = types.str; + default = "#FF5555"; + }; + }; + + launcherCmd = mkOption { + type = types.str; + default = "${pkgs.dmenu}/bin/dmenu_run"; + description = "Command to run dmenu"; + }; + + locker = { + package = mkOption { + type = types.package; + default = pkgs.i3lock; + description = "Locker util"; + }; + + lockCmd = mkOption { + type = types.str; + default = "${pkgs.i3lock}/bin/i3lock"; + description = "Command for locking screen"; + }; + }; + + screenshot = { + package = mkOption { + type = types.package; + default = pkgs.scrot; + description = "Screenshot util"; + }; + + runCmdFull = mkOption { + type = types.str; + default = "${./scripts/screenshot.sh} full"; + description = "Command for taking full-screen screenshots"; + }; + + runCmdSelect = mkOption { + type = types.str; + default = "${./scripts/screenshot.sh} select"; + description = "Command for taking selection screenshots"; + }; + + runCmdWindow = mkOption { + type = types.str; + default = "${./scripts/screenshot.sh} window"; + description = "Command for taking window screenshots"; + }; + }; + + passwordManager = { + command = mkOption { + type = types.str; + description = "Command to spawn the default password manager"; + }; + wmClassName = mkOption { + type = types.str; + description = "Window manager class name retrieved via `xprop` utility"; + }; + }; + + terminalCmd = mkOption { + type = types.str; + description = "Command to spawn the default terminal emulator"; + }; + + wiki = { + command = mkOption { + type = types.str; + description = "Command to spawn the default wiki app"; + }; + wmClassName = mkOption { + type = types.str; + description = "Window manager class name retrieved via `xprop` utility"; + }; + }; }; }; config = mkIf cfg.enable { custom = { - programs = { + roles.desktop.xserver = { dmenu = { enable = true; font = { @@ -47,30 +176,20 @@ in height = 20; monitors.battery = desktopCfg.mobile.enable; }; + }; + }; - xmonad = { - inherit (xCfg) colorScheme locker; + home = { + packages = [ + cfg.locker.package + cfg.screenshot.package + ]; + }; - enable = true; - autoruns = { - "${desktopCfg.terminal.spawnCmd}" = 1; - "blueberry-tray" = 1; - "nm-applet" = 1; - "parcellite" = 1; - "steam -silent" = 8; - }; - launcherCmd = "dmenu_run -c -i -fn \"${desktopCfg.font.family}:style=Bold:size=20:antialias=true\" -l 8 -nf \"#C5C8C6\" -sb \"#373B41\" -sf \"#C5C8C6\" -p \"run:\""; - terminalCmd = mkDefault desktopCfg.terminal.spawnCmd; - passwordManager = { - command = mkDefault "1password"; - wmClassName = mkDefault "1Password"; - }; - wiki = { - command = mkDefault "logseq"; - wmClassName = mkDefault "Logseq"; - }; - }; - }; + xsession.windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + config = import ./xmonad.hs.nix { inherit lib pkgs cfg; }; }; }; } diff --git a/home/programs/xmonad/scripts/screenshot.sh b/home/roles/desktop/xserver/xmonad/scripts/screenshot.sh similarity index 100% rename from home/programs/xmonad/scripts/screenshot.sh rename to home/roles/desktop/xserver/xmonad/scripts/screenshot.sh diff --git a/home/programs/xmonad/xmonad.hs.nix b/home/roles/desktop/xserver/xmonad/xmonad.hs.nix similarity index 100% rename from home/programs/xmonad/xmonad.hs.nix rename to home/roles/desktop/xserver/xmonad/xmonad.hs.nix