51 lines
1.4 KiB
Nix
51 lines
1.4 KiB
Nix
{
|
|
inputs = {
|
|
crane = {
|
|
url = "github:ipetkov/crane";
|
|
inputs = {
|
|
flake-utils.follows = "flake-utils";
|
|
nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
fenix = {
|
|
url = "github:nix-community/fenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
|
};
|
|
|
|
outputs = { self, crane, fenix, flake-utils, nixpkgs }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = (import nixpkgs) {
|
|
inherit system;
|
|
};
|
|
toolchain = fenix.packages.${system}.stable;
|
|
craneLib = crane.lib.${system}.overrideToolchain toolchain.toolchain;
|
|
in
|
|
{
|
|
packages.default =
|
|
let
|
|
inherit (pkgs.lib) fileset;
|
|
in
|
|
craneLib.buildPackage {
|
|
src = fileset.toSource {
|
|
root = ./.;
|
|
fileset = fileset.intersection
|
|
(fileset.difference ./.
|
|
(fileset.unions [ ./.cargo ./flake.nix ./flake.lock ./.envrc ]))
|
|
(fileset.gitTracked ./.);
|
|
};
|
|
};
|
|
|
|
devShell = pkgs.mkShell.override
|
|
{
|
|
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv;
|
|
}
|
|
{
|
|
nativeBuildInputs = with toolchain; [ rustc cargo rust-analyzer clippy ];
|
|
};
|
|
});
|
|
}
|