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