typioca: 2.7.0 -> 2.8.0
[NixPkgs.git] / nixos / modules / programs / spacefm.nix
blobb4ba9dcdea5676b3dded3a97fa4e41b9ed68624b
1 # Global configuration for spacefm.
3 { config, lib, pkgs, ... }:
5 with lib;
7 let cfg = config.programs.spacefm;
9 in
11   ###### interface
13   options = {
15     programs.spacefm = {
17       enable = mkOption {
18         type = types.bool;
19         default = false;
20         description = lib.mdDoc ''
21           Whether to install SpaceFM and create {file}`/etc/spacefm/spacefm.conf`.
22         '';
23       };
25       settings = mkOption {
26         type = types.attrs;
27         default = {
28           tmp_dir = "/tmp";
29           terminal_su = "${pkgs.sudo}/bin/sudo";
30         };
31         defaultText = literalExpression ''
32           {
33             tmp_dir = "/tmp";
34             terminal_su = "''${pkgs.sudo}/bin/sudo";
35           }
36         '';
37         description = lib.mdDoc ''
38           The system-wide spacefm configuration.
39           Parameters to be written to {file}`/etc/spacefm/spacefm.conf`.
40           Refer to the [relevant entry](https://ignorantguru.github.io/spacefm/spacefm-manual-en.html#programfiles-etc) in the SpaceFM manual.
41         '';
42       };
44     };
45   };
47   ###### implementation
49   config = mkIf cfg.enable {
50     environment.systemPackages = [ pkgs.spaceFM ];
52     environment.etc."spacefm/spacefm.conf".text =
53       concatStrings (mapAttrsToList (n: v: "${n}=${toString v}\n") cfg.settings);
54   };