Merge branch 'patch-2025-06-29--a' into 'main'

Misc changes

See merge request msyds/tf2-nix!2
This commit is contained in:
Madeleine
2025-07-06 07:14:11 +00:00
7 changed files with 42 additions and 20 deletions

View File

@@ -12,8 +12,8 @@
packages.x86_64-linux.default = packages.x86_64-linux.default =
let let
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; pkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
tf2pkgs = inputs.tf2-nix.packages.x86_64-linux; tf2Pkgs = inputs.tf2-nix.lib.mkTf2Pkgs { inherit pkgs; };
in tf2pkgs.mergeTf2Configs (with tf2pkgs; [ in tf2Pkgs.mergeTf2Configs (with tf2Pkgs; [
mastercomfig.presets.medium-low mastercomfig.presets.medium-low
mastercomfig.addons.flat-mouse mastercomfig.addons.flat-mouse
mastercomfig.addons.no-tutorial mastercomfig.addons.no-tutorial

View File

@@ -7,13 +7,32 @@
}; };
outputs = { self, ... }@inputs: outputs = { self, ... }@inputs:
let
# keep it as an attrset arg for future expandability
mkTf2Pkgs = { pkgs }: import ./tf2/packages { inherit pkgs; };
in
inputs.flake-utils.lib.eachDefaultSystem (system: inputs.flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = import inputs.nixpkgs { inherit system; }; pkgs = import inputs.nixpkgs { inherit system; };
lib = pkgs.lib; inherit (pkgs) lib;
tf2Pkgs = mkTf2Pkgs { inherit pkgs; };
in { in {
packages = import ./tf2/packages { legacyPackages = tf2Pkgs;
inherit pkgs lib; packages = lib.mergeAttrsList (lib.flip map [
}; []
}); [ "huds" ]
[ "maps" ]
[ "mastercomfig" "addons" ]
[ "mastercomfig" "presets" ]
] (attrPath:
lib.pipe tf2Pkgs [
(lib.getAttrFromPath attrPath)
(lib.filterAttrs (_: v: lib.isDerivation v))
(lib.mapAttrs' (k: v: lib.nameValuePair (lib.concatStringsSep "_" (attrPath ++ [k])) v))
]
));
})
// {
lib = { inherit mkTf2Pkgs; };
};
} }

View File

@@ -1,7 +1,7 @@
{ stdenv, lib }: { stdenv, lib }:
{ pname { pname
, version ? "" , version ? null
, custom ? [] , custom ? []
, cfg ? [] , cfg ? []
, maps ? [] , maps ? []
@@ -35,6 +35,7 @@ let
then { src = builtins.head allSrcs; } then { src = builtins.head allSrcs; }
else { srcs = allSrcs; sourceRoot = "."; }; else { srcs = allSrcs; sourceRoot = "."; };
in stdenv.mkDerivation ({ in stdenv.mkDerivation ({
inherit name;
inherit pname version; inherit pname version;
# Adapted from stdenv's _defaultUnpack(). # Adapted from stdenv's _defaultUnpack().
unpackCmd = '' unpackCmd = ''

View File

@@ -1,6 +1,8 @@
{ pkgs, lib }: { pkgs }:
let let
inherit (pkgs) lib;
mkTf2Config = pkgs.callPackage ../mkTf2Config.nix {}; mkTf2Config = pkgs.callPackage ../mkTf2Config.nix {};
fetchFromGameBanana = fetchFromGameBanana =
@@ -14,15 +16,14 @@ let
inherit hash name; inherit hash name;
}; };
mkCfg = name: body: mkCfg = path: body:
pkgs.runCommand name {} '' pkgs.runCommand path {} ''
${lib.toShellVar "name" name} ${lib.toShellVar "pathPart" path}
mkdir -p $out/cfg "$(dirname "$out/cfg/$name")" path="$out/cfg/$pathPart.cfg"
tee "$out/cfg/$name.cfg" << SUPER_UNIQUE_EOF mkdir -p "$(dirname -- "$path")"
// Generated by tf2.nix echo "// Generated by tf2.nix" >> "$path"
echo >> "$path"
${body} echo ${lib.escapeShellArg body} >> "$path"
SUPER_UNIQUE_EOF
''; '';
mergeTf2Configs = configs: mergeTf2Configs = configs:

View File

@@ -5,7 +5,7 @@
pname = "deerhud"; pname = "deerhud";
custom = [ custom = [
(fetchFromGitHub { (fetchFromGitHub {
name = "deerhud"; name = "deerhud-src";
owner = "DeerUwU"; owner = "DeerUwU";
repo = "deerhud-tf2"; repo = "deerhud-tf2";
rev = "78a24effbc66bc78b4bb557228eaa0195db3270c"; rev = "78a24effbc66bc78b4bb557228eaa0195db3270c";

View File

@@ -6,7 +6,7 @@ builtins.mapAttrs
env.description = e.description; env.description = e.description;
custom = [ custom = [
(fetchFromGitHub (builtins.removeAttrs e.src ["__type"] // { (fetchFromGitHub (builtins.removeAttrs e.src ["__type"] // {
inherit name; name = "${name}-src";
})) }))
]; ];
}) })

View File

@@ -6,6 +6,7 @@ builtins.mapAttrs
env.description = e.description; env.description = e.description;
maps = [ maps = [
(fetchurl { (fetchurl {
name = "${name}-src";
inherit (e.src) url hash; inherit (e.src) url hash;
}) })
]; ];