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