Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 26 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,32 @@
}: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs lib.systems.flakeExposed;
pkgsFor = eachSystem (system:
import nixpkgs {
rustPlatformFor = pkgs: let
toolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
pkgsFor = eachSystem (system: let
pkgs = import nixpkgs {
localSystem.system = system;
overlays = [(import rust-overlay) self.overlays.helix];
});
overlays = [(import rust-overlay)];
};
in
pkgs.extend (final: _: {
helix = final.callPackage ./default.nix {
inherit gitRev;
rustPlatform = rustPlatformFor final;
};
}));
gitRev = self.rev or self.dirtyRev or null;
in {
packages = eachSystem (system: {
inherit (pkgsFor.${system}) helix;
/*
The default Helix build. Uses the latest stable Rust toolchain, and unstable
nixpkgs.
The default Helix build. Uses the Rust toolchain pinned in
rust-toolchain.toml, and unstable nixpkgs.

The build inputs can be overridden with the following:

Expand All @@ -41,16 +55,9 @@
default = self.packages.${system}.helix;
});
checks =
lib.mapAttrs (system: pkgs: let
# Get Helix's MSRV toolchain to build with by default.
msrvToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
msrvPlatform = pkgs.makeRustPlatform {
cargo = msrvToolchain;
rustc = msrvToolchain;
};
in {
lib.mapAttrs (system: pkgs: {
helix = self.packages.${system}.helix.override {
rustPlatform = msrvPlatform;
rustPlatform = rustPlatformFor pkgs;
};
})
pkgsFor;
Expand Down Expand Up @@ -82,7 +89,10 @@

overlays = {
helix = final: prev: {
helix = final.callPackage ./default.nix {inherit gitRev;};
helix = final.callPackage ./default.nix {
inherit gitRev;
rustPlatform = rustPlatformFor final;
};
};

default = self.overlays.helix;
Expand Down