mirror of https://gitlab.com/famedly/conduit
Revert "build(nix): fix flake builds"
This reverts commit 5d913f7010
.
Sorry, I don't understand how any of this works, and it seems pretty
opaque/difficult to fine-tune.
merge-requests/467/head
parent
f704169aeb
commit
c997311bea
@ -1,56 +1,74 @@
|
|||||||
{
|
{
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
inputs = {
|
||||||
inputs.d2n.url = "github:nix-community/dream2nix";
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||||
inputs.d2n.inputs.nixpkgs.follows = "nixpkgs";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
inputs.parts.url = "github:hercules-ci/flake-parts";
|
|
||||||
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
|
|
||||||
inputs.rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
|
|
||||||
outputs = inp:
|
|
||||||
inp.parts.lib.mkFlake {inputs = inp;} {
|
|
||||||
systems = ["x86_64-linux"];
|
|
||||||
imports = [inp.d2n.flakeModuleBeta];
|
|
||||||
perSystem = {
|
|
||||||
config,
|
|
||||||
system,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
|
||||||
pkgsWithToolchain = pkgs.appendOverlays [inp.rust-overlay.overlays.default];
|
|
||||||
|
|
||||||
toolchains = pkgsWithToolchain.rust-bin.stable."${cargoToml.package.rust-version}";
|
|
||||||
# toolchain to use when building conduit, includes only cargo and rustc to reduce closure size
|
|
||||||
buildToolchain = toolchains.minimal;
|
|
||||||
# toolchain to use in development shell
|
|
||||||
# the "default" component set of toolchain adds rustfmt, clippy etc.
|
|
||||||
devToolchain = toolchains.default.override {
|
|
||||||
extensions = ["rust-src"];
|
|
||||||
};
|
|
||||||
|
|
||||||
# flake outputs for conduit project
|
fenix = {
|
||||||
conduitOutputs = config.dream2nix.outputs.conduit;
|
url = "github:nix-community/fenix";
|
||||||
in {
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
dream2nix.inputs.conduit = {
|
|
||||||
source = inp.self;
|
|
||||||
projects.conduit = {
|
|
||||||
name = "conduit";
|
|
||||||
subsystem = "rust";
|
|
||||||
translator = "cargo-lock";
|
|
||||||
};
|
};
|
||||||
packageOverrides = {
|
naersk = {
|
||||||
"^.*".set-toolchain.overrideRustToolchain = _: {
|
url = "github:nix-community/naersk";
|
||||||
cargo = buildToolchain;
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
rustc = buildToolchain;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ self
|
||||||
|
, nixpkgs
|
||||||
|
, flake-utils
|
||||||
|
|
||||||
|
, fenix
|
||||||
|
, naersk
|
||||||
|
}: flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
|
# Nix-accessible `Cargo.toml`
|
||||||
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
|
|
||||||
|
# The Rust toolchain to use
|
||||||
|
toolchain = fenix.packages.${system}.toolchainOf {
|
||||||
|
# Use the Rust version defined in `Cargo.toml`
|
||||||
|
channel = cargoToml.package.rust-version;
|
||||||
|
|
||||||
|
# THE rust-version HASH
|
||||||
|
sha256 = "sha256-8len3i8oTwJSOJZMosGGXHBL5BVuGQnWOT2St5YAUFU=";
|
||||||
|
};
|
||||||
|
|
||||||
|
builder = (pkgs.callPackage naersk {
|
||||||
|
inherit (toolchain) rustc cargo;
|
||||||
|
}).buildPackage;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages.default = builder {
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
nativeBuildInputs = (with pkgs.rustPlatform; [
|
||||||
|
bindgenHook
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
devShells.conduit = conduitOutputs.devShells.conduit.overrideAttrs (old: {
|
|
||||||
# export default crate sources for rust-analyzer to read
|
devShells.default = pkgs.mkShell {
|
||||||
RUST_SRC_PATH = "${devToolchain}/lib/rustlib/src/rust/library";
|
# Rust Analyzer needs to be able to find the path to default crate
|
||||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [devToolchain];
|
# sources, and it can read this environment variable to do so
|
||||||
});
|
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
|
||||||
devShells.default = config.devShells.conduit;
|
|
||||||
|
# Development tools
|
||||||
|
nativeBuildInputs = (with pkgs.rustPlatform; [
|
||||||
|
bindgenHook
|
||||||
|
]) ++ (with toolchain; [
|
||||||
|
cargo
|
||||||
|
clippy
|
||||||
|
rust-src
|
||||||
|
rustc
|
||||||
|
rustfmt
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
checks = {
|
||||||
|
packagesDefault = self.packages.${system}.default;
|
||||||
|
devShellsDefault = self.devShells.${system}.default;
|
||||||
};
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue