2023-12-19 10:33:43 -06:00
|
|
|
{
|
2024-07-30 15:16:46 -05:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
git-hooks.url = "github:cachix/git-hooks.nix";
|
|
|
|
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-12-19 10:33:43 -06:00
|
|
|
outputs = {
|
|
|
|
self,
|
2024-07-30 15:16:46 -05:00
|
|
|
git-hooks,
|
2023-12-19 10:33:43 -06:00
|
|
|
nixpkgs,
|
|
|
|
}: let
|
2023-12-19 10:41:50 -06:00
|
|
|
inherit (self) outputs;
|
2024-07-30 15:16:46 -05:00
|
|
|
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
|
|
|
|
forSystems = nixpkgs.lib.genAttrs systems;
|
|
|
|
pkgsFor = system: (import nixpkgs {inherit system;}).extend outputs.overlays.default;
|
|
|
|
genPkgs = func: (forSystems (system: func (pkgsFor system)));
|
2023-12-19 10:33:43 -06:00
|
|
|
in {
|
2024-07-30 15:16:46 -05:00
|
|
|
checks = genPkgs (pkgs: {
|
|
|
|
git-hooks = git-hooks.lib.${pkgs.system}.run {
|
|
|
|
src = ./.;
|
|
|
|
hooks = {
|
|
|
|
alejandra.enable = true;
|
|
|
|
# NOTE: These do not work well with `nix flake check` due to pure environments
|
|
|
|
# https://github.com/cachix/git-hooks.nix/issues/452
|
2024-09-12 11:58:24 -05:00
|
|
|
/*
|
|
|
|
cargo-check.enable = true;
|
|
|
|
clippy = {
|
|
|
|
enable = true;
|
|
|
|
packageOverrides.cargo = pkgs.cargo;
|
|
|
|
packageOverrides.clippy = pkgs.rustPackages.clippy;
|
|
|
|
};
|
|
|
|
*/
|
2024-07-30 15:16:46 -05:00
|
|
|
rustfmt = {
|
|
|
|
enable = true;
|
|
|
|
packageOverrides.rustfmt = pkgs.rustfmt;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
packages = genPkgs (pkgs: {
|
|
|
|
my-package = pkgs.rustPlatform.buildRustPackage {
|
|
|
|
pname = "kodotag";
|
|
|
|
version = "0.1.0";
|
|
|
|
|
2024-09-12 11:58:24 -05:00
|
|
|
/*
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
pkg-config
|
|
|
|
clang
|
|
|
|
];
|
2024-07-30 15:16:46 -05:00
|
|
|
|
2024-09-12 11:58:24 -05:00
|
|
|
buildInputs = with pkgs; [
|
|
|
|
];
|
|
|
|
*/
|
2024-07-30 15:16:46 -05:00
|
|
|
|
|
|
|
src = ./.;
|
|
|
|
hash = pkgs.lib.fakeHash;
|
|
|
|
cargoHash = "sha256-W7VQlMktGsRPQL9VGVmxYV6C5u2eJ48S7eTpOM+3n8U=";
|
2024-08-05 20:42:50 -05:00
|
|
|
|
|
|
|
RUSTFLAGS = pkgs.lib.optionalString pkgs.stdenv.isLinux "-C link-arg=-fuse-ld=mold";
|
2024-07-30 15:16:46 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
default = outputs.packages.${pkgs.system}.my-package;
|
|
|
|
});
|
|
|
|
|
|
|
|
devShells = genPkgs (pkgs: {
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
inherit (self.checks.${pkgs.system}.git-hooks) shellHook;
|
|
|
|
inputsFrom = [outputs.packages.${pkgs.system}.default];
|
|
|
|
packages = with pkgs; [
|
2023-12-19 10:33:43 -06:00
|
|
|
rustPackages.clippy
|
|
|
|
rust-analyzer
|
2024-07-30 15:16:46 -05:00
|
|
|
rustfmt
|
2024-03-19 10:25:29 -05:00
|
|
|
lldb
|
2023-12-19 10:33:43 -06:00
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
2024-07-30 15:16:46 -05:00
|
|
|
|
|
|
|
overlays = {
|
|
|
|
default = final: prev: {};
|
|
|
|
};
|
|
|
|
|
|
|
|
formatter = genPkgs (p: p.alejandra);
|
2023-12-19 10:33:43 -06:00
|
|
|
};
|
|
|
|
}
|