commit 2b5d483381c739a2d2eb1360d958bb462303596d
parent 80935cfc418f752fa73a581bf2dfb7364b8c5240
Author: Vincent Demeester <vincent@sbr.pm>
Date: Fri, 19 Aug 2022 10:40:01 +0000
systems/modules: work on desktop modules
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
7 files changed, 73 insertions(+), 21 deletions(-)
diff --git a/systems/hosts/wakasu.nix b/systems/hosts/wakasu.nix
@@ -83,6 +83,7 @@ in
yubikey.enable = true;
laptop.enable = true;
};
+ desktop.wayland.sway.enable = true;
};
profiles.ssh.enable = true;
diff --git a/systems/modules/desktop/base.nix b/systems/modules/desktop/base.nix
@@ -20,11 +20,6 @@ in
# FIXME Fix tmpOnTmpfs
systemd.additionalUpstreamSystemUnits = [ "tmp.mount" ];
- # Extra packages to add to the system
- environment.systemPackages = with pkgs; [
- xorg.xmessage
- ];
-
# Configure some fonts
fonts = {
# enableFontDir = true;
@@ -128,18 +123,6 @@ in
enable = true;
drivers = [ pkgs.gutenprint ];
};
-
- # Enable xserver on desktop
- xserver = {
- enable = true;
- enableTCP = false;
- libinput.enable = true;
- synaptics.enable = false;
- layout = "fr";
- xkbVariant = "bepo";
- xkbOptions = "grp:menu_toggle,grp_led:caps,compose:caps";
- };
-
};
};
}
diff --git a/systems/modules/desktop/default.nix b/systems/modules/desktop/default.nix
@@ -2,5 +2,8 @@
imports = [
./base.nix
./i3.nix
+ ./sway.nix
+ ./wayland.nix
+ ./xorg.nix
];
}
diff --git a/systems/modules/desktop/i3.nix b/systems/modules/desktop/i3.nix
@@ -2,18 +2,18 @@
with lib;
let
- cfg = config.modules.desktop.i3;
+ cfg = config.modules.desktop.xorg.i3;
in
{
options = {
- modules.desktop.i3 = {
+ modules.desktop.xorg.i3 = {
enable = mkEnableOption "Enable i3 desktop profile";
};
};
config = mkIf cfg.enable {
- # Enable desktop modules if not already
- modules.desktop.enable = true;
+ # Enable xorg desktop modules if not already
+ modules.desktop.xorg.enable = true;
services = {
blueman.enable = true;
autorandr.enable = true;
diff --git a/systems/modules/desktop/sway.nix b/systems/modules/desktop/sway.nix
@@ -0,0 +1,14 @@
+{ config, lib, pkgs, ... }:
+let
+ inherit (lib) mkIf mkEnableOption mkDefault;
+ cfg = config.modules.desktop.wayland.sway;
+in
+{
+ options = {
+ modules.desktop.wayland.sway = {
+ enable = mkEnableOption "Enable sway desktop profile";
+ };
+ };
+ config = mkIf cfg.enable = {};
+}
+
diff --git a/systems/modules/desktop/wayland.nix b/systems/modules/desktop/wayland.nix
@@ -0,0 +1,18 @@
+{ config, lib, pkgs, ... }:
+let
+ inherit (lib) mkIf mkEnableOption mkDefault mkForce;
+ cfg = config.modules.desktop.wayland;
+in
+{
+ options = {
+ modules.desktop.wayland = {
+ enable = mkEnableOption "Enable wayland desktop";
+ };
+ };
+ config = mkIf cfg.enable {
+ # Enable desktop module if not already.
+ modules.desktop.enable = true;
+ # Force disable xorg desktop module
+ modules.desktop.xorg = mkForce false;
+ };
+}
diff --git a/systems/modules/desktop/xorg.nix b/systems/modules/desktop/xorg.nix
@@ -0,0 +1,33 @@
+{ config, lib, pkgs, ... }:
+let
+ inherit (lib) mkIf mkEnableOption mkDefault;
+ cfg = config.modules.desktop.xorg;
+in
+{
+ options = {
+ modules.desktop.xorg = {
+ enable = mkEnableOption "Enable Xorg desktop";
+ };
+ };
+ config = mkIf cfg.enable {
+ modules.desktop.enable = true;
+ # Extra packages to add to the system
+ environment.systemPackages = with pkgs; [
+ xorg.xmessage
+ ];
+
+ services = {
+ # Enable xserver on desktop
+ xserver = {
+ enable = true;
+ enableTCP = false;
+ libinput.enable = true;
+ synaptics.enable = false;
+ layout = "fr";
+ xkbVariant = "bepo";
+ xkbOptions = "grp:menu_toggle,grp_led:caps,compose:caps";
+ };
+ };
+
+ };
+}