8 cfg = config.services.ifm;
11 options.services.ifm = {
12 enable = lib.mkEnableOption ''
13 Improved file manager, a single-file web-based filemanager
15 Lightweight and minimal, served using PHP's built-in server
18 dataDir = lib.mkOption {
20 description = "Directory to serve throught the file managing service";
23 listenAddress = lib.mkOption {
25 default = "127.0.0.1";
26 description = "Address on which the service is listening";
31 type = lib.types.port;
33 description = "Port on which to serve the IFM service";
36 settings = lib.mkOption {
37 type = with lib.types; attrsOf anything;
40 Configuration of the IFM service.
42 See [the documentation](https://github.com/misterunknown/ifm/wiki/Configuration)
43 for available options and default values.
51 config = lib.mkIf cfg.enable {
52 systemd.services.ifm = {
53 description = "Improved file manager, a single-file web based filemanager";
55 after = [ "network-online.target" ];
56 wantedBy = [ "multi-user.target" ];
59 } // (builtins.mapAttrs (_: val: toString val) cfg.settings);
64 StandardOutput = "journal";
65 BindPaths = "${cfg.dataDir}:/data";
67 ExecStart = "${lib.getExe pkgs.ifm-web} ${lib.escapeShellArg cfg.listenAddress} ${builtins.toString cfg.port} /data";
72 meta.maintainers = with lib.maintainers; [ litchipi ];