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:
parent
3ca7323414
commit
0b6be71c48
4 changed files with 14 additions and 71 deletions
23
flake.lock
generated
23
flake.lock
generated
|
@ -18,28 +18,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1727404165,
|
||||
"narHash": "sha256-kZCiYpQJBZ3kL9QymS88mCxpQwqo8KqvZeHk6LATuY8=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "76f0a61e733259e1034dd6523e039d04932ffefc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
21
flake.nix
21
flake.nix
|
@ -3,18 +3,12 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
}:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
@ -70,19 +64,8 @@
|
|||
pkgs = nixpkgsFor.${system};
|
||||
packages' = self.packages.${system};
|
||||
|
||||
mkStatic = pkgs.callPackage ./nix/static.nix {
|
||||
inherit (packages') refraction;
|
||||
rust-overlay = rust-overlay.packages.${system};
|
||||
};
|
||||
|
||||
containerize =
|
||||
refraction:
|
||||
pkgs.dockerTools.buildLayeredImage {
|
||||
name = "refraction";
|
||||
tag = "latest-${refraction.passthru.architecture}";
|
||||
config.Cmd = [ (lib.getExe refraction) ];
|
||||
inherit (refraction.passthru) architecture;
|
||||
};
|
||||
mkStatic = pkgs.callPackage ./nix/static.nix { };
|
||||
containerize = pkgs.callPackage ./nix/containerize.nix { };
|
||||
in
|
||||
{
|
||||
refraction = pkgs.callPackage ./nix/package.nix { };
|
||||
|
|
9
nix/containerize.nix
Normal file
9
nix/containerize.nix
Normal 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;
|
||||
}
|
|
@ -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; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue