fix(mkTf2Config): Pass additional arguments to mkDerivation
This commit is contained in:
@@ -5,25 +5,29 @@
|
|||||||
, custom ? []
|
, custom ? []
|
||||||
, cfg ? []
|
, cfg ? []
|
||||||
, maps ? []
|
, maps ? []
|
||||||
# Extra arguments to pass to stdenv.mkDerivation.
|
# Extra arguments to pass to stdenv.mkDerivation. Exists for
|
||||||
|
# backward-compatibility.
|
||||||
, env ? {}
|
, env ? {}
|
||||||
|
, ...
|
||||||
}@args:
|
}@args:
|
||||||
|
|
||||||
let
|
let
|
||||||
version-suffix = lib.optionalString (version != null) "-${version}";
|
version-suffix = lib.optionalString (version != null) "-${version}";
|
||||||
name = pname + version-suffix;
|
name = pname + version-suffix;
|
||||||
|
|
||||||
|
# Creates and populates an output under $out/${output}. The parameter
|
||||||
|
# `output` is a TF2 config output, i.e. "cfg", "custom", or "maps".
|
||||||
make-output = output: var:
|
make-output = output: var:
|
||||||
lib.optionalString (var != []) ''
|
lib.optionalString (var != []) ''
|
||||||
mkdir -p "$out/${output}"
|
mkdir -p "$out/${output}"
|
||||||
${lib.toShellVar "outputList_${output}" var}
|
${lib.toShellVar "outputList_${output}" var}
|
||||||
for i in "''${outputList_${output}[@]}"; do
|
for i in "''${outputList_${output}[@]}"; do
|
||||||
name="$(stripHash "$i")"
|
piece="$(stripHash "$i")"
|
||||||
wrapperDir="#''${name}#"
|
wrapperDir="#''${piece}#"
|
||||||
if [ -d "$wrapperDir" ]; then
|
if [ -d "$wrapperDir" ]; then
|
||||||
mv "$wrapperDir"/* "$out/${output}/"
|
mv "$wrapperDir"/* "$out/${output}/"
|
||||||
else
|
else
|
||||||
mv "$name" "$out/${output}/$name"
|
mv "$piece" "$out/${output}/$piece"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
@@ -34,12 +38,19 @@ let
|
|||||||
if builtins.length allSrcs == 1
|
if builtins.length allSrcs == 1
|
||||||
then { src = builtins.head allSrcs; }
|
then { src = builtins.head allSrcs; }
|
||||||
else { srcs = allSrcs; sourceRoot = "."; };
|
else { srcs = allSrcs; sourceRoot = "."; };
|
||||||
|
|
||||||
|
# Arguments unused by mkTf2Config fall through to mkDerivation.
|
||||||
|
fallthroughArgs = lib.removeAttrs args [
|
||||||
|
"custom"
|
||||||
|
"cfg"
|
||||||
|
"maps"
|
||||||
|
"env"
|
||||||
|
];
|
||||||
in stdenv.mkDerivation ({
|
in stdenv.mkDerivation ({
|
||||||
inherit name;
|
inherit name;
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
# Adapted from stdenv's _defaultUnpack().
|
# Adapted from stdenv's _defaultUnpack().
|
||||||
unpackCmd = ''
|
unpackCmd = ''
|
||||||
echo "hello i am unpackcmdjkj"
|
|
||||||
set -e
|
set -e
|
||||||
case "$curSrc" in
|
case "$curSrc" in
|
||||||
*.vpk)
|
*.vpk)
|
||||||
@@ -82,4 +93,4 @@ in stdenv.mkDerivation ({
|
|||||||
${make-output "custom" custom}
|
${make-output "custom" custom}
|
||||||
${make-output "maps" maps}
|
${make-output "maps" maps}
|
||||||
'';
|
'';
|
||||||
} // srcArg // env)
|
} // srcArg // fallthroughArgs // env)
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
{ mkTf2Config, fetchFromGitHub }:
|
{ mkTf2Config, fetchFromGitHub, lib }:
|
||||||
|
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(name: e: mkTf2Config {
|
(name: e: mkTf2Config {
|
||||||
pname = name;
|
pname = name;
|
||||||
env.description = e.description;
|
|
||||||
custom = [
|
custom = [
|
||||||
(fetchFromGitHub (builtins.removeAttrs e.src ["__type"] // {
|
(fetchFromGitHub (builtins.removeAttrs e.src ["__type"] // {
|
||||||
name = "${name}-src";
|
name = "${name}-src";
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
|
meta = {
|
||||||
|
inherit (e) description;
|
||||||
|
# Hud-db currently requires all HUDs to be on GitHub. We can thus
|
||||||
|
# somewhat-safely assume the homepage. A number of packages have
|
||||||
|
# explicitly-set homepages, and we do not yet support them. Doing so
|
||||||
|
# requires patching the fetch-hud-db script, which I intend to do soonish.
|
||||||
|
homepage = "https://github.com/${e.src.owner}/${e.src.repo}";
|
||||||
|
platforms = lib.platforms.all;
|
||||||
|
# The biggest outstanding issue is recording the license here. Hud-db
|
||||||
|
# does not track license info, whiuch is a big issue IMO.
|
||||||
|
};
|
||||||
})
|
})
|
||||||
(builtins.fromJSON (builtins.readFile ./hud-db.json))
|
(builtins.fromJSON (builtins.readFile ./hud-db.json))
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
[clojure.tools.logging :as l]
|
[clojure.tools.logging :as l]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as str]))
|
||||||
|
|
||||||
|
;; https://github.com/mastercomfig/hud-db is expected to be cloned to
|
||||||
|
;; `hud-db-root`.
|
||||||
(def hud-db-root (or (System/getenv "HUD_DB_ROOT")
|
(def hud-db-root (or (System/getenv "HUD_DB_ROOT")
|
||||||
(fs/expand-home "~/git/hud-db")))
|
(fs/expand-home "~/git/hud-db")))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user