about summary refs log tree commit diff
path: root/modules/workstation/windowing/sway/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/workstation/windowing/sway/default.nix')
-rw-r--r--modules/workstation/windowing/sway/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/modules/workstation/windowing/sway/default.nix b/modules/workstation/windowing/sway/default.nix
new file mode 100644
index 000000000000..0f2f7591b1a1
--- /dev/null
+++ b/modules/workstation/windowing/sway/default.nix
@@ -0,0 +1,47 @@
+{ pkgs, lib, config, ... }:
+
+let
+  inherit (lib) mdDoc mkOption optionalString;
+  inherit (lib.types) lines nullOr path;
+  inherit (pkgs) callPackage substituteAll;
+
+  cfg = config.programs.sway;
+in
+
+{
+  imports = [ ./swayidle ./swaylock ./wlsunset ./xdg-desktop-portal-wlr ];
+
+  options = {
+    programs.sway.extraConfig = mkOption {
+      type = lines;
+      description = mdDoc "Lines to append to sway's config file";
+      default = "";
+    };
+
+    programs.sway.wallpaper = mkOption {
+      type = nullOr path;
+      description = mdDoc "Path to wallpaper for sway and swaylock";
+      default = null;
+    };
+  };
+
+  config = {
+    environment.systemPackages = with pkgs; [ bemenu choose swayidle ];
+
+    programs.sway.enable = true;
+    programs.sway.wallpaper = callPackage ./wallpaper.nix { };
+    programs.sway.extraPackages = []; # extra packages can go in systemPackages.
+
+    programs.swayidle.enable = true;
+
+    users.users.qyliss.xdg.config.paths."sway/config" = substituteAll {
+      src = ./config.in;
+      choose_workspace =
+        "${callPackage ./choose_workspace.nix { }}/bin/choose_workspace";
+      status_command = "${callPackage ./status.nix { }}/bin/status";
+      extraConfig = cfg.extraConfig + optionalString (cfg.wallpaper != null) ''
+        output * bg ${cfg.wallpaper} fill
+      '';
+    };
+  };
+}