fix: rust overlay in nix package

This commit is contained in:
Henri Bourcereau 2026-05-09 09:32:10 +02:00
parent 546eb1fe33
commit ccd63810d5
3 changed files with 13 additions and 46 deletions

43
container/flake.lock generated
View file

@ -17,22 +17,6 @@
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1778003029, "lastModified": 1778003029,
"narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=", "narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=",
@ -48,7 +32,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1744536153, "lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
@ -67,31 +51,12 @@
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"trictrac": "trictrac" "trictrac": "trictrac"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1778123869,
"narHash": "sha256-hV9D8ET33kXjdoMXBT2bwM/j8WQM1SP/dVKZtjQKhAQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "592e5dedf04f0eaff1ed0f01ce5db7407d9fc7be",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1778123869, "lastModified": 1778123869,
@ -109,8 +74,8 @@
}, },
"trictrac": { "trictrac": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay_2" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"path": "..", "path": "..",

View file

@ -2,9 +2,8 @@
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
# inputs.trictrac.url = "github:mmai/trictrac"; # inputs.trictrac.url = "github:mmai/trictrac";
inputs.trictrac.url = ".."; inputs.trictrac.url = "..";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs = { self, nixpkgs, trictrac, rust-overlay }: outputs = { self, nixpkgs, trictrac }:
{ {
nixosConfigurations = { nixosConfigurations = {
@ -30,8 +29,8 @@
networking.firewall.allowedTCPPorts = [ 80 ]; networking.firewall.allowedTCPPorts = [ 80 ];
networking.hostName = hostname; networking.hostName = hostname;
# rust-overlay must be applied first so trictrac.overlay can use rust-bin # trictrac.overlay already includes rust-overlay
nixpkgs.overlays = [ rust-overlay.overlays.default trictrac.overlay ]; nixpkgs.overlays = [ trictrac.overlay ];
services.trictrac = { services.trictrac = {
enable = true; enable = true;

View file

@ -8,13 +8,16 @@
outputs = { self, nixpkgs, rust-overlay }: outputs = { self, nixpkgs, rust-overlay }:
let let
rustPkgs = import nixpkgs {
inherit (final) system;
overlays = [ rust-overlay.overlays.default ];
};
systems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ]; systems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
# rust-overlay must be applied before self.overlay so that rust-bin is available
nixpkgsFor = forAllSystems (system: nixpkgsFor = forAllSystems (system:
import nixpkgs { import nixpkgs {
inherit system; inherit system;
overlays = [ rust-overlay.overlays.default self.overlay ]; overlays = [ self.overlay ];
} }
); );
in in
@ -24,7 +27,7 @@
trictrac-front = trictrac-front =
let let
# WASM build needs wasm32-unknown-unknown target in the Rust toolchain # WASM build needs wasm32-unknown-unknown target in the Rust toolchain
rustToolchain = final.rust-bin.stable.latest.default.override { rustToolchain = rustPkgs.rust-bin.stable.latest.default.override {
targets = [ "wasm32-unknown-unknown" ]; targets = [ "wasm32-unknown-unknown" ];
}; };
rustPlatform = final.makeRustPlatform { rustPlatform = final.makeRustPlatform {