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