Skip to content

Commit 60a03a3

Browse files
bloxx12the-mikedavis
authored andcommitted
flake: drop flake-utils dependency
1 parent e4ef096 commit 60a03a3

File tree

2 files changed

+72
-94
lines changed

2 files changed

+72
-94
lines changed

flake.lock

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 72 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6-
flake-utils.url = "github:numtide/flake-utils";
76
rust-overlay = {
87
url = "github:oxalica/rust-overlay";
98
inputs.nixpkgs.follows = "nixpkgs";
@@ -13,77 +12,90 @@
1312
outputs = {
1413
self,
1514
nixpkgs,
16-
flake-utils,
1715
rust-overlay,
1816
...
1917
}: let
18+
inherit (nixpkgs) lib;
19+
systems = [
20+
"x86_64-linux"
21+
"aarch64-linux"
22+
"x86_64-darwin"
23+
"aarch64-darwin"
24+
];
25+
eachSystem = lib.genAttrs systems;
26+
pkgsFor = eachSystem (system:
27+
import nixpkgs {
28+
localSystem.system = system;
29+
overlays = [(import rust-overlay) self.overlays.helix];
30+
});
2031
gitRev = self.rev or self.dirtyRev or null;
21-
in
22-
flake-utils.lib.eachDefaultSystem (system: let
23-
pkgs = import nixpkgs {
24-
inherit system;
25-
overlays = [(import rust-overlay)];
26-
};
32+
in {
33+
packages = eachSystem (system: {
34+
inherit (pkgsFor.${system}) helix;
35+
/*
36+
The default Helix build. Uses the latest stable Rust toolchain, and unstable
37+
nixpkgs.
2738
28-
# Get Helix's MSRV toolchain to build with by default.
29-
msrvToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
30-
msrvPlatform = pkgs.makeRustPlatform {
31-
cargo = msrvToolchain;
32-
rustc = msrvToolchain;
33-
};
34-
in {
35-
packages = rec {
36-
helix = pkgs.callPackage ./default.nix {inherit gitRev;};
39+
The build inputs can be overriden with the following:
3740
38-
/**
39-
The default Helix build. Uses the latest stable Rust toolchain, and unstable
40-
nixpkgs.
41-
42-
The build inputs can be overriden with the following:
43-
44-
packages.${system}.default.override { rustPlatform = newPlatform; };
45-
46-
Overriding a derivation attribute can be done as well:
47-
48-
packages.${system}.default.overrideAttrs { buildType = "debug"; };
49-
*/
50-
default = helix;
51-
};
41+
packages.${system}.default.override { rustPlatform = newPlatform; };
5242
53-
checks.helix = self.outputs.packages.${system}.helix.override {
54-
buildType = "debug";
55-
rustPlatform = msrvPlatform;
56-
};
43+
Overriding a derivation attribute can be done as well:
5744
58-
# Devshell behavior is preserved.
59-
devShells.default = let
60-
commonRustFlagsEnv = "-C link-arg=-fuse-ld=lld -C target-cpu=native --cfg tokio_unstable";
61-
platformRustFlagsEnv = pkgs.lib.optionalString pkgs.stdenv.isLinux "-Clink-arg=-Wl,--no-rosegment";
62-
in
63-
pkgs.mkShell
64-
{
65-
inputsFrom = [self.checks.${system}.helix];
66-
nativeBuildInputs = with pkgs;
67-
[
68-
lld
69-
cargo-flamegraph
70-
rust-bin.nightly.latest.rust-analyzer
71-
]
72-
++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
73-
++ (lib.optional stdenv.isLinux lldb)
74-
++ (lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreFoundation);
75-
shellHook = ''
76-
export RUST_BACKTRACE="1"
77-
export RUSTFLAGS="''${RUSTFLAGS:-""} ${commonRustFlagsEnv} ${platformRustFlagsEnv}"
78-
'';
45+
packages.${system}.default.overrideAttrs { buildType = "debug"; };
46+
*/
47+
default = self.packages.${system}.helix;
48+
});
49+
checks =
50+
lib.mapAttrs (system: pkgs: let
51+
# Get Helix's MSRV toolchain to build with by default.
52+
msrvToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
53+
msrvPlatform = pkgs.makeRustPlatform {
54+
cargo = msrvToolchain;
55+
rustc = msrvToolchain;
56+
};
57+
in {
58+
helix = self.packages.${system}.helix.override {
59+
buildType = "debug";
60+
rustPlatform = msrvPlatform;
7961
};
80-
})
81-
// {
82-
overlays.default = final: prev: {
62+
})
63+
pkgsFor;
64+
65+
# Devshell behavior is preserved.
66+
devShells =
67+
lib.mapAttrs (system: pkgs: {
68+
default = let
69+
commonRustFlagsEnv = "-C link-arg=-fuse-ld=lld -C target-cpu=native --cfg tokio_unstable";
70+
platformRustFlagsEnv = lib.optionalString pkgs.stdenv.isLinux "-Clink-arg=-Wl,--no-rosegment";
71+
in
72+
pkgs.mkShell {
73+
inputsFrom = [self.checks.${system}.helix];
74+
nativeBuildInputs = with pkgs;
75+
[
76+
lld
77+
cargo-flamegraph
78+
rust-bin.nightly.latest.rust-analyzer
79+
]
80+
++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
81+
++ (lib.optional stdenv.isLinux lldb)
82+
++ (lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreFoundation);
83+
shellHook = ''
84+
export RUST_BACKTRACE="1"
85+
export RUSTFLAGS="''${RUSTFLAGS:-""} ${commonRustFlagsEnv} ${platformRustFlagsEnv}"
86+
'';
87+
};
88+
})
89+
pkgsFor;
90+
91+
overlays = {
92+
helix = final: prev: {
8393
helix = final.callPackage ./default.nix {inherit gitRev;};
8494
};
85-
};
8695

96+
default = self.overlays.helix;
97+
};
98+
};
8799
nixConfig = {
88100
extra-substituters = ["https://helix.cachix.org"];
89101
extra-trusted-public-keys = ["helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="];

0 commit comments

Comments
 (0)