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