flake reorg

This commit is contained in:
Robin Appelman 2025-02-20 02:35:39 +01:00
commit 4132469228
6 changed files with 65 additions and 229 deletions

View file

@ -4,7 +4,7 @@ on:
push: push:
jobs: jobs:
check: checks:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -13,48 +13,5 @@ jobs:
with: with:
name: ci name: ci
instance: https://cache.icewind.me instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}' authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#check - run: nix flake check --keep-going
clippy:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#clippy
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- id: set-matrix
run: echo "matrix=$(nix eval --json ".#matrix.x86_64-linux")" | tee $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: [ matrix, check ]
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: vbspview-${{ matrix.target }}
path: result/bin/vbspview${{ matrix.artifact_suffix }}

6
Cargo.lock generated
View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 4
[[package]] [[package]]
name = "ab_glyph" name = "ab_glyph"
@ -2787,7 +2787,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8277e703c934b9693d0773d5749faacc6366b3d81d012da556a4cfd4ab87f336" checksum = "8277e703c934b9693d0773d5749faacc6366b3d81d012da556a4cfd4ab87f336"
dependencies = [ dependencies = [
"libm", "libm",
"rayon",
] ]
[[package]] [[package]]
@ -3148,7 +3147,6 @@ dependencies = [
name = "vbspview" name = "vbspview"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bytemuck",
"cgmath", "cgmath",
"clap", "clap",
"image", "image",
@ -3156,8 +3154,6 @@ dependencies = [
"miette", "miette",
"rayon", "rayon",
"splines", "splines",
"steamid-ng",
"texpresso",
"tf-asset-loader", "tf-asset-loader",
"tf-demo-parser", "tf-demo-parser",
"thiserror", "thiserror",

View file

@ -18,7 +18,6 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tracing-tree = "0.4.0" tracing-tree = "0.4.0"
cgmath = "0.18.0" cgmath = "0.18.0"
tf-demo-parser = "0.5.1" tf-demo-parser = "0.5.1"
steamid-ng = "1.0.0"
clap = { version = "4.5.16", features = ["derive"] } clap = { version = "4.5.16", features = ["derive"] }
splines = { version = "4.3.1", features = ["cgmath"] } splines = { version = "4.3.1", features = ["cgmath"] }
vtf = "0.3.0" vtf = "0.3.0"
@ -26,8 +25,6 @@ vmt-parser = "0.2.0"
image = "0.25.2" image = "0.25.2"
tf-asset-loader = { version = "0.1.7", features = ["bsp"] } tf-asset-loader = { version = "0.1.7", features = ["bsp"] }
rayon = "1.10.0" rayon = "1.10.0"
bytemuck = "1.17.1"
texpresso = { version = "2.0.1", features = ["rayon"] }
[profile.dev.package."*"] [profile.dev.package."*"]
opt-level = 2 opt-level = 2

115
flake.lock generated
View file

@ -1,84 +1,98 @@
{ {
"nodes": { "nodes": {
"cross-naersk": { "crane": {
"inputs": {
"naersk": [
"naersk"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1717704286, "lastModified": 1733688869,
"narHash": "sha256-zrLB/FTKODEAlJjgO8TwbK7teTseYbjLESp8QJ/FJYc=", "narHash": "sha256-KrhxxFj1CjESDrL5+u/zsVH0K+Ik9tvoac/oFPoxSB8=",
"owner": "icewind1991", "owner": "ipetkov",
"repo": "cross-naersk", "repo": "crane",
"rev": "9068daceb8f0d248dcf629944f60e92b81391bdb", "rev": "604637106e420ad99907cae401e13ab6b452e7d9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "icewind1991", "owner": "ipetkov",
"repo": "cross-naersk", "repo": "crane",
"type": "github" "type": "github"
} }
}, },
"naersk": { "flakelight": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1721727458, "lastModified": 1739796086,
"narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=", "narHash": "sha256-jxpUiVJ6O+V1YsXsvWdMgqnv8zk9TFiqF86CRdGGGH4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "naersk", "repo": "flakelight",
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11", "rev": "540efca2f9015aff7dc574c7a03404e5fa72d42f",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"repo": "naersk", "repo": "flakelight",
"type": "github"
}
},
"mill-scale": {
"inputs": {
"crane": "crane",
"flakelight": [
"flakelight"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1735052218,
"narHash": "sha256-I30wh6G8fSUO4EseexxiDXcxyUhXR6C8BvEeKn6xyfE=",
"owner": "icewind1991",
"repo": "mill-scale",
"rev": "7e45bb598ff63a8416ee3c26743b20644563bd93",
"type": "github"
},
"original": {
"owner": "icewind1991",
"repo": "mill-scale",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1724316499, "lastModified": 1739923778,
"narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=", "narHash": "sha256-BqUY8tz0AQ4to2Z4+uaKczh81zsGZSYxjgvtw+fvIfM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841", "rev": "36864ed72f234b9540da4cf7a0c49e351d30d3f1",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-24.05", "ref": "nixos-24.11",
"type": "indirect" "type": "indirect"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"cross-naersk": "cross-naersk", "flakelight": "flakelight",
"naersk": "naersk", "mill-scale": "mill-scale",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"rust-overlay": "rust-overlay",
"utils": "utils"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"mill-scale",
"flakelight",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1724638882, "lastModified": 1733884434,
"narHash": "sha256-ap2jIQi/FuUHR6HCht6ASWhoz8EiB99XmI8Esot38VE=", "narHash": "sha256-8GXR9kC07dyOIshAyfZhG11xfvBRSZzYghnZ2weOKJU=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "19b70f147b9c67a759e35824b241f1ed92e46694", "rev": "d0483df44ddf0fd1985f564abccbe568e020ddf2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -86,39 +100,6 @@
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

119
flake.nix
View file

@ -1,111 +1,16 @@
{ {
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05"; nixpkgs.url = "nixpkgs/nixos-24.11";
utils.url = "github:numtide/flake-utils"; flakelight = {
naersk.url = "github:nix-community/naersk"; url = "github:nix-community/flakelight";
naersk.inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay"; };
rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; mill-scale = {
rust-overlay.inputs.flake-utils.follows = "utils"; url = "github:icewind1991/mill-scale";
cross-naersk.url = "github:icewind1991/cross-naersk"; inputs.flakelight.follows = "flakelight";
cross-naersk.inputs.nixpkgs.follows = "nixpkgs"; };
cross-naersk.inputs.naersk.follows = "naersk";
}; };
outputs = {mill-scale, ...}:
outputs = { mill-scale ./. {
self, };
nixpkgs,
utils,
naersk,
rust-overlay,
cross-naersk,
}:
utils.lib.eachDefaultSystem (system: let
overlays = [ (import rust-overlay) ];
pkgs = (import nixpkgs) {
inherit system overlays;
};
lib = pkgs.lib;
naerskForTarget = target: let
toolchain = pkgs.rust-bin.stable.latest.default.override { targets = [target]; };
in pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
hostTarget = pkgs.hostPlatform.config;
targets = ["x86_64-unknown-linux-musl" "x86_64-pc-windows-gnu" hostTarget];
hostNaersk = naerskForTarget hostTarget;
cross-naersk' = pkgs.callPackage cross-naersk {inherit naersk;};
src = lib.sources.sourceByRegex (lib.cleanSource ./.) ["Cargo.*" "(src)(/.*)?"];
nearskOpt = {
pname = "vbspview";
root = src;
nativeBuildInputs = (buildDependencies pkgs) ++ (runtimeDependencies pkgs);
};
crossOpts = {
crossArgs = {
"x86_64-unknown-linux-musl" = {
# targetNativeBuildInputs = buildDependencies;
# buildInputs = runtimeDependencies pkgs.pkgsCross.musl64;
};
};
};
runtimeDependencies = pkgsForPlatform: with pkgsForPlatform; [
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
glew-egl
egl-wayland
libGL
];
buildDependencies = pkgsForPlatform: with pkgsForPlatform; [
fontconfig
freetype
pkg-config
cmake
];
buildMatrix = targets: {
include = builtins.map (target: {
inherit target;
artifact_suffix = cross-naersk'.execSufficForTarget target;
}) targets;
};
in rec {
packages = (lib.attrsets.genAttrs targets (target:(cross-naersk'.buildPackage target) nearskOpt)) // rec {
vbspview = packages.${hostTarget};
check = hostNaersk.buildPackage (nearskOpt // {
mode = "check";
buildInputs = buildDependencies pkgs;
});
clippy = hostNaersk.buildPackage (nearskOpt // {
mode = "clippy";
buildInputs = buildDependencies pkgs;
});
default = vbspview;
};
matrix = buildMatrix targets;
inherit targets;
devShells.default = pkgs.mkShell {
nativeBuildInputs = (with pkgs; [
pkgs.rust-bin.stable.latest.default
bacon
cargo-edit
cargo-outdated
clippy
cargo-audit
cargo-msrv
cargo-flamegraph
hyperfine
]) ++ (buildDependencies pkgs) ++ (runtimeDependencies pkgs);
LD_LIBRARY_PATH = with pkgs; "/run/opengl-driver/lib/:${lib.makeLibraryPath ([libGL libGLU])}";
};
});
} }