about summary refs log tree commit diff
path: root/nixos/modules/programs/spacefm.nix
blob: 6d03608402fce1fc5f3578fedad6269c897d6c80 (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
47
48
49
50
51
52
53
54
55
# Global configuration for spacefm.

{ config, lib, pkgs, ... }:

with lib;

let cfg = config.programs.spacefm;

in
{
  ###### interface

  options = {

    programs.spacefm = {

      enable = mkOption {
        type = types.bool;
        default = false;
        description = ''
          Whether to install SpaceFM and create <filename>/etc/spacefm/spacefm.conf</filename>.
        '';
      };

      settings = mkOption {
        type = types.attrs;
        default = {
          tmp_dir = "/tmp";
          terminal_su = "${pkgs.sudo}/bin/sudo";
          graphical_su = "${pkgs.gksu}/bin/gksu";
        };
        example = literalExample ''{
          tmp_dir = "/tmp";
          terminal_su = "''${pkgs.sudo}/bin/sudo";
          graphical_su = "''${pkgs.gksu}/bin/gksu";
        }'';
        description = ''
          The system-wide spacefm configuration.
          Parameters to be written to <filename>/etc/spacefm/spacefm.conf</filename>.
          Refer to the <link xlink:href="https://ignorantguru.github.io/spacefm/spacefm-manual-en.html#programfiles-etc">relevant entry</link> in the SpaceFM manual.
        '';
      };

    };
  };

  ###### implementation

  config = mkIf cfg.enable {
    environment.systemPackages = [ pkgs.spaceFM ];

    environment.etc."spacefm/spacefm.conf".text =
      concatStrings (mapAttrsToList (n: v: "${n}=${toString v}\n") cfg.settings);
  };
}