diff --git a/modules/common/profiles/default.nix b/modules/common/profiles/default.nix index 712e20b..034d993 100644 --- a/modules/common/profiles/default.nix +++ b/modules/common/profiles/default.nix @@ -6,5 +6,6 @@ ./devices ./gtk ./laptop + ./wm ]; } diff --git a/modules/common/profiles/wm/default.nix b/modules/common/profiles/wm/default.nix new file mode 100644 index 0000000..4c974e1 --- /dev/null +++ b/modules/common/profiles/wm/default.nix @@ -0,0 +1,36 @@ +{ config, lib, type, ... }: +let + cfg = config.my.profiles.wm; + + applyWm = wm: configs: lib.mkIf (cfg.windowManager == wm) (lib.my.merge configs); +in +{ + options.my.profiles.wm = with lib; { + windowManager = mkOption { + type = with types; nullOr (enum [ "i3" ]); + default = null; + example = "i3"; + description = "Which window manager to use"; + }; + }; + + config = lib.mkMerge [ + (applyWm "i3" [ + (lib.optionalAttrs (type == "home") { + # i3 settings + my.home.wm.windowManager = "i3"; + # Screenshot tool + my.home.flameshot.enable = true; + # Auto disk mounter + my.home.udiskie.enable = true; + }) + + (lib.optionalAttrs (type == "nixos") { + # Enable i3 + services.xserver.windowManager.i3.enable = true; + # udiskie fails if it can't find this dbus service + services.udisks2.enable = true; + }) + ]) + ]; +} diff --git a/modules/nixos/profiles/default.nix b/modules/nixos/profiles/default.nix index 1951298..6b4db55 100644 --- a/modules/nixos/profiles/default.nix +++ b/modules/nixos/profiles/default.nix @@ -2,7 +2,6 @@ { ... }: { imports = [ - ./wm ./x ]; } diff --git a/modules/nixos/profiles/wm/default.nix b/modules/nixos/profiles/wm/default.nix deleted file mode 100644 index c227328..0000000 --- a/modules/nixos/profiles/wm/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.my.profiles.wm; -in -{ - options.my.profiles.wm = with lib; { - windowManager = mkOption { - type = with types; nullOr (enum [ "i3" ]); - default = null; - example = "i3"; - description = "Which window manager to use"; - }; - }; - - config = lib.mkMerge [ - (lib.mkIf (cfg.windowManager == "i3") { - # Enable i3 - services.xserver.windowManager.i3.enable = true; - # i3 settings - my.home.wm.windowManager = "i3"; - # Screenshot tool - my.home.flameshot.enable = true; - # Auto disk mounter - my.home.udiskie.enable = true; - # udiskie fails if it can't find this dbus service - services.udisks2.enable = true; - }) - ]; -}