diff --git a/home/modules/terminal/wezterm.nix b/home/modules/terminal/wezterm.nix index 86fb257..b782cec 100644 --- a/home/modules/terminal/wezterm.nix +++ b/home/modules/terminal/wezterm.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, ... }: +{ lib, config, ... }: let cfg = config.local.wezterm; diff --git a/home/modules/window_manager/xmonad.nix b/home/modules/window_manager/xmonad.nix index 9c8518b..80a440f 100644 --- a/home/modules/window_manager/xmonad.nix +++ b/home/modules/window_manager/xmonad.nix @@ -1,51 +1,87 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, lib, ... }: -let themeCfg = config.local.theme; in -{ - home.packages = with pkgs; [ - xclip # access x clipboard from a console - dmenu # menu for x window system - nitrogen # wallpaper manager - ]; +let + cfg = config.local.xmonad; + themeCfg = config.local.theme; - xsession = { - enable = true; - - windowManager.xmonad = { - enable = true; - enableContribAndExtras = true; - - haskellPackages = pkgs.unstable.haskellPackages; - extraPackages = (hp: [ - hp.dbus - hp.monad-logger - ]); - - config = pkgs.substituteAll { - src = ./xmonad_config.hs; - inherit (themeCfg.bar) background mainText inactiveText; - inherit (themeCfg.window) activeBorder inactiveBorder; - inherit (themeCfg.highlights) critical warning success; - inherit (themeCfg.syntax) mark1 mark2 mark3; - kdbBrightnessScriptPath = "${./scripts/kdb_brightness.sh}"; + projectType = with lib; types.submodule { + options = { + name = mkOption { + type = types.str; + }; + startHook = mkOption { + type = types.lines; }; }; - initExtra = '' - ${pkgs.nitrogen}/bin/nitrogen --restore & - ''; }; - services.flameshot = { - enable = true; + mkXmonadProject = { name, startHook }: + '' + Project { + projectName = "${name}", + projectStartHook = ${lib.removeSuffix startHook} + } + ''; - # See: https://github.com/flameshot-org/flameshot/blob/master/flameshot.example.ini - settings = { - General = { - disabledTrayIcon = true; - savePathFixed = true; - showDesktopNotification = false; - showSidePanelButton = true; + xmonadProjects = lib.concatStringsSep ",\n" (map mkXmonadProject cfg.projects); +in +{ + options.local.xmonad = with lib; + { + projects = mkOption { + type = types.listOf projectType; + default = [ ]; + }; + }; + + config = { + home.packages = with pkgs; [ + xclip # access x clipboard from a console + dmenu # menu for x window system + nitrogen # wallpaper manager + ]; + + xsession = { + enable = true; + + windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + + haskellPackages = pkgs.unstable.haskellPackages; + extraPackages = (hp: [ + hp.dbus + hp.monad-logger + ]); + + config = pkgs.substituteAll { + src = ./xmonad_config.hs; + projects = "\n" + xmonadProjects; + inherit (themeCfg.bar) background mainText inactiveText; + inherit (themeCfg.window) activeBorder inactiveBorder; + inherit (themeCfg.highlights) critical warning success; + inherit (themeCfg.syntax) mark1 mark2 mark3; + kdbBrightnessScriptPath = "${./scripts/kdb_brightness.sh}"; + }; + }; + + initExtra = '' + ${pkgs.nitrogen}/bin/nitrogen --restore & + ''; + }; + + services.flameshot = { + enable = true; + + # See: https://github.com/flameshot-org/flameshot/blob/master/flameshot.example.ini + settings = { + General = { + disabledTrayIcon = true; + savePathFixed = true; + showDesktopNotification = false; + showSidePanelButton = true; + }; }; }; }; diff --git a/home/modules/window_manager/xmonad_config.hs b/home/modules/window_manager/xmonad_config.hs index c711bed..550cb5b 100644 --- a/home/modules/window_manager/xmonad_config.hs +++ b/home/modules/window_manager/xmonad_config.hs @@ -383,29 +383,7 @@ myMouseBindings (XConfig {XMonad.modMask = modm}) = myProjects :: [Project] myProjects = - [ -- my work - Project - { projectName = "bm-back", - projectStartHook = do - let workdir = "~/projects/binarymanagement/bm-back" - spawn $ terminal' workdir $ Just "docker-compose -f docker-compose.dev.yml up -d" - replicateM_ 3 $ spawn $ terminal workdir - }, - Project - { projectName = "bm-front", - projectStartHook = do - let workdir = "~/projects/binarymanagement/bm-front" - replicateM_ 3 $ spawn $ terminal workdir - }, - -- personal - Project - { projectName = "system", - projectStartHook = replicateM_ 2 $ spawn $ terminal "~/repos/mynix/system" - }, - Project - { projectName = "neovim", - projectStartHook = replicateM_ 2 $ spawn $ terminal "~/repos/mynix/neovim" - } + [ -- @projects@ ] where terminal :: String -> String diff --git a/nixos/hosts/asus-gl553vd/xmonad_projects.secret.nix b/nixos/hosts/asus-gl553vd/xmonad_projects.secret.nix new file mode 100644 index 0000000..fe978ad Binary files /dev/null and b/nixos/hosts/asus-gl553vd/xmonad_projects.secret.nix differ diff --git a/nixos/hosts/default.nix b/nixos/hosts/default.nix index 4f969ab..12ff5f7 100644 --- a/nixos/hosts/default.nix +++ b/nixos/hosts/default.nix @@ -27,15 +27,17 @@ in specialArgs = { extraJanHomeModule = { lib, pkgs, ... }: { + imports = [ ./home/xmonad_projects.secret.nix ]; + home.packages = lib.mkAfter (with pkgs.unstable; [ # 3d programs blender cura + godot_4 # electronics kicad-small - # godot - godot_4 ]); + }; }; }; @@ -58,7 +60,9 @@ in }; specialArgs = { - extraJanHomeModule = { ... }: { }; + extraJanHomeModule = { lib, ... }: { + imports = [ ./asus-gl553vd/xmonad_projects.secret.nix ]; + }; }; }; diff --git a/nixos/hosts/home/xmonad_projects.secret.nix b/nixos/hosts/home/xmonad_projects.secret.nix new file mode 100644 index 0000000..3dd3137 Binary files /dev/null and b/nixos/hosts/home/xmonad_projects.secret.nix differ