2023-12-31 22:49:37 +01:00
|
|
|
{
|
|
|
|
description = "A Nix-flake-based Rust development environment";
|
|
|
|
|
|
|
|
inputs = {
|
2024-05-23 09:36:23 +02:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
2024-05-02 20:39:19 +02:00
|
|
|
|
|
|
|
treefmt-nix = {
|
|
|
|
url = "github:numtide/treefmt-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-12-31 22:49:37 +01:00
|
|
|
};
|
|
|
|
|
2024-05-02 20:39:19 +02:00
|
|
|
outputs =
|
|
|
|
{
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
treefmt-nix,
|
|
|
|
}:
|
2023-12-31 22:49:37 +01:00
|
|
|
let
|
2024-05-02 20:39:19 +02:00
|
|
|
supportedSystems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"aarch64-darwin"
|
|
|
|
];
|
|
|
|
forEachSupportedSystem =
|
|
|
|
f:
|
|
|
|
nixpkgs.lib.genAttrs supportedSystems (
|
|
|
|
system:
|
|
|
|
f (
|
2023-12-31 22:49:37 +01:00
|
|
|
let
|
2024-05-23 13:16:11 +02:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
};
|
2023-12-31 22:49:37 +01:00
|
|
|
in
|
2024-05-02 20:39:19 +02:00
|
|
|
{
|
2024-10-21 18:19:33 +02:00
|
|
|
inherit pkgs;
|
2024-05-02 20:39:19 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
2023-12-31 22:49:37 +01:00
|
|
|
in
|
|
|
|
{
|
2024-05-02 20:39:19 +02:00
|
|
|
formatter = forEachSupportedSystem (
|
|
|
|
{ pkgs, ... }: (treefmt-nix.lib.evalModule pkgs ./treefmt.nix).config.build.wrapper
|
|
|
|
);
|
|
|
|
devShells = forEachSupportedSystem (
|
2024-10-21 18:19:33 +02:00
|
|
|
{ pkgs }:
|
2024-05-02 20:39:19 +02:00
|
|
|
{
|
|
|
|
default = pkgs.mkShell {
|
2024-10-21 18:19:33 +02:00
|
|
|
# nativeBuildInputs = [ pkgs.rustPlatform ];
|
|
|
|
# buildInputs = [ pkgs.rustPlatform ];
|
2024-05-02 20:39:19 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
packages = forEachSupportedSystem (
|
2024-10-21 18:19:33 +02:00
|
|
|
{ pkgs }:
|
2024-05-02 20:39:19 +02:00
|
|
|
{
|
|
|
|
default = (
|
|
|
|
let
|
|
|
|
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
|
2024-10-21 18:19:33 +02:00
|
|
|
rustPlatform = pkgs.rustPlatform;
|
2024-05-02 20:39:19 +02:00
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
pname = manifest.name;
|
|
|
|
version = manifest.version;
|
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
|
|
src = pkgs.lib.cleanSource ./.;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2023-12-31 22:49:37 +01:00
|
|
|
};
|
|
|
|
}
|