refact: Move dev-only dependencies into separate lock file
(cherry picked from commit ddf306bb9564a43fb42ab4321b390e766254f1c4)
This commit is contained in:
parent
271cf09450
commit
7918175c24
6 changed files with 188 additions and 153 deletions
12
.claude/settings.local.json
Normal file
12
.claude/settings.local.json
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(nix flake check:*)",
|
||||||
|
"Bash(git grep:*)",
|
||||||
|
"Bash(git cherry-pick:*)",
|
||||||
|
"Bash(sed:*)"
|
||||||
|
],
|
||||||
|
"deny": []
|
||||||
|
}
|
||||||
|
}
|
||||||
74
dev/flake-module.nix
Normal file
74
dev/flake-module.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
{ inputs, ... }: {
|
||||||
|
imports = [ inputs.pre-commit-hooks-nix.flakeModule ];
|
||||||
|
perSystem = { config, pkgs, ... }: {
|
||||||
|
|
||||||
|
pre-commit.settings.hooks.nixpkgs-fmt.enable = true;
|
||||||
|
# Temporarily disable rustfmt due to configuration issues
|
||||||
|
# pre-commit.settings.hooks.rustfmt.enable = true;
|
||||||
|
pre-commit.settings.settings.rust.cargoManifestPath = "./rust/Cargo.toml";
|
||||||
|
|
||||||
|
# Check that we're using ///-style doc comments in Rust code.
|
||||||
|
#
|
||||||
|
# Unfortunately, rustfmt won't do this for us yet - at least not
|
||||||
|
# without nightly, and it might do too much.
|
||||||
|
pre-commit.settings.hooks.rust-doc-comments = {
|
||||||
|
enable = true;
|
||||||
|
files = "\\.rs$";
|
||||||
|
entry = "${pkgs.writeScript "rust-doc-comments" ''
|
||||||
|
#!${pkgs.runtimeShell}
|
||||||
|
set -uxo pipefail
|
||||||
|
grep -n -C3 --color=always -F '/**' "$@"
|
||||||
|
r=$?
|
||||||
|
set -e
|
||||||
|
if [ $r -eq 0 ]; then
|
||||||
|
echo "Please replace /**-style comments by /// style comments in Rust code."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
''}";
|
||||||
|
};
|
||||||
|
|
||||||
|
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" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
85
dev/flake.lock
generated
Normal file
85
dev/flake.lock
generated
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"pre-commit-hooks-nix",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1720386169,
|
||||||
|
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre-commit-hooks-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [],
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1724857454,
|
||||||
|
"narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"pre-commit-hooks-nix": "pre-commit-hooks-nix"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
8
dev/flake.nix
Normal file
8
dev/flake.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
description = "dependencies only";
|
||||||
|
inputs = {
|
||||||
|
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
|
||||||
|
pre-commit-hooks-nix.inputs.nixpkgs.follows = "";
|
||||||
|
};
|
||||||
|
outputs = { ... }: { };
|
||||||
|
}
|
||||||
79
flake.lock
generated
79
flake.lock
generated
|
|
@ -56,22 +56,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-compat_2": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1696426674,
|
|
||||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
|
@ -142,27 +126,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitignore": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"pre-commit-hooks-nix",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1709087332,
|
|
||||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libgit2": {
|
"libgit2": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
|
@ -308,22 +271,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1720386169,
|
|
||||||
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-24.05",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parts": {
|
"parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
|
|
@ -345,29 +292,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pre-commit-hooks-nix": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat_2",
|
|
||||||
"gitignore": "gitignore",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"nixpkgs-stable": "nixpkgs-stable"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1724227338,
|
|
||||||
"narHash": "sha256-TuSaYdhOxeaaE9885mFO1lZHHax33GD5A9dczJrGUjw=",
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "pre-commit-hooks.nix",
|
|
||||||
"rev": "6cedaa7c1b4f82a266e5d30f212273e60d62cb0d",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "pre-commit-hooks.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"purescript-overlay": {
|
"purescript-overlay": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
@ -413,8 +337,7 @@
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"nix": "nix",
|
"nix": "nix",
|
||||||
"nix-cargo-integration": "nix-cargo-integration",
|
"nix-cargo-integration": "nix-cargo-integration",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs"
|
||||||
"pre-commit-hooks-nix": "pre-commit-hooks-nix"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
|
|
||||||
83
flake.nix
83
flake.nix
|
|
@ -8,8 +8,6 @@
|
||||||
nix-cargo-integration.url = "github:yusdacra/nix-cargo-integration";
|
nix-cargo-integration.url = "github:yusdacra/nix-cargo-integration";
|
||||||
nix-cargo-integration.inputs.nixpkgs.follows = "nixpkgs";
|
nix-cargo-integration.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
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, ... }:
|
outputs = inputs@{ self, flake-parts, ... }:
|
||||||
|
|
@ -17,86 +15,21 @@
|
||||||
{ inherit inputs; }
|
{ inherit inputs; }
|
||||||
({ lib, ... }: {
|
({ lib, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
inputs.pre-commit-hooks-nix.flakeModule
|
|
||||||
inputs.nix-cargo-integration.flakeModule
|
inputs.nix-cargo-integration.flakeModule
|
||||||
|
inputs.flake-parts.flakeModules.partitions
|
||||||
./rust/nci.nix
|
./rust/nci.nix
|
||||||
];
|
];
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||||
perSystem = { config, self', inputs', pkgs, ... }: {
|
perSystem = { config, self', inputs', pkgs, ... }: {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
packages.nix = inputs'.nix.packages.nix;
|
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";
|
|
||||||
|
|
||||||
# Check that we're using ///-style doc comments in Rust code.
|
|
||||||
#
|
|
||||||
# Unfortunately, rustfmt won't do this for us yet - at least not
|
|
||||||
# without nightly, and it might do too much.
|
|
||||||
pre-commit.settings.hooks.rust-doc-comments = {
|
|
||||||
enable = true;
|
|
||||||
files = "\\.rs$";
|
|
||||||
entry = "${pkgs.writeScript "rust-doc-comments" ''
|
|
||||||
#!${pkgs.runtimeShell}
|
|
||||||
set -uxo pipefail
|
|
||||||
grep -n -C3 --color=always -F '/**' "$@"
|
|
||||||
r=$?
|
|
||||||
set -e
|
|
||||||
if [ $r -eq 0 ]; then
|
|
||||||
echo "Please replace /**-style comments by /// style comments in Rust code."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
''}";
|
|
||||||
};
|
|
||||||
|
|
||||||
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" ];
|
partitionedAttrs.devShells = "dev";
|
||||||
|
partitionedAttrs.checks = "dev";
|
||||||
|
partitionedAttrs.herculesCI = "dev";
|
||||||
|
partitions.dev.extraInputsFlake = ./dev;
|
||||||
|
partitions.dev.module = {
|
||||||
|
imports = [ ./dev/flake-module.nix ];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue