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.nix48
1 files changed, 14 insertions, 34 deletions
diff --git a/modules/workstation/windowing/sway/default.nix b/modules/workstation/windowing/sway/default.nix
index d0e7e556fc52..22de51a801be 100644
--- a/modules/workstation/windowing/sway/default.nix
+++ b/modules/workstation/windowing/sway/default.nix
@@ -3,6 +3,9 @@
 let
   inherit (lib) mkOption optionalString;
   inherit (lib.types) lines nullOr path;
+  inherit (pkgs) callPackage substituteAll;
+
+  cfg = config.programs.sway;
 in
 
 {
@@ -22,45 +25,22 @@ in
     };
   };
 
-  config = let
-    cfg = config.programs.sway;
-
-    configFile = pkgs.substituteAll {
-      src = ./config.in;
-      inherit choose_workspace status_command;
-      extraConfig = cfg.extraConfig + optionalString (cfg.wallpaper != null) ''
-        output * bg ${cfg.wallpaper} fill
-      '';
-    };
-
-    status_command = "${pkgs.runCommandCC "status" {} ''
-      mkdir -p $out/bin
-      c++ -std=c++17 -o $out/bin/status ${./status.cpp}
-    ''}/bin/status";
-
-    choose_workspace = pkgs.substituteAll {
-      src = ./choose_workspace.sh.in;
-      isExecutable = true;
-      inherit (pkgs) bemenu jq;
-    };
-
-  in
-
-  {
+  config = {
     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.sway.wallpaper = callPackage ./wallpaper.nix { };
 
     programs.swayidle.enable = true;
 
-    users.users.qyliss.xdg.config.paths."sway/config" = configFile;
+    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
+      '';
+    };
   };
 }