fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMove platform check into modules5f433eb1

master
1.2 KiB47 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4let cfg = config.services.devilspie2;
5in {
6  meta.maintainers = [ maintainers.dawidsowa ];
7
8  options = {
9    services.devilspie2 = {
10      enable = mkEnableOption ''
11        Devilspie2, a window matching utility, allowing the user to
12        perform scripted actions on windows as they are created'';
13
14      config = mkOption {
15        type = types.lines;
16        default = "";
17        description = ''
18          Content of file placed in the devilspie2 config directory.
19        '';
20        example = ''
21          if (get_window_class() == "Gnome-terminal") then
22              make_always_on_top();
23          end
24        '';
25      };
26    };
27  };
28
29  config = mkIf cfg.enable {
30    assertions = [
31      (lib.hm.assertions.assertPlatform "services.devilspie2" pkgs
32        lib.platforms.linux)
33    ];
34
35    systemd.user.services.devilspie2 = {
36      Service.ExecStart = "${pkgs.devilspie2}/bin/devilspie2";
37      Unit = {
38        Description = "devilspie2";
39        After = [ "graphical-session-pre.target" ];
40        PartOf = [ "graphical-session.target" ];
41      };
42      Install.WantedBy = [ "graphical-session.target" ];
43    };
44
45    xdg.configFile."devilspie2/config.lua".text = cfg.config;
46  };
47}