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.nix41
1 files changed, 27 insertions, 14 deletions
diff --git a/modules/workstation/windowing/sway/default.nix b/modules/workstation/windowing/sway/default.nix
index e05779e5513d..d0e7e556fc52 100644
--- a/modules/workstation/windowing/sway/default.nix
+++ b/modules/workstation/windowing/sway/default.nix
@@ -1,32 +1,36 @@
 { pkgs, lib, config, ... }:
 
+let
+  inherit (lib) mkOption optionalString;
+  inherit (lib.types) lines nullOr path;
+in
+
 {
-  imports = [ ./swayidle ];
+  imports = [ ./swayidle ./swaylock ];
 
   options = {
-    programs.sway.extraConfig = with lib; mkOption {
-      type = types.lines;
+    programs.sway.extraConfig = mkOption {
+      type = lines;
       description = "Lines to append to sway's config file";
       default = "";
     };
+
+    programs.sway.wallpaper = mkOption {
+      type = nullOr path;
+      description = "Path to wallpaper for sway and swaylock";
+      default = null;
+    };
   };
 
   config = let
     cfg = config.programs.sway;
 
-    wallpaper = pkgs.fetchurl {
-      url = https://mir-s3-cdn-cf.behance.net/project_modules/2800_opt_1/36731876964505.5c793fa788b5d.jpg;
-      sha256 = "1c6camdipng8ws41sgpcxzrxb96crgip3wirqjgf2ajn60qg3v64";
-
-      meta = with lib; {
-        homepage = https://www.behance.net/gallery/76964505/IQOO-style-frame-and-scene-design;
-      };
-    };
-
     configFile = pkgs.substituteAll {
       src = ./config.in;
-      inherit choose_workspace status_command wallpaper;
-      inherit (cfg) extraConfig;
+      inherit choose_workspace status_command;
+      extraConfig = cfg.extraConfig + optionalString (cfg.wallpaper != null) ''
+        output * bg ${cfg.wallpaper} fill
+      '';
     };
 
     status_command = "${pkgs.runCommandCC "status" {} ''
@@ -46,6 +50,15 @@
     environment.systemPackages = with pkgs; [ bemenu choose ];
 
     programs.sway.enable = true;
+    programs.sway.wallpaper = pkgs.fetchurl {
+      url = https://mir-s3-cdn-cf.behance.net/project_modules/2800_opt_1/36731876964505.5c793fa788b5d.jpg;
+      sha256 = "1c6camdipng8ws41sgpcxzrxb96crgip3wirqjgf2ajn60qg3v64";
+
+      meta = {
+        homepage = https://www.behance.net/gallery/76964505/IQOO-style-frame-and-scene-design;
+      };
+    };
+
     programs.swayidle.enable = true;
 
     users.users.qyliss.xdg.config.paths."sway/config" = configFile;