aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy DeHerrera2021-06-09 21:56:11 +0000
committerBlaž Hrastnik2021-06-10 13:00:53 +0000
commit69378382c3b679d0dc6ce0c2a1b5d9b32317c09b (patch)
treeb2d4b85d2df412f7fc43c18b09f2fbc510a5c23c
parent1a774d61bb3ec28ac202a43450f35017f918e46e (diff)
add overlay
-rw-r--r--flake.nix42
1 files changed, 29 insertions, 13 deletions
diff --git a/flake.nix b/flake.nix
index 3626be9a..cbbc3156 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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; };
+ };
}