1# Global configuration for spacefm.
2
3{ config, lib, pkgs, ... }:
4
5with lib;
6
7let cfg = config.programs.spacefm;
8
9in
10{
11 ###### interface
12
13 options = {
14
15 programs.spacefm = {
16
17 enable = mkOption {
18 type = types.bool;
19 default = false;
20 description = ''
21 Whether to install SpaceFM and create <filename>/etc/spacefm/spacefm.conf</filename>.
22 '';
23 };
24
25 settings = mkOption {
26 type = types.attrs;
27 default = {
28 tmp_dir = "/tmp";
29 terminal_su = "${pkgs.sudo}/bin/sudo";
30 graphical_su = "${pkgs.gksu}/bin/gksu";
31 };
32 example = literalExample ''{
33 tmp_dir = "/tmp";
34 terminal_su = "''${pkgs.sudo}/bin/sudo";
35 graphical_su = "''${pkgs.gksu}/bin/gksu";
36 }'';
37 description = ''
38 The system-wide spacefm configuration.
39 Parameters to be written to <filename>/etc/spacefm/spacefm.conf</filename>.
40 Refer to the <link xlink:href="https://ignorantguru.github.io/spacefm/spacefm-manual-en.html#programfiles-etc">relevant entry</link> in the SpaceFM manual.
41 '';
42 };
43
44 };
45 };
46
47 ###### implementation
48
49 config = mkIf cfg.enable {
50 environment.systemPackages = [ pkgs.spaceFM ];
51
52 environment.etc."spacefm/spacefm.conf".text =
53 concatStrings (mapAttrsToList (n: v: "${n}=${toString v}\n") cfg.settings);
54 };
55}