build(nix): drop rust-overlay

nixpkgs works well enough and gives us a good buffer in dealing with
compiler regressions
This commit is contained in:
seth 2024-08-07 04:09:28 -04:00 committed by Sefa Eyeoglu
parent 3ca7323414
commit 0b6be71c48
4 changed files with 14 additions and 71 deletions

9
nix/containerize.nix Normal file
View file

@ -0,0 +1,9 @@
{ lib, dockerTools }:
refraction:
dockerTools.buildLayeredImage {
name = "refraction";
tag = "latest-${refraction.passthru.dockerArchitecture}";
config.Cmd = [ (lib.getExe refraction) ];
architecture = refraction.passthru.dockerArchitecture;
}

View file

@ -1,37 +1,9 @@
{
lib,
refraction,
rust-overlay,
pkgsCross,
}:
{ pkgsCross }:
let
crossPlatformFor = with pkgsCross; {
x86_64 = musl64.pkgsStatic;
aarch64 = aarch64-multiplatform.pkgsStatic;
};
toolchain = rust-overlay.rust.minimal.override {
extensions = [ "rust-std" ];
targets = lib.mapAttrsToList (_: pkgs: pkgs.stdenv.hostPlatform.rust.rustcTarget) crossPlatformFor;
};
rustPlatformFor = lib.mapAttrs (
_: pkgs:
pkgs.makeRustPlatform (
lib.genAttrs [
"cargo"
"rustc"
] (_: toolchain)
)
) crossPlatformFor;
in
{ arch }:
(refraction.override {
rustPlatform = rustPlatformFor.${arch};
optimizeSize = true;
}).overrideAttrs
(old: {
passthru = old.passthru or { } // {
inherit toolchain;
};
})
crossPlatformFor.${arch}.callPackage ./package.nix { optimizeSize = true; }