at 23.05-pre 1.3 kB view raw
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 = lib.mdDoc '' 21 Whether to install SpaceFM and create {file}`/etc/spacefm/spacefm.conf`. 22 ''; 23 }; 24 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 }; 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}