59 lines
1.6 KiB
Nix
59 lines
1.6 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;
|
|
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
|
|
in
|
|
{
|
|
packages =
|
|
let
|
|
inherit (pkgs.lib) fileset;
|
|
without = fs: fileset.difference ./. fs;
|
|
nixFiles = fileset.unions [ ./flake.nix ./flake.lock ./.envrc ];
|
|
gitFiles = fileset.gitTracked ./.;
|
|
src = fileset.toSource {
|
|
root = ./.;
|
|
fileset = fileset.intersection (without nixFiles) gitFiles;
|
|
};
|
|
in
|
|
{
|
|
default =
|
|
craneLib.buildPackage {
|
|
inherit src stdenv;
|
|
};
|
|
};
|
|
|
|
devShell = pkgs.mkShell.override
|
|
{
|
|
inherit stdenv;
|
|
}
|
|
{
|
|
nativeBuildInputs = with toolchain;
|
|
[ rustc cargo rust-analyzer clippy ] ++ (with pkgs;
|
|
[ ]
|
|
);
|
|
};
|
|
});
|
|
}
|