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": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs",
|
"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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
21
flake.nix
21
flake.nix
|
@ -3,18 +3,12 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
rust-overlay = {
|
|
||||||
url = "github:oxalica/rust-overlay";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
rust-overlay,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
@ -70,19 +64,8 @@
|
||||||
pkgs = nixpkgsFor.${system};
|
pkgs = nixpkgsFor.${system};
|
||||||
packages' = self.packages.${system};
|
packages' = self.packages.${system};
|
||||||
|
|
||||||
mkStatic = pkgs.callPackage ./nix/static.nix {
|
mkStatic = pkgs.callPackage ./nix/static.nix { };
|
||||||
inherit (packages') refraction;
|
containerize = pkgs.callPackage ./nix/containerize.nix { };
|
||||||
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;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
refraction = pkgs.callPackage ./nix/package.nix { };
|
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 @@
|
||||||
{
|
{ pkgsCross }:
|
||||||
lib,
|
|
||||||
refraction,
|
|
||||||
rust-overlay,
|
|
||||||
pkgsCross,
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
crossPlatformFor = with pkgsCross; {
|
crossPlatformFor = with pkgsCross; {
|
||||||
x86_64 = musl64.pkgsStatic;
|
x86_64 = musl64.pkgsStatic;
|
||||||
aarch64 = aarch64-multiplatform.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
|
in
|
||||||
{ arch }:
|
{ arch }:
|
||||||
(refraction.override {
|
crossPlatformFor.${arch}.callPackage ./package.nix { optimizeSize = true; }
|
||||||
rustPlatform = rustPlatformFor.${arch};
|
|
||||||
optimizeSize = true;
|
|
||||||
}).overrideAttrs
|
|
||||||
(old: {
|
|
||||||
passthru = old.passthru or { } // {
|
|
||||||
inherit toolchain;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue