Compare commits

...

3 commits

Author SHA1 Message Date
Artemis Tosini 8a129be532
flake: switch to nixfmt-rfc-style 2024-07-07 21:13:56 +00:00
Artemis Tosini 489dcfacd7
flake: add rust devshell 2024-07-07 21:12:37 +00:00
Artemis Tosini 39326b7975
flake.lock: Update
Flake lock file updates:

• Updated input 'artemist-packages':
    'git+https://git.mildlyfunctional.gay/artemist/packages.git?ref=refs/heads/canon&rev=be4c446e1dc3391b353b07a701bed21db5b025bb' (2024-03-28)
  → 'git+https://git.mildlyfunctional.gay/artemist/packages.git?ref=refs/heads/canon&rev=4dc6a6a61ae68c559f56f28c778ddb1ebc8c9f9e' (2024-06-06)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/e2dd4e18cc1c7314e24154331bae07df76eb582f' (2024-05-26)
  → 'github:nixos/nixpkgs/4284c2b73c8bce4b46a6adf23e16d9e2ec8da4bb' (2024-07-05)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/3b6e1e221b04965427f3eee11fd6b6ea7b5f579b' (2024-05-26)
  → 'github:oxalica/rust-overlay/3eed08a074cd2000884a69d448d70da2843f7103' (2024-07-07)
• Removed input 'rust-overlay/flake-utils'
2024-07-07 21:07:22 +00:00
5 changed files with 123 additions and 91 deletions

View file

@ -10,11 +10,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1711597760, "lastModified": 1717636858,
"narHash": "sha256-SQ5ixJU33jjgSOrloFkuhvbKPy2FVREVNc96caEHYAY=", "narHash": "sha256-4NTFcQODSvySNCBz++O5SrcSFwU/xyqDS++s6HIzUEU=",
"ref": "refs/heads/canon", "ref": "refs/heads/canon",
"rev": "be4c446e1dc3391b353b07a701bed21db5b025bb", "rev": "4dc6a6a61ae68c559f56f28c778ddb1ebc8c9f9e",
"revCount": 46, "revCount": 49,
"type": "git", "type": "git",
"url": "https://git.mildlyfunctional.gay/artemist/packages.git" "url": "https://git.mildlyfunctional.gay/artemist/packages.git"
}, },
@ -25,11 +25,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1716715802, "lastModified": 1720181791,
"narHash": "sha256-usk0vE7VlxPX8jOavrtpOqphdfqEQpf9lgedlY/r66c=", "narHash": "sha256-i4vJL12/AdyuQuviMMd1Hk2tsGt02hDNhA0Zj1m16N8=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e2dd4e18cc1c7314e24154331bae07df76eb582f", "rev": "4284c2b73c8bce4b46a6adf23e16d9e2ec8da4bb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -49,19 +49,16 @@
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": [
"utils"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1716689906, "lastModified": 1720318855,
"narHash": "sha256-tQYQM9zT4P1fFf739/AIZuTIGPxtEIpV7K7VieU60Io=", "narHash": "sha256-w3CCVK9LJ5aznXGkO1IyAlbvMNJfyA+dBF7Z1Zwx1LA=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "3b6e1e221b04965427f3eee11fd6b6ea7b5f579b", "rev": "3eed08a074cd2000884a69d448d70da2843f7103",
"type": "github" "type": "github"
}, },
"original": { "original": {

184
flake.nix
View file

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

1
rust/.envrc Normal file
View file

@ -0,0 +1 @@
use flake ..#rust