nixide/flake.nix
Robert Hensing 1edaffcc09 flake: nix: NixOS/master -> hercules-ci/fix-eval-state-baseEnv-gc-root
Flake lock file updates:

• Updated input 'nix':
    'github:nixos/nix/1cfc9da472f8dcfa7f521e544531d5e4daf2076c' (2024-04-23)
  → 'github:hercules-ci/nix/38974360102e67aaf2434fd3f920e2cd1bb3fa75' (2024-05-01)

(cherry picked from commit b8001272187137243685870d414df28d1a229e02)
2025-10-04 02:30:46 +02:00

83 lines
3 KiB
Nix

{
description = "A flake with pre-commit hooks";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
nix.url = "github:hercules-ci/nix/fix-eval-state-baseEnv-gc-root";
nix.inputs.nixpkgs.follows = "nixpkgs";
nix-cargo-integration.url = "github:yusdacra/nix-cargo-integration";
nix-cargo-integration.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake
{ inherit inputs; }
({ lib, ... }: {
imports = [
inputs.pre-commit-hooks-nix.flakeModule
inputs.nix-cargo-integration.flakeModule
./rust/nci.nix
];
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, ... }: {
packages.nix = inputs'.nix.packages.nix;
pre-commit.settings.hooks.nixpkgs-fmt.enable = true;
# Temporarily disable rustfmt due to configuration issues
# pre-commit.settings.hooks.rustfmt.enable = true;
# New configuration for rustfmt
pre-commit.settings.settings.rust.cargoManifestPath = "./rust/Cargo.toml";
devShells.default = pkgs.mkShell {
name = "nix-bindings-devshell";
strictDeps = true;
inputsFrom = [ config.nci.outputs.nix-bindings.devShell ];
inherit (config.nci.outputs.nix-bindings.devShell.env)
LIBCLANG_PATH
BINDGEN_EXTRA_CLANG_ARGS
;
NIX_DEBUG_INFO_DIRS =
let
# TODO: add to Nixpkgs lib
getDebug = pkg:
if pkg?debug then pkg.debug
else if pkg?lib then pkg.lib
else pkg;
in
"${getDebug config.packages.nix}/lib/debug";
buildInputs = [
config.packages.nix
];
nativeBuildInputs = [
pkgs.rust-analyzer
pkgs.nixpkgs-fmt
pkgs.rustfmt
pkgs.pkg-config
pkgs.clang-tools # clangd
pkgs.valgrind
pkgs.gdb
# TODO: set up cargo-valgrind in shell and build
# currently both this and `cargo install cargo-valgrind`
# produce a binary that says ENOENT.
# pkgs.cargo-valgrind
];
shellHook = ''
${config.pre-commit.installationScript}
echo 1>&2 "Welcome to the development shell!"
'';
# rust-analyzer needs a NIX_PATH for some reason
NIX_PATH = "nixpkgs=${inputs.nixpkgs}";
};
};
flake = {
herculesCI.ciSystems = [ "x86_64-linux" ];
};
});
}