add overlay

This commit is contained in:
Timothy DeHerrera 2021-06-09 15:56:11 -06:00 committed by Blaž Hrastnik
parent 1a774d61bb
commit 69378382c3

View File

@ -15,25 +15,41 @@
}; };
outputs = inputs@{ self, nixpkgs, naersk, rust-overlay, flake-utils, ... }: outputs = inputs@{ self, nixpkgs, naersk, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system: let
let rust = pkgs:
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; }; (pkgs.rustChannelOf {
rust = (pkgs.rustChannelOf { date = "2021-05-01";
date = "2021-05-01"; channel = "nightly";
channel = "nightly";
}).minimal; # cargo, rustc and rust-std }).minimal; # cargo, rustc and rust-std
naerskLib = naersk.lib."${system}".override {
mkNaerskLib = system: pkgs:
naersk.lib."${system}".override {
# naersk can't build with stable?! # naersk can't build with stable?!
# inherit (pkgs.rust-bin.stable.latest) rustc cargo; # inherit (pkgs.rust-bin.stable.latest) rustc cargo;
rustc = rust; rustc = rust pkgs;
cargo = rust; cargo = rust pkgs;
}; };
in rec {
packages.helix = naerskLib.buildPackage { pkg = naerskLib:
naerskLib.buildPackage {
pname = "helix"; pname = "helix";
root = inputs.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; 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; };
};
} }