Merge staging-next into staging

This commit is contained in:
github-actions[bot] 2021-05-04 12:23:31 +00:00 committed by GitHub
commit dfafc173e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 18 deletions

View File

@ -50,7 +50,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<varname>pkgs.formats.ini</varname> { <replaceable>listsAsDuplicateKeys</replaceable> ? false, ... } <varname>pkgs.formats.ini</varname> { <replaceable>listsAsDuplicateKeys</replaceable> ? false, <replaceable>listToValue</replaceable> ? null, ... }
</term> </term>
<listitem> <listitem>
<para> <para>
@ -66,6 +66,16 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<varname>listToValue</varname>
</term>
<listitem>
<para>
A function for turning a list of values into a single value.
</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
It returns a set with INI-specific attributes <varname>type</varname> and <varname>generate</varname> as specified <link linkend='pkgs-formats-result'>below</link>. It returns a set with INI-specific attributes <varname>type</varname> and <varname>generate</varname> as specified <link linkend='pkgs-formats-result'>below</link>.
</para> </para>

View File

@ -403,9 +403,7 @@ in
requires = [ "munged.service" "mysql.service" ]; requires = [ "munged.service" "mysql.service" ];
preStart = '' preStart = ''
cp ${slurmdbdConf} ${configPath} install -m 600 -o ${cfg.user} -T ${slurmdbdConf} ${configPath}
chmod 600 ${configPath}
chown ${cfg.user} ${configPath}
${optionalString (cfg.dbdserver.storagePassFile != null) '' ${optionalString (cfg.dbdserver.storagePassFile != null) ''
echo "StoragePass=$(cat ${cfg.dbdserver.storagePassFile})" \ echo "StoragePass=$(cat ${cfg.dbdserver.storagePassFile})" \
>> ${configPath} >> ${configPath}

View File

@ -4,23 +4,25 @@ with lib;
let let
runDir = "/run/searx"; runDir = "/run/searx";
cfg = config.services.searx; cfg = config.services.searx;
settingsFile = pkgs.writeText "settings.yml"
(builtins.toJSON cfg.settings);
generateConfig = '' generateConfig = ''
cd ${runDir} cd ${runDir}
# write NixOS settings as JSON # write NixOS settings as JSON
cat <<'EOF' > settings.yml (
${builtins.toJSON cfg.settings} umask 077
EOF cp --no-preserve=mode ${settingsFile} settings.yml
)
# substitute environment variables # substitute environment variables
env -0 | while IFS='=' read -r -d ''' n v; do env -0 | while IFS='=' read -r -d ''' n v; do
sed "s#@$n@#$v#g" -i settings.yml sed "s#@$n@#$v#g" -i settings.yml
done done
# set strict permissions
chmod 400 settings.yml
''; '';
settingType = with types; (oneOf settingType = with types; (oneOf

View File

@ -17,7 +17,7 @@
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
pname = "metadata-cleaner"; pname = "metadata-cleaner";
version = "1.0.5"; version = "1.0.6";
format = "other"; format = "other";
@ -25,7 +25,7 @@ python3.pkgs.buildPythonApplication rec {
owner = "rmnvgr"; owner = "rmnvgr";
repo = "metadata-cleaner"; repo = "metadata-cleaner";
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-9s9i703Svql1Nn1M1sFp3FOtLGjuxXi6YR6nsUJCkeg="; sha256 = "0k9qnycaqxnmsjsyxqgip6xr5w9affzxjc4zyb38ajbq4arfq5wv";
}; };
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -56,7 +56,16 @@ rec {
}; };
}; };
ini = { listsAsDuplicateKeys ? false, ... }@args: { ini = {
# Represents lists as duplicate keys
listsAsDuplicateKeys ? false,
# Alternative to listsAsDuplicateKeys, converts list to non-list
# listToValue :: [IniAtom] -> IniAtom
listToValue ? null,
...
}@args:
assert !listsAsDuplicateKeys || listToValue == null;
{
type = with lib.types; let type = with lib.types; let
@ -74,12 +83,25 @@ rec {
coercedTo singleIniAtom lib.singleton (listOf singleIniAtom) // { coercedTo singleIniAtom lib.singleton (listOf singleIniAtom) // {
description = singleIniAtom.description + " or a list of them for duplicate keys"; description = singleIniAtom.description + " or a list of them for duplicate keys";
} }
else if listToValue != null then
coercedTo singleIniAtom lib.singleton (nonEmptyListOf singleIniAtom) // {
description = singleIniAtom.description + " or a non-empty list of them";
}
else else
singleIniAtom; singleIniAtom;
in attrsOf (attrsOf iniAtom); in attrsOf (attrsOf iniAtom);
generate = name: value: pkgs.writeText name (lib.generators.toINI args value); generate = name: value:
let
transformedValue =
if listToValue != null
then
lib.mapAttrs (section: lib.mapAttrs (key: val:
if lib.isList val then listToValue val else val
)) value
else value;
in pkgs.writeText name (lib.generators.toINI (removeAttrs args ["listToValue"]) transformedValue);
}; };

View File

@ -124,6 +124,22 @@ in runBuildTests {
''; '';
}; };
testIniListToValue = {
drv = evalFormat formats.ini { listToValue = concatMapStringsSep ", " (generators.mkValueStringDefault {}); } {
foo = {
bar = [ null true "test" 1.2 10 ];
baz = false;
qux = "qux";
};
};
expected = ''
[foo]
bar=null, true, test, 1.200000, 10
baz=false
qux=qux
'';
};
testTomlAtoms = { testTomlAtoms = {
drv = evalFormat formats.toml {} { drv = evalFormat formats.toml {} {
false = false; false = false;

View File

@ -9,7 +9,7 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "slurm"; pname = "slurm";
version = "20.11.5.1"; version = "20.11.6.1";
# N.B. We use github release tags instead of https://www.schedmd.com/downloads.php # N.B. We use github release tags instead of https://www.schedmd.com/downloads.php
# because the latter does not keep older releases. # because the latter does not keep older releases.
@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
repo = "slurm"; repo = "slurm";
# The release tags use - instead of . # The release tags use - instead of .
rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}"; rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}";
sha256 = "1anzjv9sdl1a3j6sxsy2q8dy4dax1a4yqc9rnprlzymjkgb8hy75"; sha256 = "1c2dqqddw5bfb27smq7rqa7v1wymdj155ky50rbyvl36pmhc9djp";
}; };
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];

View File

@ -7,13 +7,13 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "bpytop"; pname = "bpytop";
version = "1.0.64"; version = "1.0.65";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "aristocratos"; owner = "aristocratos";
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-BwpMBPTWSrfmz7SHYa1+SZ79V2YZdIkZcOTLtlVlgr8="; sha256 = "sha256-sWANeoUbvnrTksqfeIRU4a5XeX7QVzT9+ZT3R5Utp+4=";
}; };
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];