Switch to flake-based build on nix-builder for nightly rust.

This commit is contained in:
Tom Alexander
2026-07-05 16:15:33 -04:00
parent ef21e0125e
commit c0b3cd0fd3
4 changed files with 53 additions and 50 deletions

View File

@@ -260,6 +260,7 @@ in
);
})
(disableTests "onetbb") # oneTBB tests hang forever on machines with a single core (like my build virtual machine) https://github.com/uxlfoundation/oneTBB/issues/1557
(disableTests "aws-c-common") # aws-c-common tests time out on my build virtual machine but run fine on my laptop.
# Works but probably sets python2's scipy to be python3:
#

View File

@@ -162,6 +162,27 @@
"type": "github"
}
},
"nix_builder": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1783278211,
"narHash": "sha256-/1u+MIQIge+cNPukQoK4Jp8nLuFZRbx4U+MyyxG0RpM=",
"ref": "refs/heads/main",
"rev": "9281ba7e10d362d4edb489d0df0e78936dfe7b58",
"revCount": 32,
"type": "git",
"url": "https://code.fizz.buzz/talexander/nix_builder.git"
},
"original": {
"type": "git",
"url": "https://code.fizz.buzz/talexander/nix_builder.git"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1780749050,
@@ -242,6 +263,7 @@
"disko": "disko",
"impermanence": "impermanence",
"lanzaboote": "lanzaboote",
"nix_builder": "nix_builder",
"nixpkgs": "nixpkgs",
"nixpkgs-google": "nixpkgs-google"
}
@@ -266,6 +288,27 @@
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"nix_builder",
"nixpkgs"
]
},
"locked": {
"lastModified": 1779506148,
"narHash": "sha256-OffE5yuMrSW71zIJNLvtl9MCO6WTAHEjlFPUCvkd/QM=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d9973e2ab49747fada06ebbe26cda27eb0220cf1",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",

View File

@@ -29,6 +29,10 @@
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nix_builder = {
url = "git+https://code.fizz.buzz/talexander/nix_builder.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
@@ -39,6 +43,7 @@
disko,
impermanence,
lanzaboote,
nix_builder,
...
}:
let
@@ -70,7 +75,7 @@
hostname: nodeConfig: format:
nixpkgs.lib.nixosSystem {
specialArgs = {
inherit self;
inherit self nix_builder;
this_nixos_config = self.nixosConfigurations."${hostname}";

View File

@@ -2,56 +2,10 @@
config,
lib,
pkgs,
nix_builder,
...
}:
let
# patchScriptBin =
# {
# filename,
# contents,
# path ? [ ],
# }:
# ((pkgs.writeScriptBin filename contents).overrideAttrs (old: {
# buildInputs = [ pkgs.makeWrapper ];
# buildCommand = "${old.buildCommand}\n patchShebangs $out\nwrapProgram $out/bin/${filename} --prefix PATH : ${lib.makeBinPath path}";
# }));
nix_builder = pkgs.rustPlatform.buildRustPackage rec {
pname = "nix_builder";
version = "0.0.0";
src = pkgs.fetchgit {
url = "https://code.fizz.buzz/talexander/nix_builder.git";
# tag = version;
rev = "606832f505a1ccc9702cd12c236c3188f9282e82";
hash = "sha256-WHvnkCIPDBw0BnrQMnBpmwmYuhlxR4FfkoNWw2DY6XE=";
leaveDotGit = false;
};
cargoLock = {
lockFile = "${src}/Cargo.lock";
};
meta = with lib; {
description = "A builder of nix configs for a build server.";
homepage = "https://code.fizz.buzz/talexander/nix_builder";
license = licenses.bsd0;
maintainers = [ ];
};
nativeBuildInputs = [ pkgs.makeWrapper ];
postInstall = ''
wrapProgram $out/bin/nix-builder --prefix PATH : ${
lib.makeBinPath [
pkgs.git
pkgs.nix
pkgs.nixos-rebuild
]
}
'';
};
in
{
imports = [ ];
@@ -66,7 +20,7 @@ in
config = lib.mkIf config.me.hydra.enable {
environment.systemPackages = with pkgs; [
nix_builder
nix_builder.packages.x86_64-linux.default
sqlite # For manually inspecting the database.
];
@@ -142,7 +96,7 @@ in
IFS=$'\n\t'
DIR="$( cd "$( dirname "''${BASH_SOURCE[0]}" )" && pwd )"
NIX_REMOTE='local?root=/.disk/root' RUST_BACKTRACE=1 RUST_LOG=nix_builder=DEBUG ${nix_builder}/bin/nix-builder build --config ${./files/nix_builder.toml} ${builtins.concatStringsSep " " build_flags}
NIX_REMOTE='local?root=/.disk/root' RUST_BACKTRACE=1 RUST_LOG=nix_builder=DEBUG ${nix_builder.packages.x86_64-linux.default}/bin/nix-builder build --config ${./files/nix_builder.toml} ${builtins.concatStringsSep " " build_flags}
'';
restartIfChanged = false;
serviceConfig = {