Files
diodeinc__pcb/flake.nix
T
Akhil Velagapudi 0ca2f604ba Replace buildifier with ruff fmt (#146)
buildifier doesn't support f-strings, which we use in a bunch of places.
We also run fmt after `pcb upgrade`, and it's a bit annoying that it
fails due to a buildifier error.

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-09-08 23:22:10 -04:00

78 lines
1.6 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
crane,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
craneLib = crane.mkLib pkgs;
src = pkgs.lib.cleanSourceWith {
src = lib.cleanSource ./.;
filter = (
orig_path: type:
pkgs.lib.hasSuffix ".py" (baseNameOf (toString orig_path))
|| (craneLib.filterCargoSources orig_path type)
);
name = "pcb-source";
};
commonArgs = {
pname = "pcb";
inherit src;
strictDeps = true;
doCheck = false;
nativeBuildInputs = [
pkgs.pkg-config
pkgs.openssl.dev
];
buildInputs = [
pkgs.pkg-config
pkgs.openssl
];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
pcb = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
inherit (craneLib.crateNameFromCargoToml { inherit src; }) version;
doCheck = false;
}
);
in
{
packages = {
default = pcb;
};
apps = {
default = flake-utils.lib.mkApp {
drv = pcb;
};
};
}
);
}