Compare commits
13 Commits
307a217a1b
...
ci
| Author | SHA1 | Date | |
|---|---|---|---|
| e3f99b745d | |||
| 51cdc66c48 | |||
| 3afc3e370b | |||
| 8423bbf30f | |||
| 98673e8d34 | |||
| c32ffd6101 | |||
| 55c3b4e4dd | |||
| 8396927ec6 | |||
|
|
71eae2f11e | ||
|
|
10f28cf11c | ||
|
|
61c63737af | ||
|
|
1b2a146025 | ||
|
|
539bb2ac7c |
65
.gitea/workflows/build.yml
Normal file
65
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
name: "Build and populate cache"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
schedule:
|
||||
# rebuild everyday at 2:51
|
||||
# TIP: Choose a random time here so not all repositories are build at once:
|
||||
# https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new
|
||||
- cron: '55 3 * * *'
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
# Set this to cache your build results in cachix for faster builds
|
||||
# in CI and for everyone who uses your cache.
|
||||
#
|
||||
# Format: Your cachix cache host name without the ".cachix.org" suffix.
|
||||
# Example: mycache (for mycache.cachix.org)
|
||||
#
|
||||
# For this to work, you also need to set the CACHIX_SIGNING_KEY or
|
||||
# CACHIX_AUTH_TOKEN secret in your repository secrets settings in
|
||||
# Github found at
|
||||
# https://github.com/<your_githubname>/nur-packages/settings/secrets
|
||||
# cachixName:
|
||||
# - sydpkgs
|
||||
nixPath:
|
||||
- nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixpkgs-unstable.tar.gz
|
||||
# - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-unstable.tar.gz
|
||||
# - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-24.05.tar.gz
|
||||
runs-on: nixos
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install nix
|
||||
uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: "${{ matrix.nixPath }}"
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Show nixpkgs version
|
||||
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
|
||||
# - name: Setup cachix
|
||||
# uses: cachix/cachix-action@v15
|
||||
# # Don't replace <YOUR_CACHIX_NAME> here!
|
||||
# if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }}
|
||||
# with:
|
||||
# name: ${{ matrix.cachixName }}
|
||||
# signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
- name: Check evaluation
|
||||
run: |
|
||||
nix-env -f . -qa \* --meta --xml \
|
||||
--allowed-uris https://static.rust-lang.org \
|
||||
--option restrict-eval true \
|
||||
--option allow-import-from-derivation true \
|
||||
--drv-path --show-trace \
|
||||
-I nixpkgs=$(nix-instantiate --find-file nixpkgs) \
|
||||
-I $PWD
|
||||
- name: Build nix packages
|
||||
run: nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs
|
||||
28
README.org
28
README.org
@@ -7,19 +7,19 @@ For the practical purposes including easy deployment and version-tracking, as we
|
||||
|
||||
* Disclaimers
|
||||
|
||||
** This is an alpha status project
|
||||
** This is a young project
|
||||
|
||||
At the moment, this project should mostly be considered a proof of concept. It is usable, I am using it, but it is pretty bare-bones. I hope to gradually expand this project anon. More packages, modules, all the Nix goodness we're accustomed to.
|
||||
|
||||
Further, I'm not the most experienced Nix user. Expect bad code and unidiomatic interfaces. I encourage you to point out said bad code if you spot it. }:)
|
||||
|
||||
** TF2 is a radioactive zigzagging target
|
||||
** TF2 is an unpredictable target
|
||||
|
||||
In my experience, TF2 and Valve software in general [[https://github.com/DeerUwU/deerhud-tf2/pull/15][react]] [[https://github.com/flathub/com.valvesoftware.Steam/issues/1218][very]] [[https://github.com/nix-community/impermanence/issues/165#issuecomment-2529954063][dramatically]][fn:2][fn:3] when prodded with even slightly unorthodox setups. Brace yourself before updating TF2, and never be afraid to open an issue here.
|
||||
|
||||
* FAQ (Frequently-anticipated questions)
|
||||
* FAQ (a Few Anticipated Questions)
|
||||
|
||||
** How make [[https://github.com/nix-community/impermanence][Impermanence]] work?
|
||||
** How to make [[https://github.com/nix-community/impermanence][Impermanence]] work?
|
||||
|
||||
See [[https://github.com/nix-community/impermanence/issues/165#issuecomment-2537723929][nix-community/impermanence#165]]:
|
||||
|
||||
@@ -37,14 +37,11 @@ tf2-nix is dead simple. No modules of any variety are provided (at this point in
|
||||
|
||||
** TL;DR
|
||||
|
||||
*** As a flake
|
||||
|
||||
Bring in the input, and build your TF2 config as a package:
|
||||
|
||||
#+begin_src nix
|
||||
{
|
||||
inputs = {
|
||||
tf2-nix.url = "path:///home/crumb/src/tf2-nix";
|
||||
tf2-nix.url = "gitlab:msyds/tf2-nix";
|
||||
};
|
||||
|
||||
outputs = { self, ... }@inputs:
|
||||
@@ -78,9 +75,7 @@ Bring in the input, and build your TF2 config as a package:
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
You can then install your configuration into TF2's =tf= directory:
|
||||
|
||||
#+begin_src nix
|
||||
### home.nix
|
||||
let
|
||||
@@ -93,17 +88,14 @@ You can then install your configuration into TF2's =tf= directory:
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
Rebuild your system, and rejoice!
|
||||
|
||||
** Example Flake
|
||||
|
||||
Try out the example flake:
|
||||
|
||||
#+begin_example
|
||||
$ nix build 'gitlab:msyds/tf2-nix?dir=example'
|
||||
#+end_example
|
||||
|
||||
The resulting config can then be explored in =./result/=.
|
||||
|
||||
** Library
|
||||
@@ -112,12 +104,20 @@ TODO!
|
||||
|
||||
** Packages
|
||||
|
||||
Documentation is a WIP }:P. For now, you can explore the flake outputs using ~nix repl~.
|
||||
The package set is best explored via ~nix repl~ and ~nix flake show~. Some notable subsets are listed here:
|
||||
|
||||
*** HUDs
|
||||
|
||||
A package set of HUDs is generated primarily using data from [[https://github.com/mastercomfig/hud-db][hud-db]], complemented with a handful of manual additions and overrides.
|
||||
|
||||
*** Maps
|
||||
|
||||
The map list currently consists of primarily rocket jumping courses, per [[https://jumpacademy.tf/fastdl][JumpAcademy.tf]].
|
||||
|
||||
*** Mastercomfig
|
||||
|
||||
[[https://comfig.app/][Mastercomfig]] presets and addons are packaged from their [[https://github.com/mastercomfig/mastercomfig/releases][GitHub releases]].
|
||||
|
||||
* Contributing
|
||||
|
||||
Don't hesitate to open issues/PRs not only for "real issues" (bugs, missing features) but for poor UX, bad code, or anything else.
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
tf2-nix.url = "path:///home/crumb/src/tf2-nix";
|
||||
tf2-nix = {
|
||||
url = "gitlab:msyds/tf2-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, ... }@inputs: {
|
||||
|
||||
17
flake.nix
17
flake.nix
@@ -14,8 +14,23 @@
|
||||
inputs.flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import inputs.nixpkgs { inherit system; };
|
||||
inherit (pkgs) lib;
|
||||
tf2Pkgs = mkTf2Pkgs { inherit pkgs; };
|
||||
in {
|
||||
legacyPackages = mkTf2Pkgs pkgs;
|
||||
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; };
|
||||
|
||||
@@ -1,29 +1,33 @@
|
||||
{ stdenv, lib }:
|
||||
|
||||
{ pname
|
||||
, version ? ""
|
||||
, version ? null
|
||||
, custom ? []
|
||||
, cfg ? []
|
||||
, maps ? []
|
||||
# Extra arguments to pass to stdenv.mkDerivation.
|
||||
# Extra arguments to pass to stdenv.mkDerivation. Exists for
|
||||
# backward-compatibility.
|
||||
, env ? {}
|
||||
, ...
|
||||
}@args:
|
||||
|
||||
let
|
||||
version-suffix = lib.optionalString (version != null) "-${version}";
|
||||
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:
|
||||
lib.optionalString (var != []) ''
|
||||
mkdir -p "$out/${output}"
|
||||
${lib.toShellVar "outputList_${output}" var}
|
||||
for i in "''${outputList_${output}[@]}"; do
|
||||
name="$(stripHash "$i")"
|
||||
wrapperDir="#''${name}#"
|
||||
piece="$(stripHash "$i")"
|
||||
wrapperDir="#''${piece}#"
|
||||
if [ -d "$wrapperDir" ]; then
|
||||
mv "$wrapperDir"/* "$out/${output}/"
|
||||
else
|
||||
mv "$name" "$out/${output}/$name"
|
||||
mv "$piece" "$out/${output}/$piece"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
@@ -34,11 +38,19 @@ let
|
||||
if builtins.length allSrcs == 1
|
||||
then { src = builtins.head allSrcs; }
|
||||
else { srcs = allSrcs; sourceRoot = "."; };
|
||||
|
||||
# Arguments unused by mkTf2Config fall through to mkDerivation.
|
||||
fallthroughArgs = lib.removeAttrs args [
|
||||
"custom"
|
||||
"cfg"
|
||||
"maps"
|
||||
"env"
|
||||
];
|
||||
in stdenv.mkDerivation ({
|
||||
inherit name;
|
||||
inherit pname version;
|
||||
# Adapted from stdenv's _defaultUnpack().
|
||||
unpackCmd = ''
|
||||
echo "hello i am unpackcmdjkj"
|
||||
set -e
|
||||
case "$curSrc" in
|
||||
*.vpk)
|
||||
@@ -81,4 +93,4 @@ in stdenv.mkDerivation ({
|
||||
${make-output "custom" custom}
|
||||
${make-output "maps" maps}
|
||||
'';
|
||||
} // srcArg // env)
|
||||
} // srcArg // fallthroughArgs // env)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
pname = "deerhud";
|
||||
custom = [
|
||||
(fetchFromGitHub {
|
||||
name = "deerhud";
|
||||
name = "deerhud-src";
|
||||
owner = "DeerUwU";
|
||||
repo = "deerhud-tf2";
|
||||
rev = "78a24effbc66bc78b4bb557228eaa0195db3270c";
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
{ mkTf2Config, fetchFromGitHub }:
|
||||
{ mkTf2Config, fetchFromGitHub, lib }:
|
||||
|
||||
builtins.mapAttrs
|
||||
(name: e: mkTf2Config {
|
||||
pname = name;
|
||||
env.description = e.description;
|
||||
custom = [
|
||||
(fetchFromGitHub (builtins.removeAttrs e.src ["__type"] // {
|
||||
inherit name;
|
||||
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))
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
[clojure.tools.logging :as l]
|
||||
[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")
|
||||
(fs/expand-home "~/git/hud-db")))
|
||||
|
||||
|
||||
2293
tf2/packages/huds/hud-db/hud-db.json
generated
2293
tf2/packages/huds/hud-db/hud-db.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user