2024-01-04 16:36:41 +01:00
|
|
|
{
|
|
|
|
description = "ToDooDoo";
|
2024-05-09 12:31:57 +02:00
|
|
|
|
2024-01-04 16:36:41 +01:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2024-05-09 12:31:57 +02:00
|
|
|
|
|
|
|
treefmt-nix = {
|
|
|
|
url = "github:numtide/treefmt-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
|
|
|
fenix = {
|
|
|
|
url = "github:nix-community/fenix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-01-04 16:36:41 +01:00
|
|
|
};
|
2024-05-09 12:31:57 +02:00
|
|
|
|
|
|
|
outputs =
|
|
|
|
|
|
|
|
{
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
treefmt-nix,
|
|
|
|
fenix,
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
supportedSystems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"aarch64-darwin"
|
|
|
|
];
|
|
|
|
forEachSupportedSystem =
|
|
|
|
f:
|
|
|
|
nixpkgs.lib.genAttrs supportedSystems (
|
|
|
|
system:
|
|
|
|
f (
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
fenix' = (import fenix { inherit system pkgs; });
|
|
|
|
toolchain = fenix'.fromToolchainFile {
|
|
|
|
file = ./rust-toolchain.toml;
|
2024-06-19 10:37:24 +02:00
|
|
|
sha256 = "sha256-Ngiz76YP4HTY75GGdH2P+APE/DEIx2R/Dn+BwwOyzZU=";
|
2024-05-09 12:31:57 +02:00
|
|
|
};
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
rust-analyzer
|
|
|
|
rustfmt
|
|
|
|
clippy
|
|
|
|
|
|
|
|
clang
|
|
|
|
mold
|
|
|
|
|
|
|
|
pkg-config
|
|
|
|
libGLU
|
|
|
|
libGL
|
|
|
|
libxkbcommon
|
|
|
|
|
|
|
|
wayland
|
|
|
|
];
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit pkgs toolchain buildInputs;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
formatter = forEachSupportedSystem (
|
|
|
|
{ pkgs, ... }: (treefmt-nix.lib.evalModule pkgs ./treefmt.nix).config.build.wrapper
|
|
|
|
);
|
|
|
|
devShells = forEachSupportedSystem (
|
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
toolchain,
|
|
|
|
buildInputs,
|
|
|
|
}:
|
|
|
|
{
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
buildInputs = buildInputs ++ [ toolchain ];
|
|
|
|
env = {
|
|
|
|
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
|
|
|
|
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (buildInputs)}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
packages = forEachSupportedSystem (
|
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
toolchain,
|
|
|
|
buildInputs,
|
|
|
|
}:
|
|
|
|
{
|
|
|
|
default = (
|
|
|
|
let
|
|
|
|
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
|
|
|
|
rustPlatform = pkgs.makeRustPlatform {
|
|
|
|
cargo = toolchain;
|
|
|
|
rustc = toolchain;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
inherit buildInputs;
|
|
|
|
pname = manifest.name;
|
|
|
|
version = manifest.version;
|
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
|
|
src = pkgs.lib.cleanSource ./.;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
2024-01-04 16:36:41 +01:00
|
|
|
}
|