@ -34,13 +34,12 @@ let
$ { cfg . extraCgroupConfig }
'' ;
slurmdbdConf = pkgs . writeTextDir " s l u r m d b d . c o n f "
slurmdbdConf = pkgs . writeText " s l u r m d b d . c o n f "
''
DbdHost = $ { cfg . dbdserver . dbdHost }
SlurmUser = $ { cfg . user }
StorageType = accounting_storage/mysql
StorageUser = $ { cfg . dbdserver . storageUser }
$ { optionalString ( cfg . dbdserver . storagePass != null ) " S t o r a g e P a s s = ${ cfg . dbdserver . storagePass } " }
$ { cfg . dbdserver . extraConfig }
'' ;
@ -95,26 +94,12 @@ in
'' ;
} ;
storagePass = mkOption {
type = types . nullOr types . str ;
storagePassFile = mkOption {
type = with types ; nullOr str ;
default = null ;
description = ''
Database password . Note that this password will be publicable
readable in the nix store . Use <option> configFile < /option >
to store the and config file and password outside the nix store .
'' ;
} ;
configFile = mkOption {
type = types . nullOr types . str ;
default = null ;
description = ''
Path to <literal> slurmdbd . conf < /literal > . The password for the database connection
is stored in the config file . Use this option to specfify a path
outside the nix store . If this option is unset a configuration file
will be generated . See also :
<citerefentry> <refentrytitle> slurmdbd . conf < /refentrytitle >
<manvolnum> 8 < /manvolnum > < /citerefentry > .
Path to file with database password . The content of this will be used to
create the password for the <literal> StoragePass < /literal > option .
'' ;
} ;
@ -122,7 +107,9 @@ in
type = types . lines ;
default = " " ;
description = ''
Extra configuration for <literal> slurmdbd . conf < /literal >
Extra configuration for <literal> slurmdbd . conf < /literal > See also :
<citerefentry> <refentrytitle> slurmdbd . conf < /refentrytitle >
<manvolnum> 8 < /manvolnum > < /citerefentry > .
'' ;
} ;
} ;
@ -292,6 +279,16 @@ in
} ;
imports = [
( mkRemovedOptionModule [ " s e r v i c e s " " s l u r m " " d b d s e r v e r " " s t o r a g e P a s s " ] ''
This option has been removed so that the database password is not exposed via the nix store .
Use services . slurm . dbdserver . storagePassFile to provide the database password .
'' )
( mkRemovedOptionModule [ " s e r v i c e s " " s l u r m " " d b d s e r v e r " " c o n f i g F i l e " ] ''
This option has been removed . Use services . slurm . dbdserver . storagePassFile
and services . slurm . dbdserver . extraConfig instead .
'' )
] ;
###### implementation
@ -386,23 +383,34 @@ in
'' ;
} ;
systemd . services . slurmdbd = mkIf ( cfg . dbdserver . enable ) {
systemd . services . slurmdbd = let
# slurm strips the last component off the path
configPath = " $ R U N T I M E _ D I R E C T O R Y / s l u r m d b d . c o n f " ;
in mkIf ( cfg . dbdserver . enable ) {
path = with pkgs ; [ wrappedSlurm munge coreutils ] ;
wantedBy = [ " m u l t i - u s e r . t a r g e t " ] ;
after = [ " n e t w o r k . t a r g e t " " m u n g e d . s e r v i c e " " m y s q l . s e r v i c e " ] ;
requires = [ " m u n g e d . s e r v i c e " " m y s q l . s e r v i c e " ] ;
# slurm strips the last component off the path
environment . SLURM_CONF =
if ( cfg . dbdserver . configFile == null ) then
" ${ slurmdbdConf } / s l u r m . c o n f "
else
cfg . dbdserver . configFile ;
preStart = ''
cp $ { slurmdbdConf } $ { configPath }
chmod 600 $ { configPath }
chown $ { cfg . user } $ { configPath }
$ { optionalString ( cfg . dbdserver . storagePassFile != null ) ''
echo " S t o r a g e P a s s = $ ( c a t ${ cfg . dbdserver . storagePassFile } ) " \
> > $ { configPath }
'' }
'' ;
script = ''
export SLURM_CONF = $ { configPath }
exec $ { cfg . package } /bin/slurmdbd - D
'' ;
serviceConfig = {
Type = " f o r k i n g " ;
ExecStart = " ${ cfg . package } / b i n / s l u r m d b d " ;
RuntimeDirectory = " s l u r m d b d " ;
Type = " s i m p l e " ;
PIDFile = " / r u n / s l u r m d b d . p i d " ;
ExecReload = " ${ pkgs . coreutils } / b i n / k i l l - H U P $ M A I N P I D " ;
} ;