2021-04-07 00:17:50 +02:00
|
|
|
{
|
|
|
|
description = "bouncy";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2021-04-08 01:07:41 +02:00
|
|
|
utils.url = "github:numtide/flake-utils";
|
2021-04-08 04:39:02 +02:00
|
|
|
gitignore = {
|
|
|
|
url = "github:hercules-ci/gitignore";
|
|
|
|
flake=false;
|
|
|
|
};
|
2021-04-08 06:06:28 +02:00
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
2021-04-08 04:39:02 +02:00
|
|
|
crate2nix = {
|
|
|
|
url = "github:balsoft/crate2nix/tools-nix-version-comparison";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-04-07 05:25:05 +02:00
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-04-07 00:17:50 +02:00
|
|
|
};
|
|
|
|
|
2021-04-08 06:06:28 +02:00
|
|
|
outputs = { self, nixpkgs, utils, gitignore, rust-overlay, crate2nix, ... }:
|
2021-04-08 01:07:41 +02:00
|
|
|
utils.lib.eachDefaultSystem
|
2021-04-07 05:42:32 +02:00
|
|
|
(system:
|
2021-04-08 01:07:41 +02:00
|
|
|
let
|
2021-04-08 06:06:28 +02:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [
|
|
|
|
rust-overlay.overlay
|
|
|
|
(self: super: {
|
|
|
|
# Because rust-overlay bundles multiple rust packages into one
|
|
|
|
# derivation, specify that mega-bundle here, so that naersk
|
|
|
|
# will use them automatically.
|
|
|
|
rustc = self.rust-bin.stable.latest.default;
|
|
|
|
cargo = self.rust-bin.stable.latest.default;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2021-04-08 04:39:02 +02:00
|
|
|
inherit (import "${crate2nix}/tools.nix" { inherit pkgs; })
|
|
|
|
generatedCargoNix;
|
|
|
|
inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource;
|
|
|
|
project = pkgs.callPackage (generatedCargoNix {
|
|
|
|
name = "bouncy";
|
|
|
|
src = gitignoreSource ./.;
|
|
|
|
}) {
|
|
|
|
# Individual crate overrides go here
|
|
|
|
# Example: https://github.com/balsoft/simple-osd-daemons/blob/6f85144934c0c1382c7a4d3a2bbb80106776e270/flake.nix#L28-L50
|
2021-04-07 00:17:50 +02:00
|
|
|
};
|
2021-04-08 01:07:41 +02:00
|
|
|
in rec {
|
2021-04-08 05:18:18 +02:00
|
|
|
packages.bouncy = project.rootCrate.build;
|
2021-04-08 04:39:02 +02:00
|
|
|
|
2021-04-08 01:07:41 +02:00
|
|
|
# `nix build`
|
|
|
|
defaultPackage = packages.bouncy;
|
|
|
|
|
|
|
|
# `nix run`
|
|
|
|
apps.bouncy = utils.lib.mkApp {
|
2021-04-08 04:39:02 +02:00
|
|
|
name = "bouncy";
|
2021-04-08 01:07:41 +02:00
|
|
|
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}";
|
|
|
|
};
|
2021-04-07 00:17:50 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|