summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorFranz Thoma <franz.thoma@tngtech.com>2016-05-30 23:33:15 +0200
committerobadz <obadz-git@obadz.com>2016-06-16 14:26:17 +0100
commit688d7cd3a6708182d8937413a6f0509af3f6ba74 (patch)
treeb1a61513814c8c4c6fb47af73bcc259e434de3c5 /nixos/modules/services
parentb60b7eeaab9d97e3c52da28e77993df51028b15d (diff)
downloadnixlib-688d7cd3a6708182d8937413a6f0509af3f6ba74.tar
nixlib-688d7cd3a6708182d8937413a6f0509af3f6ba74.tar.gz
nixlib-688d7cd3a6708182d8937413a6f0509af3f6ba74.tar.bz2
nixlib-688d7cd3a6708182d8937413a6f0509af3f6ba74.tar.lz
nixlib-688d7cd3a6708182d8937413a6f0509af3f6ba74.tar.xz
nixlib-688d7cd3a6708182d8937413a6f0509af3f6ba74.tar.zst
nixlib-688d7cd3a6708182d8937413a6f0509af3f6ba74.zip
i3-gaps: add as window manager
Closes #15917
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/x11/window-managers/i3.nix62
1 files changed, 34 insertions, 28 deletions
diff --git a/nixos/modules/services/x11/window-managers/i3.nix b/nixos/modules/services/x11/window-managers/i3.nix
index 2e2e10cc33b0..aea0a8986786 100644
--- a/nixos/modules/services/x11/window-managers/i3.nix
+++ b/nixos/modules/services/x11/window-managers/i3.nix
@@ -3,37 +3,43 @@
 with lib;
 
 let
-  cfg = config.services.xserver.windowManager.i3;
-in
-
-{
-  options = {
-    services.xserver.windowManager.i3 = {
-      enable = mkEnableOption "i3";
+  wmCfg = config.services.xserver.windowManager;
 
-      configFile = mkOption {
-        default = null;
-        type = types.nullOr types.path;
-        description = ''
-          Path to the i3 configuration file.
-          If left at the default value, $HOME/.i3/config will be used.
-        '';
-      };
+  i3option = name: {
+    enable = mkEnableOption name;
+    configFile = mkOption {
+      default = null;
+      type = types.nullOr types.path;
+      description = ''
+        Path to the i3 configuration file.
+        If left at the default value, $HOME/.i3/config will be used.
+      '';
     };
   };
 
-  config = mkIf cfg.enable {
-    services.xserver.windowManager = {
-      session = [{
-        name = "i3";
-        start = ''
-          ${pkgs.i3}/bin/i3 ${optionalString (cfg.configFile != null)
-            "-c \"${cfg.configFile}\""
-          } &
-          waitPID=$!
-        '';
-      }];
-    };
-    environment.systemPackages = with pkgs; [ i3 ];
+  i3config = name: pkg: cfg: {
+    services.xserver.windowManager.session = [{
+      inherit name;
+      start = ''
+        ${pkg}/bin/i3 ${optionalString (cfg.configFile != null)
+          "-c \"${cfg.configFile}\""
+        } &
+        waitPID=$!
+      '';
+    }];
+    environment.systemPackages = [ pkg ];
+  };
+
+in
+
+{
+  options.services.xserver.windowManager = {
+    i3 = i3option "i3";
+    i3-gaps = i3option "i3-gaps";
   };
+
+  config = mkMerge [
+    (mkIf wmCfg.i3.enable (i3config "i3" pkgs.i3 wmCfg.i3))
+    (mkIf wmCfg.i3-gaps.enable (i3config "i3-gaps" pkgs.i3-gaps wmCfg.i3-gaps))
+  ];
 }