Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 63 additions & 12 deletions packages/chiptool.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ rustPlatform.buildRustPackage rec {
hash = "sha256-l5a184UCqy/IeQ25hR43uWoSUg1cexLX2Dxd7mgOHKQ=";
};

patches = [
cargoHash = "sha256-gMCD0xTyN+KIDM1zrzkyt8qxJhjQNr2fx/Ub+F9fe5k=";
cargoPatches = [
# Patch-in the revision, there is no .git directory in src that the build-script could use
(writeText "chiptool-nix-generated-revision.patch" ''
--- a/src/generate/mod.rs
Expand All @@ -30,24 +31,74 @@ rustPlatform.buildRustPackage rec {

let commit_info = {
- let tmp = include_str!(concat!(env!("OUT_DIR"), "/commit-info.txt"));
+ let tmp = " (${rev} from github:kiteshield-ab/nix-utils#chiptool)";
+ let tmp = " (${rev} from github:kiteshield-ab/nix-utils#chiptool (patched to use upstream svd-parser))";

if tmp.is_empty() {
" (untracked)"

'')
# Patch-in the upstream variant of svd-parser, does not seem to meaningfully differ (just more features)
# but it includes our patch (https://github.com/rust-embedded/svd/pull/294) that removes a broken submodule
# that clashes with the Nix's rust-platform behaviour (forced git-submodule pull)
(writeText "use-upstream-svd-rs.patch" ''
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ proc-macro2 = "1.0"
anyhow = "1.0.79"
regex = "1.10.3"
serde = { version = "1.0.196", features = [ "derive" ]}
-svd-parser = { git = "https://github.com/Dirbaio/svd.git", rev = "4d5c96f95b32acf9c9bfbda5a0619a2374475fe7", features = ["derive-from", "expand"] }
+svd-parser = { git = "https://github.com/rust-embedded/svd.git", features = ["derive-from", "expand"] }
#svd-parser = { path = "./svd/svd-parser", features = ["derive-from", "expand"] }
# Development has stopped for `serde_yaml`
serde_yaml = "=0.9.34-deprecated"
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4

[[package]]
name = "aho-corasick"
@@ -264,9 +264,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"

[[package]]
name = "roxmltree"
-version = "0.19.0"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f"
+checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"

[[package]]
name = "ryu"
@@ -315,8 +315,8 @@ checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01"

[[package]]
name = "svd-parser"
-version = "0.14.5"
-source = "git+https://github.com/Dirbaio/svd.git?rev=4d5c96f95b32acf9c9bfbda5a0619a2374475fe7#4d5c96f95b32acf9c9bfbda5a0619a2374475fe7"
+version = "0.14.9"
+source = "git+https://github.com/rust-embedded/svd.git#36750c1b8dc3c76760cd5569337192bec0ca6749"
dependencies = [
"anyhow",
"roxmltree",
@@ -326,8 +326,8 @@ dependencies = [

[[package]]
name = "svd-rs"
-version = "0.14.7"
-source = "git+https://github.com/Dirbaio/svd.git?rev=4d5c96f95b32acf9c9bfbda5a0619a2374475fe7#4d5c96f95b32acf9c9bfbda5a0619a2374475fe7"
+version = "0.14.12"
+source = "git+https://github.com/rust-embedded/svd.git#36750c1b8dc3c76760cd5569337192bec0ca6749"
dependencies = [
"once_cell",
"regex",
'')
];

# Nix's Rust platform does not support git dependencies in lock files.
# Replace `cargoHash`, copy the lockfile over and provide hashes for git dependencies.
# https://github.com/NixOS/nixpkgs/blob/a84ebe20c6bc2ecbcfb000a50776219f48d134cc/doc/languages-frameworks/rust.section.md#importing-a-cargolock-file-importing-a-cargolock-file
cargoLock = {
lockFile = ./chiptool/Cargo.lock;
outputHashes = {
"svd-parser-0.14.5" = "sha256-r78UZfulqPBegBc5/fOkgGGtv5AN2FjZFVg7g8ii5Qc=";
};
};

meta = with lib; {
description = "SVD to PAC next-gen code generator (${forkOwner} fork)";
mainProgram = "chiptool";
Expand Down
Loading