2016-07-01 15:40:21 +00:00
|
|
|
# Global configuration for spacefm.
|
|
|
|
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let cfg = config.programs.spacefm;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
programs.spacefm = {
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2016-07-01 15:40:21 +00:00
|
|
|
default = false;
|
2022-07-20 10:32:04 +00:00
|
|
|
description = ''
|
|
|
|
Whether to install SpaceFM and create {file}`/etc/spacefm/spacefm.conf`.
|
2016-07-01 15:40:21 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
settings = lib.mkOption {
|
|
|
|
type = lib.types.attrs;
|
2016-07-01 15:40:21 +00:00
|
|
|
default = {
|
|
|
|
tmp_dir = "/tmp";
|
|
|
|
terminal_su = "${pkgs.sudo}/bin/sudo";
|
|
|
|
};
|
2024-04-17 11:37:58 +00:00
|
|
|
defaultText = lib.literalExpression ''
|
2021-10-03 16:06:03 +00:00
|
|
|
{
|
|
|
|
tmp_dir = "/tmp";
|
|
|
|
terminal_su = "''${pkgs.sudo}/bin/sudo";
|
|
|
|
}
|
|
|
|
'';
|
2022-07-20 10:32:04 +00:00
|
|
|
description = ''
|
2016-07-01 15:40:21 +00:00
|
|
|
The system-wide spacefm configuration.
|
2022-07-20 10:32:04 +00:00
|
|
|
Parameters to be written to {file}`/etc/spacefm/spacefm.conf`.
|
|
|
|
Refer to the [relevant entry](https://ignorantguru.github.io/spacefm/spacefm-manual-en.html#programfiles-etc) in the SpaceFM manual.
|
2016-07-01 15:40:21 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2016-07-01 15:40:21 +00:00
|
|
|
environment.systemPackages = [ pkgs.spaceFM ];
|
|
|
|
|
|
|
|
environment.etc."spacefm/spacefm.conf".text =
|
2024-04-17 11:37:58 +00:00
|
|
|
lib.concatStrings (lib.mapAttrsToList (n: v: "${n}=${builtins.toString v}\n") cfg.settings);
|
2016-07-01 15:40:21 +00:00
|
|
|
};
|
|
|
|
}
|