Merge master into staging-next
This commit is contained in:
commit
1a4bd09307
@ -50,7 +50,7 @@
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<varname>pkgs.formats.ini</varname> { <replaceable>listsAsDuplicateKeys</replaceable> ? false, ... }
|
||||
<varname>pkgs.formats.ini</varname> { <replaceable>listsAsDuplicateKeys</replaceable> ? false, <replaceable>listToValue</replaceable> ? null, ... }
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
@ -66,6 +66,16 @@
|
||||
</para>
|
||||
</listitem>
|
||||
</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>
|
||||
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>
|
||||
|
@ -403,9 +403,7 @@ in
|
||||
requires = [ "munged.service" "mysql.service" ];
|
||||
|
||||
preStart = ''
|
||||
cp ${slurmdbdConf} ${configPath}
|
||||
chmod 600 ${configPath}
|
||||
chown ${cfg.user} ${configPath}
|
||||
install -m 600 -o ${cfg.user} -T ${slurmdbdConf} ${configPath}
|
||||
${optionalString (cfg.dbdserver.storagePassFile != null) ''
|
||||
echo "StoragePass=$(cat ${cfg.dbdserver.storagePassFile})" \
|
||||
>> ${configPath}
|
||||
|
@ -4,23 +4,25 @@ with lib;
|
||||
|
||||
let
|
||||
runDir = "/run/searx";
|
||||
|
||||
cfg = config.services.searx;
|
||||
|
||||
settingsFile = pkgs.writeText "settings.yml"
|
||||
(builtins.toJSON cfg.settings);
|
||||
|
||||
generateConfig = ''
|
||||
cd ${runDir}
|
||||
|
||||
# write NixOS settings as JSON
|
||||
cat <<'EOF' > settings.yml
|
||||
${builtins.toJSON cfg.settings}
|
||||
EOF
|
||||
(
|
||||
umask 077
|
||||
cp --no-preserve=mode ${settingsFile} settings.yml
|
||||
)
|
||||
|
||||
# substitute environment variables
|
||||
env -0 | while IFS='=' read -r -d ''' n v; do
|
||||
sed "s#@$n@#$v#g" -i settings.yml
|
||||
done
|
||||
|
||||
# set strict permissions
|
||||
chmod 400 settings.yml
|
||||
'';
|
||||
|
||||
settingType = with types; (oneOf
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "metadata-cleaner";
|
||||
version = "1.0.5";
|
||||
version = "1.0.6";
|
||||
|
||||
format = "other";
|
||||
|
||||
@ -25,7 +25,7 @@ python3.pkgs.buildPythonApplication rec {
|
||||
owner = "rmnvgr";
|
||||
repo = "metadata-cleaner";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-9s9i703Svql1Nn1M1sFp3FOtLGjuxXi6YR6nsUJCkeg=";
|
||||
sha256 = "0k9qnycaqxnmsjsyxqgip6xr5w9affzxjc4zyb38ajbq4arfq5wv";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
@ -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
|
||||
|
||||
@ -74,12 +83,25 @@ rec {
|
||||
coercedTo singleIniAtom lib.singleton (listOf singleIniAtom) // {
|
||||
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
|
||||
singleIniAtom;
|
||||
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
|
@ -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 = {
|
||||
drv = evalFormat formats.toml {} {
|
||||
false = false;
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
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
|
||||
# because the latter does not keep older releases.
|
||||
@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
|
||||
repo = "slurm";
|
||||
# The release tags use - instead of .
|
||||
rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}";
|
||||
sha256 = "1anzjv9sdl1a3j6sxsy2q8dy4dax1a4yqc9rnprlzymjkgb8hy75";
|
||||
sha256 = "1c2dqqddw5bfb27smq7rqa7v1wymdj155ky50rbyvl36pmhc9djp";
|
||||
};
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
@ -7,13 +7,13 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "bpytop";
|
||||
version = "1.0.64";
|
||||
version = "1.0.65";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "aristocratos";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-BwpMBPTWSrfmz7SHYa1+SZ79V2YZdIkZcOTLtlVlgr8=";
|
||||
sha256 = "sha256-sWANeoUbvnrTksqfeIRU4a5XeX7QVzT9+ZT3R5Utp+4=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
Loading…
Reference in New Issue
Block a user