about summary refs log tree commit diff
path: root/modules/workstation/windowing/sway/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-05-24 18:01:26 +0000
committerAlyssa Ross <hi@alyssa.is>2019-05-24 18:01:26 +0000
commit1f2bcec14329a3e84386208df23fa4e56d8e4295 (patch)
treee7ee1525b171633682daacd9b746a9c50f510228 /modules/workstation/windowing/sway/default.nix
parent481843464adae60f1300a5df5a8b470d45be0631 (diff)
downloadnixlib-1f2bcec14329a3e84386208df23fa4e56d8e4295.tar
nixlib-1f2bcec14329a3e84386208df23fa4e56d8e4295.tar.gz
nixlib-1f2bcec14329a3e84386208df23fa4e56d8e4295.tar.bz2
nixlib-1f2bcec14329a3e84386208df23fa4e56d8e4295.tar.lz
nixlib-1f2bcec14329a3e84386208df23fa4e56d8e4295.tar.xz
nixlib-1f2bcec14329a3e84386208df23fa4e56d8e4295.tar.zst
nixlib-1f2bcec14329a3e84386208df23fa4e56d8e4295.zip
modules/sway: extract swayidle to own module
Diffstat (limited to 'modules/workstation/windowing/sway/default.nix')
-rw-r--r--modules/workstation/windowing/sway/default.nix56
1 files changed, 36 insertions, 20 deletions
diff --git a/modules/workstation/windowing/sway/default.nix b/modules/workstation/windowing/sway/default.nix
index 23076c475001..2aa073b7d943 100644
--- a/modules/workstation/windowing/sway/default.nix
+++ b/modules/workstation/windowing/sway/default.nix
@@ -1,29 +1,45 @@
-{ pkgs, ... }:
+{ pkgs, lib, config, ... }:
 
-let
-  config = pkgs.substituteAll {
-    src = ./config.in;
-    inherit status_command choose_workspace;
-  };
+{
+  imports = [ ./swayidle ];
 
-  status_command = pkgs.substituteAll {
-    src = ./status_command.in;
-    isExecutable = true;
-    inherit (pkgs) execline;
+  options = {
+    programs.sway.extraConfig = with lib; mkOption {
+      type = types.lines;
+      description = "Lines to append to sway's config file";
+      default = "";
+    };
   };
 
-  choose_workspace = pkgs.substituteAll {
-    src = ./choose_workspace.in;
-    isExecutable = true;
-    inherit (pkgs) execline jq;
-  };
+  config = let
+    cfg = config.programs.sway;
 
-in
+    configFile = pkgs.substituteAll {
+      src = ./config.in;
+      inherit choose_workspace status_command;
+      inherit (cfg) extraConfig;
+    };
 
-{
-  environment.systemPackages = with pkgs; [ choose ];
+    status_command = pkgs.substituteAll {
+      src = ./status_command.in;
+      isExecutable = true;
+      inherit (pkgs) execline;
+    };
 
-  programs.sway.enable = true;
+    choose_workspace = pkgs.substituteAll {
+      src = ./choose_workspace.in;
+      isExecutable = true;
+      inherit (pkgs) execline jq;
+    };
 
-  xdg.config.users.qyliss.paths."sway/config" = config;
+  in
+
+  {
+    environment.systemPackages = with pkgs; [ choose ];
+
+    programs.sway.enable = true;
+    programs.swayidle.enable = true;
+
+    xdg.config.users.qyliss.paths."sway/config" = configFile;
+  };
 }