Skip to content

Commit

Permalink
add overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
nrdxp authored and archseer committed Jun 10, 2021
1 parent 1a774d6 commit 6937838
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,41 @@
};

outputs = inputs@{ self, nixpkgs, naersk, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; };
rust = (pkgs.rustChannelOf {
date = "2021-05-01";
channel = "nightly";
let
rust = pkgs:
(pkgs.rustChannelOf {
date = "2021-05-01";
channel = "nightly";
}).minimal; # cargo, rustc and rust-std
naerskLib = naersk.lib."${system}".override {

mkNaerskLib = system: pkgs:
naersk.lib."${system}".override {
# naersk can't build with stable?!
# inherit (pkgs.rust-bin.stable.latest) rustc cargo;
rustc = rust;
cargo = rust;
rustc = rust pkgs;
cargo = rust pkgs;
};
in rec {
packages.helix = naerskLib.buildPackage {

pkg = naerskLib:
naerskLib.buildPackage {
pname = "helix";
root = inputs.helix;
};

in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlay ];
};
naerskLib = mkNaerskLib system pkgs;
in rec {
packages.helix = pkg naerskLib;
defaultPackage = packages.helix;
devShell = pkgs.callPackage ./shell.nix {};
});
devShell = pkgs.callPackage ./shell.nix { };
}) // {
overlay = final: prev:
let naerskLib = mkNaerskLib prev.system final;
in (rust-overlay.overlay final prev) // { helix = pkg naerskLib; };
};
}

0 comments on commit 6937838

Please sign in to comment.