Files
tf2-nix/tf2/packages/default.nix

50 lines
1.2 KiB
Nix

{ pkgs }:
let
inherit (pkgs) lib;
mkTf2Config = pkgs.callPackage ../mkTf2Config.nix {};
fetchFromGameBanana =
{ id
, hash
, name ? "source"
}:
pkgs.fetchzip {
url = "https://gamebanana.com/dl/${id}";
extension = "zip";
inherit hash name;
};
mkCfg = path: body:
pkgs.runCommand path {} ''
${lib.toShellVar "pathPart" path}
path="$out/cfg/$pathPart.cfg"
mkdir -p "$(dirname -- "$path")"
echo "// Generated by tf2.nix" >> "$path"
echo >> "$path"
echo ${lib.escapeShellArg body} >> "$path"
'';
mergeTf2Configs = configs:
pkgs.symlinkJoin {
name = "merged-tf2-config";
paths = configs;
};
extra-args = {
inherit mkTf2Config fetchFromGameBanana mkCfg mergeTf2Configs callPackage;
};
callPackage = lib.callPackageWith (pkgs // extra-args);
in lib.mergeAttrsList [
{ inherit mkTf2Config fetchFromGameBanana mkCfg mergeTf2Configs; }
{ mastercomfig = callPackage ./mastercomfig.nix {}; }
{ huds = callPackage ./huds {}; }
{ maps = callPackage ./maps {}; }
(builtins.mapAttrs
(_: v: callPackage v {})
(import ./misc {inherit lib;}))
(callPackage ./scripts.nix {})
]