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 =
let
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
tf2pkgs = inputs.tf2-nix.packages.x86_64-linux;
in tf2pkgs.mergeTf2Configs (with tf2pkgs; [
tf2Pkgs = inputs.tf2-nix.lib.mkTf2Pkgs { inherit pkgs; };
in tf2Pkgs.mergeTf2Configs (with tf2Pkgs; [
mastercomfig.presets.medium-low
mastercomfig.addons.flat-mouse
mastercomfig.addons.no-tutorial

View File

@@ -7,13 +7,32 @@
};
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:
let
pkgs = import inputs.nixpkgs { inherit system; };
lib = pkgs.lib;
inherit (pkgs) lib;
tf2Pkgs = mkTf2Pkgs { inherit pkgs; };
in {
packages = import ./tf2/packages {
inherit pkgs lib;
};
});
legacyPackages = tf2Pkgs;
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 }:
{ pname
, version ? ""
, version ? null
, custom ? []
, cfg ? []
, maps ? []
@@ -35,6 +35,7 @@ let
then { src = builtins.head allSrcs; }
else { srcs = allSrcs; sourceRoot = "."; };
in stdenv.mkDerivation ({
inherit name;
inherit pname version;
# Adapted from stdenv's _defaultUnpack().
unpackCmd = ''

View File

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

View File

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

View File

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

View File

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