about summary refs log tree commit diff
path: root/modules/workstation/windowing/sway/default.nix
blob: 22de51a801be1efea2a7184ad2d9fd14cdd11fe7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ pkgs, lib, config, ... }:

let
  inherit (lib) mkOption optionalString;
  inherit (lib.types) lines nullOr path;
  inherit (pkgs) callPackage substituteAll;

  cfg = config.programs.sway;
in

{
  imports = [ ./swayidle ./swaylock ];

  options = {
    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 = {
    environment.systemPackages = with pkgs; [ bemenu choose ];

    programs.sway.enable = true;
    programs.sway.wallpaper = callPackage ./wallpaper.nix { };

    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
      '';
    };
  };
}