nix: configure and apply a formatter
This sets the formatter to alejandra. I was trying to stay as close as the original as I could; otherwise we could set it to `nixfmt` which would keep list spacing more similar, but would introduce additional indentation in a few places.
This commit is contained in:
@@ -6,20 +6,27 @@
|
|||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
outputs = {
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
self,
|
||||||
let
|
nixpkgs,
|
||||||
pkgs = import nixpkgs { inherit system; };
|
flake-utils,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system: let
|
||||||
|
pkgs = import nixpkgs {inherit system;};
|
||||||
|
|
||||||
# Python with the packages needed by the offline converter tools
|
# Python with the packages needed by the offline converter tools
|
||||||
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
pythonEnv = pkgs.python3.withPackages (
|
||||||
torch
|
ps:
|
||||||
safetensors
|
with ps; [
|
||||||
huggingface-hub
|
torch
|
||||||
numpy
|
safetensors
|
||||||
tokenizers
|
huggingface-hub
|
||||||
datasets
|
numpy
|
||||||
]);
|
tokenizers
|
||||||
|
datasets
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
colibri = pkgs.stdenv.mkDerivation {
|
colibri = pkgs.stdenv.mkDerivation {
|
||||||
pname = "colibri";
|
pname = "colibri";
|
||||||
@@ -28,7 +35,7 @@
|
|||||||
|
|
||||||
# python3 is needed by checkPhase: `make test-c` shells out to
|
# python3 is needed by checkPhase: `make test-c` shells out to
|
||||||
# `python3 tools/run_tests.py` (see c/Makefile, PYTHON ?= python3).
|
# `python3 tools/run_tests.py` (see c/Makefile, PYTHON ?= python3).
|
||||||
nativeBuildInputs = [ pkgs.makeWrapper pkgs.python3 ];
|
nativeBuildInputs = [pkgs.makeWrapper pkgs.python3];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.gcc
|
pkgs.gcc
|
||||||
@@ -107,14 +114,16 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
formatter = (import nixpkgs {inherit system;}).alejandra;
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
inputsFrom = [ colibri ];
|
inputsFrom = [colibri];
|
||||||
|
|
||||||
packages = [
|
packages = [
|
||||||
pythonEnv
|
pythonEnv
|
||||||
pkgs.gcc
|
pkgs.gcc
|
||||||
pkgs.gnumake
|
pkgs.gnumake
|
||||||
pkgs.clang-tools # clangd / clang-tidy for IDE support
|
pkgs.clang-tools # clangd / clang-tidy for IDE support
|
||||||
pkgs.pkg-config
|
pkgs.pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user