Merge pull request #14915 from elitak/unifi
unifi, mfi: closure-size fix, relocatable data dir
This commit is contained in:
commit
1dde66596f
@ -10,6 +10,7 @@ let
|
|||||||
{ what = "${pkgs.mfi}/dl"; where = "${stateDir}/dl"; }
|
{ what = "${pkgs.mfi}/dl"; where = "${stateDir}/dl"; }
|
||||||
{ what = "${pkgs.mfi}/lib"; where = "${stateDir}/lib"; }
|
{ what = "${pkgs.mfi}/lib"; where = "${stateDir}/lib"; }
|
||||||
{ what = "${pkgs.mongodb248}/bin"; where = "${stateDir}/bin"; }
|
{ what = "${pkgs.mongodb248}/bin"; where = "${stateDir}/bin"; }
|
||||||
|
{ what = "${cfg.dataDir}"; where = "${stateDir}/data"; }
|
||||||
];
|
];
|
||||||
systemdMountPoints = map (m: "${utils.escapeSystemdPath m.where}.mount") mountPoints;
|
systemdMountPoints = map (m: "${utils.escapeSystemdPath m.where}.mount") mountPoints;
|
||||||
ports = [ 6080 6880 6443 6843 ];
|
ports = [ 6080 6880 6443 6843 ];
|
||||||
@ -23,6 +24,15 @@ in
|
|||||||
default = true;
|
default = true;
|
||||||
description = "Whether to open TCP ports ${concatMapStrings (a: "${toString a} ") ports}for the services.";
|
description = "Whether to open TCP ports ${concatMapStrings (a: "${toString a} ") ports}for the services.";
|
||||||
};
|
};
|
||||||
|
dataDir = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "${stateDir}/data";
|
||||||
|
description = ''
|
||||||
|
Where to store the database and other data.
|
||||||
|
|
||||||
|
This directory will be bind-mounted to ${stateDir}/data as part of the service startup.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@ let
|
|||||||
what = "${pkgs.mongodb}/bin";
|
what = "${pkgs.mongodb}/bin";
|
||||||
where = "${stateDir}/bin";
|
where = "${stateDir}/bin";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
what = "${cfg.dataDir}";
|
||||||
|
where = "${stateDir}/data";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
systemdMountPoints = map (m: "${utils.escapeSystemdPath m.where}.mount") mountPoints;
|
systemdMountPoints = map (m: "${utils.escapeSystemdPath m.where}.mount") mountPoints;
|
||||||
in
|
in
|
||||||
@ -32,6 +36,16 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.unifi.dataDir = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "${stateDir}/data";
|
||||||
|
description = ''
|
||||||
|
Where to store the database and other data.
|
||||||
|
|
||||||
|
This directory will be bind-mounted to ${stateDir}/data as part of the service startup.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@ -62,7 +76,7 @@ in
|
|||||||
bindsTo = systemdMountPoints;
|
bindsTo = systemdMountPoints;
|
||||||
unitConfig.RequiresMountsFor = stateDir;
|
unitConfig.RequiresMountsFor = stateDir;
|
||||||
# This a HACK to fix missing dependencies of dynamic libs extracted from jars
|
# This a HACK to fix missing dependencies of dynamic libs extracted from jars
|
||||||
environment.LD_LIBRARY_PATH = with pkgs.stdenv; "${cc.cc}/lib";
|
environment.LD_LIBRARY_PATH = with pkgs.stdenv; "${cc.cc.lib}/lib";
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
# Ensure privacy of state
|
# Ensure privacy of state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user