flake: switch to nixfmt-rfc-style

This commit is contained in:
Artemis Tosini 2024-07-07 21:13:56 +00:00
parent 489dcfacd7
commit 8a129be532
Signed by: artemist
GPG key ID: EE5227935FE3FF18
3 changed files with 110 additions and 81 deletions

185
flake.nix
View file

@ -13,8 +13,16 @@
inputs.flake-utils.follows = "utils";
};
};
outputs = { self, nixpkgs, utils, artemist-packages, rust-overlay }:
utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
utils,
artemist-packages,
rust-overlay,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
@ -23,77 +31,94 @@
rust-overlay.overlays.default
];
};
in rec {
devShells.zephyr =
artemist-packages.devShells.${system}.zephyr.override {
toolchains = with pkgs.zephyrPackages.toolchains; [
arm-zephyr-eabi
riscv64-zephyr-elf
];
modules = with pkgs.zephyrPackages.modules; [
mbedtls
hal_rpi_pico
hal_atmel
cmsis
];
extraPackages = with pkgs; [ pyocd ];
};
in
rec {
devShells.zephyr = artemist-packages.devShells.${system}.zephyr.override {
toolchains = with pkgs.zephyrPackages.toolchains; [
arm-zephyr-eabi
riscv64-zephyr-elf
];
modules = with pkgs.zephyrPackages.modules; [
mbedtls
hal_rpi_pico
hal_atmel
cmsis
];
extraPackages = with pkgs; [ pyocd ];
};
devShells.zephyr-west = devShells.zephyr.override {
enableWest = true;
zephyrSrc = null;
modules = [ ];
};
devShells.rust-embedded = let
rust = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "llvm-tools-preview" "clippy" ];
# just use all of them, why not
targets = [
"thumbv6m-none-eabi"
"thumbv7m-none-eabi"
"thumbv7em-none-eabi"
"thumbv7em-none-eabihf"
"riscv32imac-unknown-none-elf"
];
};
rust-form = pkgs.rustPlatform.buildRustPackage rec {
pname = "form";
version = "0.10.0";
src = pkgs.fetchFromGitHub {
owner = "djmcgill";
repo = pname;
rev = "v${version}";
hash = "sha256-cqoc2sTtVdhTAQ65oaJKo1+YMfQu7eHCe8zjRPDz9zg=";
devShells.rust-embedded =
let
rust = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"llvm-tools-preview"
"clippy"
];
# just use all of them, why not
targets = [
"thumbv6m-none-eabi"
"thumbv7m-none-eabi"
"thumbv7em-none-eabi"
"thumbv7em-none-eabihf"
"riscv32imac-unknown-none-elf"
];
};
cargoHash = "sha256-dhPp93AH4VlOVJWXMMUwv8b53vLPdBY3WyaXE4kcEm4=";
};
in with pkgs;
mkShell {
packages = [
cargo-binutils
cargo-generate
gdb
openocd
probe-rs
rust
rust-form
svd2rust
svdtools
];
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
};
devShells.rust = with pkgs;
rust-form = pkgs.rustPlatform.buildRustPackage rec {
pname = "form";
version = "0.10.0";
src = pkgs.fetchFromGitHub {
owner = "djmcgill";
repo = pname;
rev = "v${version}";
hash = "sha256-cqoc2sTtVdhTAQ65oaJKo1+YMfQu7eHCe8zjRPDz9zg=";
};
cargoHash = "sha256-dhPp93AH4VlOVJWXMMUwv8b53vLPdBY3WyaXE4kcEm4=";
};
in
with pkgs;
mkShell {
nativeBuildInputs = [ rustc cargo rustfmt clippy ];
packages = [
cargo-binutils
cargo-generate
gdb
openocd
probe-rs
rust
rust-form
svd2rust
svdtools
];
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
};
devShells.rust =
with pkgs;
mkShell {
nativeBuildInputs = [
rustc
cargo
rustfmt
clippy
];
RUST_SRC_PATH = "${rust.packages.stable.rustPlatform.rustLibSrc}";
};
devShells.avr = with pkgs;
devShells.avr =
with pkgs;
pkgsCross.avr.mkShell {
packages = [ avrdude gnumake ];
packages = [
avrdude
gnumake
];
LIBC = pkgsCross.avr.avrlibc;
};
devShells.emoji = with pkgs;
devShells.emoji =
with pkgs;
mkShell {
packages = [
chromedriver
@ -105,32 +130,34 @@
python3Packages.trio
python3Packages.gql
(python3Packages.selenium.overrideAttrs (old: {
postInstall = old.postInstall + ''
for ver in v85 v120 v121 v122; do
DEVTOOLS=../common/devtools/chromium/$ver
for proto in js browser; do
python3 ../common/devtools/convert_protocol_to_json.py \
$DEVTOOLS/"$proto"_protocol.pdl \
--map_binary_to_string=true \
$DEVTOOLS/"$proto"_protocol.json
postInstall =
old.postInstall
+ ''
for ver in v85 v120 v121 v122; do
DEVTOOLS=../common/devtools/chromium/$ver
for proto in js browser; do
python3 ../common/devtools/convert_protocol_to_json.py \
$DEVTOOLS/"$proto"_protocol.pdl \
--map_binary_to_string=true \
$DEVTOOLS/"$proto"_protocol.json
done
mkdir -p $DST_PREFIX/common/devtools/$ver
python3 generate.py \
$DEVTOOLS/browser_protocol.json \
$DEVTOOLS/js_protocol.json \
$DST_PREFIX/common/devtools/$ver
done
mkdir -p $DST_PREFIX/common/devtools/$ver
python3 generate.py \
$DEVTOOLS/browser_protocol.json \
$DEVTOOLS/js_protocol.json \
$DST_PREFIX/common/devtools/$ver
done
'';
'';
nativeBuildInputs = old.nativeBuildInputs
++ [ python3Packages.inflection ];
nativeBuildInputs = old.nativeBuildInputs ++ [ python3Packages.inflection ];
}))
];
CHROME = "${chromium}/bin/chromium";
};
devShells.typst = with pkgs; mkShell { packages = [ typst ]; };
formatter = pkgs.nixfmt;
});
formatter = pkgs.nixfmt-rfc-style;
}
);
}

View file

@ -12,4 +12,5 @@ let
}
];
};
in system.config.system.build.sdImage
in
system.config.system.build.sdImage

View file

@ -7,7 +7,8 @@ let
rev = "1.4.0";
sha256 = "sha256-i3IAaNcd0EfKNvU104a776O1poDAChlx1m+nP8iFn8E=";
};
in mkShell rec {
in
mkShell rec {
name = "pico-env";
nativeBuildInputs = [ pkg-config ];