* Switch to nmattia/naersk (but without overlay)

* Restore the overlay
This commit is contained in:
Sridhar Ratnakumar 2021-04-07 19:07:41 -04:00 committed by GitHub
parent b67148f793
commit 7e6a9d6b1d
Failed to generate hash of commit
3 changed files with 90 additions and 41 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/target /target
/result

View file

@ -17,21 +17,6 @@
} }
}, },
"flake-utils": { "flake-utils": {
"locked": {
"lastModified": 1617631617,
"narHash": "sha256-PARRCz55qN3gy07VJZIlFeOX420d0nGF0RzGI/9hVlw=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b2c27d1a81b0dc266270fa8aeecebbd1807fc610",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": { "locked": {
"lastModified": 1614513358, "lastModified": 1614513358,
"narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=", "narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=",
@ -46,7 +31,39 @@
"type": "github" "type": "github"
} }
}, },
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1614785451,
"narHash": "sha256-TPw8kQvr2UNCuvndtY+EjyXp6Q5GEW2l9UafXXh1XmI=",
"owner": "nmattia",
"repo": "naersk",
"rev": "e0fe990b478a66178a58c69cf53daec0478ca6f9",
"type": "github"
},
"original": {
"owner": "nmattia",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1617833390,
"narHash": "sha256-puAjU8RcmfqrPYnOuDvESPgA+QtaszUKJZ7jrjnk7iU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "87df3e15f029f44a3dca474907a3c02bcbe03414",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1617636226, "lastModified": 1617636226,
"narHash": "sha256-iZhBWrOR2DoDs1C+0FlnM9AQLMol/qoGQ+d+S43CKJM=", "narHash": "sha256-iZhBWrOR2DoDs1C+0FlnM9AQLMol/qoGQ+d+S43CKJM=",
@ -62,7 +79,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1617325113, "lastModified": 1617325113,
"narHash": "sha256-GksR0nvGxfZ79T91UUtWjjccxazv6Yh/MvEJ82v1Xmw=", "narHash": "sha256-GksR0nvGxfZ79T91UUtWjjccxazv6Yh/MvEJ82v1Xmw=",
@ -80,15 +97,16 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-utils": "flake-utils", "naersk": "naersk",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay",
"utils": "utils"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1617762447, "lastModified": 1617762447,
@ -103,6 +121,21 @@
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
},
"utils": {
"locked": {
"lastModified": 1617631617,
"narHash": "sha256-PARRCz55qN3gy07VJZIlFeOX420d0nGF0RzGI/9hVlw=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b2c27d1a81b0dc266270fa8aeecebbd1807fc610",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -4,36 +4,51 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay"; rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
naersk.url = "github:nmattia/naersk";
flake-compat = { flake-compat = {
url = "github:edolstra/flake-compat"; url = "github:edolstra/flake-compat";
flake = false; flake = false;
}; };
}; };
outputs = { self, nixpkgs, flake-utils, rust-overlay, flake-compat }: outputs = { self, nixpkgs, utils, rust-overlay, naersk, ... }:
flake-utils.lib.eachDefaultSystem utils.lib.eachDefaultSystem
(system: (system:
let pkgs = import nixpkgs { let
pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ rust-overlay.overlay ]; overlays = [
}; in rust-overlay.overlay
{ (self: super: {
devShell = pkgs.mkShell { # Because rust-overlay bundles multple rust packages into one
nativeBuildInputs = [ # derivation, specify that mega-bundle here, so that naersk
(pkgs.rust-bin.stable.latest.default.override { # will use them automatically.
extensions = [ rustc = self.rust-bin.stable.latest.default;
"rust-src" cargo = self.rust-bin.stable.latest.default;
"cargo"
"rustc"
"rls"
"rust-analysis"
"rustfmt"
"clippy"
];
}) })
]; ];
}; };
naersk-lib = naersk.lib."${system}";
in rec {
# `nix build`
packages.bouncy = naersk-lib.buildPackage {
pname = "bouncy";
root = ./.;
};
defaultPackage = packages.bouncy;
# `nix run`
apps.bouncy = utils.lib.mkApp {
drv = packages.bouncy;
};
defaultApp = apps.bouncy;
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ rustc cargo ];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
} }
); );
} }