1{ config, lib, pkgs, ... }:
2with lib;
3let
4 cfg = config.services.fractalart;
5in {
6 options.services.fractalart = {
7 enable = mkOption {
8 type = types.bool;
9 default = false;
10 example = true;
11 description = "Enable FractalArt for generating colorful wallpapers on login";
12 };
13
14 width = mkOption {
15 type = types.nullOr types.int;
16 default = null;
17 example = 1920;
18 description = "Screen width";
19 };
20
21 height = mkOption {
22 type = types.nullOr types.int;
23 default = null;
24 example = 1080;
25 description = "Screen height";
26 };
27 };
28
29 config = mkIf cfg.enable {
30 environment.systemPackages = [ pkgs.haskellPackages.FractalArt ];
31 services.xserver.displayManager.sessionCommands =
32 "${pkgs.haskellPackages.FractalArt}/bin/FractalArt --no-bg -f .background-image"
33 + optionalString (cfg.width != null) " -w ${toString cfg.width}"
34 + optionalString (cfg.height != null) " -h ${toString cfg.height}";
35 };
36}