Begin overhauling the flake.nix.
Some checks failed
Monorepo build / build-flake (push) Has been cancelled
Some checks failed
Monorepo build / build-flake (push) Has been cancelled
This was an AI guided overhaul based on the plan.md. These were the things we accomplished: - Update some Cargo.toml files to work with the 2024 Rust edition - Add a shellHook which installs Rust tools from the rust-toolchain - Rebundle several of the tools - attempt to start bundling the visions server and the visions ui Most tools are still in a usable state, but the visions server and visions UI do not currently build.
This commit is contained in:
64
Cargo.lock
generated
64
Cargo.lock
generated
@@ -335,6 +335,12 @@ dependencies = [
|
||||
"uuid 1.18.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "az"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be5eb007b7cacc6c660343e96f650fedf4b5a77512399eb952ca6642cf8d13f7"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.7"
|
||||
@@ -402,6 +408,12 @@ version = "3.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.10.1"
|
||||
@@ -623,6 +635,12 @@ version = "0.8.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
@@ -886,6 +904,18 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixed"
|
||||
version = "1.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c566da967934c6c7ee0458a9773de9b2a685bd2ce26a3b28ddfc740e640182f5"
|
||||
dependencies = [
|
||||
"az",
|
||||
"bytemuck",
|
||||
"half",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluent"
|
||||
version = "0.16.1"
|
||||
@@ -1791,6 +1821,17 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
@@ -2308,6 +2349,14 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lights-core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"az",
|
||||
"fixed",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.11.0"
|
||||
@@ -3328,6 +3377,21 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simulator"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"cairo-rs",
|
||||
"fixed",
|
||||
"gio",
|
||||
"glib",
|
||||
"gtk4",
|
||||
"libadwaita",
|
||||
"lights-core",
|
||||
"pango",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "1.0.1"
|
||||
|
||||
208
Cargo.nix
208
Cargo.nix
@@ -127,6 +127,16 @@ rec {
|
||||
# File a bug if you depend on any for non-debug work!
|
||||
debug = internal.debugCrate { inherit packageId; };
|
||||
};
|
||||
"lights-core" = rec {
|
||||
packageId = "lights-core";
|
||||
build = internal.buildRustCrateWithFeatures {
|
||||
packageId = "lights-core";
|
||||
};
|
||||
|
||||
# Debug support which might change between releases.
|
||||
# File a bug if you depend on any for non-debug work!
|
||||
debug = internal.debugCrate { inherit packageId; };
|
||||
};
|
||||
"memorycache" = rec {
|
||||
packageId = "memorycache";
|
||||
build = internal.buildRustCrateWithFeatures {
|
||||
@@ -147,6 +157,16 @@ rec {
|
||||
# File a bug if you depend on any for non-debug work!
|
||||
debug = internal.debugCrate { inherit packageId; };
|
||||
};
|
||||
"simulator" = rec {
|
||||
packageId = "simulator";
|
||||
build = internal.buildRustCrateWithFeatures {
|
||||
packageId = "simulator";
|
||||
};
|
||||
|
||||
# Debug support which might change between releases.
|
||||
# File a bug if you depend on any for non-debug work!
|
||||
debug = internal.debugCrate { inherit packageId; };
|
||||
};
|
||||
"visions-core" = rec {
|
||||
packageId = "visions-core";
|
||||
build = internal.buildRustCrateWithFeatures {
|
||||
@@ -1358,6 +1378,14 @@ rec {
|
||||
};
|
||||
resolvedDefaultFeatures = [ "default" "pretty-assertions" "ws" ];
|
||||
};
|
||||
"az" = rec {
|
||||
crateName = "az";
|
||||
version = "1.3.0";
|
||||
edition = "2024";
|
||||
sha256 = "1xqkip7l4rnaaawrwf8jfnkvbx7d1xjnzsa30dk6rk6anw3v0pmy";
|
||||
features = {
|
||||
};
|
||||
};
|
||||
"base64 0.21.7" = rec {
|
||||
crateName = "base64";
|
||||
version = "0.21.7";
|
||||
@@ -1523,6 +1551,22 @@ rec {
|
||||
};
|
||||
resolvedDefaultFeatures = [ "default" ];
|
||||
};
|
||||
"bytemuck" = rec {
|
||||
crateName = "bytemuck";
|
||||
version = "1.24.0";
|
||||
edition = "2018";
|
||||
sha256 = "1x65wc9kwf0dfnmglkl8r46d29pfl7yilll5wh9bcf0g6a0gbg8z";
|
||||
authors = [
|
||||
"Lokathor <zefria@gmail.com>"
|
||||
];
|
||||
features = {
|
||||
"bytemuck_derive" = [ "dep:bytemuck_derive" ];
|
||||
"derive" = [ "bytemuck_derive" ];
|
||||
"extern_crate_std" = [ "extern_crate_alloc" ];
|
||||
"latest_stable_rust" = [ "aarch64_simd" "avx512_simd" "align_offset" "alloc_uninit" "const_zeroed" "derive" "impl_core_error" "min_const_generics" "must_cast" "must_cast_extra" "pod_saturating" "track_caller" "transparentwrapper_extra" "wasm_simd" "zeroable_atomics" "zeroable_maybe_uninit" "zeroable_unwind_fn" ];
|
||||
"must_cast_extra" = [ "must_cast" ];
|
||||
};
|
||||
};
|
||||
"bytes" = rec {
|
||||
crateName = "bytes";
|
||||
version = "1.10.1";
|
||||
@@ -2188,6 +2232,19 @@ rec {
|
||||
};
|
||||
resolvedDefaultFeatures = [ "default" "std" ];
|
||||
};
|
||||
"crunchy" = rec {
|
||||
crateName = "crunchy";
|
||||
version = "0.2.4";
|
||||
edition = "2021";
|
||||
sha256 = "1mbp5navim2qr3x48lyvadqblcxc1dm0lqr0swrkkwy2qblvw3s6";
|
||||
authors = [
|
||||
"Eira Fransham <jackefransham@gmail.com>"
|
||||
];
|
||||
features = {
|
||||
"default" = [ "limit_128" ];
|
||||
};
|
||||
resolvedDefaultFeatures = [ "default" "limit_128" ];
|
||||
};
|
||||
"crypto-common" = rec {
|
||||
crateName = "crypto-common";
|
||||
version = "0.1.6";
|
||||
@@ -2987,6 +3044,39 @@ rec {
|
||||
];
|
||||
|
||||
};
|
||||
"fixed" = rec {
|
||||
crateName = "fixed";
|
||||
version = "1.30.0";
|
||||
edition = "2024";
|
||||
sha256 = "1xc205j0wx7wvll3nsp25jyqb9mjx4ypgaaq0kpcgiilg6bdlrn5";
|
||||
dependencies = [
|
||||
{
|
||||
name = "az";
|
||||
packageId = "az";
|
||||
}
|
||||
{
|
||||
name = "bytemuck";
|
||||
packageId = "bytemuck";
|
||||
}
|
||||
{
|
||||
name = "half";
|
||||
packageId = "half";
|
||||
usesDefaultFeatures = false;
|
||||
}
|
||||
{
|
||||
name = "typenum";
|
||||
packageId = "typenum";
|
||||
}
|
||||
];
|
||||
features = {
|
||||
"arbitrary" = [ "dep:arbitrary" ];
|
||||
"borsh" = [ "dep:borsh" ];
|
||||
"defmt" = [ "dep:defmt" ];
|
||||
"num-traits" = [ "dep:num-traits" ];
|
||||
"serde" = [ "dep:serde" ];
|
||||
"serde-str" = [ "serde" "serde/std" "std" ];
|
||||
};
|
||||
};
|
||||
"fluent" = rec {
|
||||
crateName = "fluent";
|
||||
version = "0.16.1";
|
||||
@@ -6057,6 +6147,48 @@ rec {
|
||||
features = {
|
||||
};
|
||||
};
|
||||
"half" = rec {
|
||||
crateName = "half";
|
||||
version = "2.7.1";
|
||||
edition = "2021";
|
||||
sha256 = "0jyq42xfa6sghc397mx84av7fayd4xfxr4jahsqv90lmjr5xi8kf";
|
||||
authors = [
|
||||
"Kathryn Long <squeeself@gmail.com>"
|
||||
];
|
||||
dependencies = [
|
||||
{
|
||||
name = "cfg-if";
|
||||
packageId = "cfg-if";
|
||||
}
|
||||
{
|
||||
name = "crunchy";
|
||||
packageId = "crunchy";
|
||||
target = { target, features }: ("spirv" == target."arch" or null);
|
||||
}
|
||||
{
|
||||
name = "zerocopy";
|
||||
packageId = "zerocopy";
|
||||
usesDefaultFeatures = false;
|
||||
features = [ "derive" "simd" ];
|
||||
}
|
||||
];
|
||||
devDependencies = [
|
||||
{
|
||||
name = "crunchy";
|
||||
packageId = "crunchy";
|
||||
}
|
||||
];
|
||||
features = {
|
||||
"arbitrary" = [ "dep:arbitrary" ];
|
||||
"bytemuck" = [ "dep:bytemuck" ];
|
||||
"default" = [ "std" ];
|
||||
"num-traits" = [ "dep:num-traits" ];
|
||||
"rand_distr" = [ "dep:rand" "dep:rand_distr" ];
|
||||
"rkyv" = [ "dep:rkyv" ];
|
||||
"serde" = [ "dep:serde" ];
|
||||
"std" = [ "alloc" ];
|
||||
};
|
||||
};
|
||||
"hashbrown 0.15.5" = rec {
|
||||
crateName = "hashbrown";
|
||||
version = "0.15.5";
|
||||
@@ -7758,6 +7890,24 @@ rec {
|
||||
};
|
||||
resolvedDefaultFeatures = [ "default" "min_sqlite_version_3_14_0" "pkg-config" "vcpkg" ];
|
||||
};
|
||||
"lights-core" = rec {
|
||||
crateName = "lights-core";
|
||||
version = "0.1.0";
|
||||
edition = "2021";
|
||||
src = lib.cleanSourceWith { filter = sourceFilter; src = ./bike-lights/core; };
|
||||
libName = "lights_core";
|
||||
dependencies = [
|
||||
{
|
||||
name = "az";
|
||||
packageId = "az";
|
||||
}
|
||||
{
|
||||
name = "fixed";
|
||||
packageId = "fixed";
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
"linux-raw-sys" = rec {
|
||||
crateName = "linux-raw-sys";
|
||||
version = "0.11.0";
|
||||
@@ -10834,6 +10984,62 @@ rec {
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
"simulator" = rec {
|
||||
crateName = "simulator";
|
||||
version = "0.1.0";
|
||||
edition = "2021";
|
||||
crateBin = [
|
||||
{
|
||||
name = "simulator";
|
||||
path = "src/main.rs";
|
||||
requiredFeatures = [ ];
|
||||
}
|
||||
];
|
||||
src = lib.cleanSourceWith { filter = sourceFilter; src = ./bike-lights/simulator; };
|
||||
dependencies = [
|
||||
{
|
||||
name = "async-std";
|
||||
packageId = "async-std";
|
||||
}
|
||||
{
|
||||
name = "cairo-rs";
|
||||
packageId = "cairo-rs";
|
||||
}
|
||||
{
|
||||
name = "fixed";
|
||||
packageId = "fixed";
|
||||
}
|
||||
{
|
||||
name = "gio";
|
||||
packageId = "gio";
|
||||
}
|
||||
{
|
||||
name = "glib";
|
||||
packageId = "glib";
|
||||
}
|
||||
{
|
||||
name = "gtk4";
|
||||
packageId = "gtk4";
|
||||
rename = "gtk";
|
||||
features = [ "v4_8" ];
|
||||
}
|
||||
{
|
||||
name = "libadwaita";
|
||||
packageId = "libadwaita";
|
||||
rename = "adw";
|
||||
features = [ "v1_2" ];
|
||||
}
|
||||
{
|
||||
name = "lights-core";
|
||||
packageId = "lights-core";
|
||||
}
|
||||
{
|
||||
name = "pango";
|
||||
packageId = "pango";
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
"siphasher" = rec {
|
||||
crateName = "siphasher";
|
||||
@@ -16594,7 +16800,7 @@ rec {
|
||||
"std" = [ "alloc" ];
|
||||
"zerocopy-derive" = [ "dep:zerocopy-derive" ];
|
||||
};
|
||||
resolvedDefaultFeatures = [ "simd" ];
|
||||
resolvedDefaultFeatures = [ "derive" "simd" "zerocopy-derive" ];
|
||||
};
|
||||
"zerocopy-derive" = rec {
|
||||
crateName = "zerocopy-derive";
|
||||
|
||||
@@ -3,7 +3,7 @@ resolver = "2"
|
||||
members = [
|
||||
# "authdb",
|
||||
# "bike-lights/core",
|
||||
# "bike-lights/simulator",
|
||||
"bike-lights/simulator",
|
||||
# "changeset",
|
||||
# "config",
|
||||
# "config-derive",
|
||||
|
||||
8
flake.lock
generated
8
flake.lock
generated
@@ -20,16 +20,16 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1740339700,
|
||||
"narHash": "sha256-cbrw7EgQhcdFnu6iS3vane53bEagZQy/xyIkDWpCgVE=",
|
||||
"lastModified": 1768773494,
|
||||
"narHash": "sha256-XsM7GP3jHlephymxhDE+/TKKO1Q16phz/vQiLBGhpF4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "04ef94c4c1582fd485bbfdb8c4a8ba250e359195",
|
||||
"rev": "77ef7a29d276c6d8303aece3444d61118ef71ac2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-24.11",
|
||||
"ref": "nixos-25.11",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
|
||||
175
flake.nix
175
flake.nix
@@ -2,18 +2,25 @@
|
||||
description = "Lumenescent Dreams Tools";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-24.11";
|
||||
nixpkgs.url = "nixpkgs/nixos-25.11";
|
||||
unstable.url = "nixpkgs/nixos-unstable";
|
||||
typeshare.url = "github:1Password/typeshare";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, unstable, typeshare, ... }:
|
||||
let
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
unstable,
|
||||
typeshare,
|
||||
...
|
||||
}:
|
||||
let
|
||||
version = builtins.string 0 8 self.lastModifiedDate;
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
in
|
||||
{
|
||||
devShell."x86_64-linux" =
|
||||
devShells."x86_64-linux".default =
|
||||
let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
pkgs-unstable = import unstable { system = "x86_64-linux"; };
|
||||
@@ -47,11 +54,78 @@
|
||||
pkgs.udev
|
||||
pkgs.wasm-pack
|
||||
pkgs.go-task
|
||||
pkgs.nixfmt
|
||||
typeshare.packages."x86_64-linux".default
|
||||
pkgs.nodePackages_latest.typescript-language-server
|
||||
];
|
||||
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
|
||||
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
|
||||
ENV = "dev";
|
||||
|
||||
shellHook = ''
|
||||
# Use the repository rust-toolchain file when present, otherwise default to 1.92.0
|
||||
if [ -f ./rust-toolchain ]; then
|
||||
# Extract just the channel value from the TOML file (e.g. channel = "1.92.0")
|
||||
TOOLCHAIN=$(grep -E '^[[:space:]]*channel' ./rust-toolchain | sed -E 's/.*"([^"]+)".*/\1/' | head -n1)
|
||||
|
||||
# Parse components and targets arrays (extract quoted strings). Result will be space-separated.
|
||||
COMPONENTS=$(grep -E '^[[:space:]]*components' ./rust-toolchain | sed -E 's/.*\[(.*)\].*/\1/' | grep -oE '"[^"]+"' | tr -d '"' | xargs echo)
|
||||
TARGETS=$(grep -E '^[[:space:]]*targets' ./rust-toolchain | sed -E 's/.*\[(.*)\].*/\1/' | grep -oE '"[^"]+"' | tr -d '"' | xargs echo)
|
||||
|
||||
if [ -z "$TOOLCHAIN" ]; then
|
||||
TOOLCHAIN="1.92.0"
|
||||
fi
|
||||
if [ -z "$COMPONENTS" ]; then
|
||||
COMPONENTS="cargo rustc rustfmt rust-analyzer clippy"
|
||||
fi
|
||||
if [ -z "$TARGETS" ]; then
|
||||
TARGETS="x86_64-unknown-linux-gnu wasm32-unknown-unknown thumbv6m-none-eabi"
|
||||
fi
|
||||
else
|
||||
TOOLCHAIN="1.92.0"
|
||||
COMPONENTS="cargo rustc rustfmt rust-analyzer clippy"
|
||||
TARGETS="x86_64-unknown-linux-gnu wasm32-unknown-unknown thumbv6m-none-eabi"
|
||||
fi
|
||||
|
||||
# Ensure we always include these helpful extras (best-effort); avoid duplicates by appending.
|
||||
EXTRA_COMPONENTS="cargo-nextest cargo-watch"
|
||||
for c in $EXTRA_COMPONENTS; do
|
||||
case " $COMPONENTS " in
|
||||
*" $c "*) : ;; # already present
|
||||
*) COMPONENTS="$COMPONENTS $c" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "[devShell] will ensure rustup toolchain: $TOOLCHAIN"
|
||||
echo "[devShell] will install components: $COMPONENTS"
|
||||
echo "[devShell] will add targets: $TARGETS"
|
||||
|
||||
export RUSTUP_HOME="$HOME/.rustup"
|
||||
export CARGO_HOME="$HOME/.cargo"
|
||||
|
||||
if command -v rustup >/dev/null 2>&1; then
|
||||
# Install the requested toolchain if missing. Ignore errors so shell still opens.
|
||||
rustup toolchain install "$TOOLCHAIN" --no-self-update || true
|
||||
|
||||
# Install components (best-effort; some toolchains may not expose all components)
|
||||
for comp in $COMPONENTS; do
|
||||
# trim possible commas/spaces
|
||||
comp=$(echo "$comp" | tr -d ',')
|
||||
rustup component add "$comp" --toolchain "$TOOLCHAIN" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Install targets
|
||||
for tgt in $TARGETS; do
|
||||
# trim possible commas/spaces
|
||||
tgt=$(echo "$tgt" | tr -d ',')
|
||||
rustup target add "$tgt" --toolchain "$TOOLCHAIN" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Set default toolchain (best-effort)
|
||||
rustup default "$TOOLCHAIN" >/dev/null 2>&1 || true
|
||||
else
|
||||
echo "[devShell] rustup not found in shell; please ensure pkgs.rustup is present"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
packages."x86_64-linux" =
|
||||
@@ -64,43 +138,92 @@
|
||||
pkgs.wrapGAppsHook4
|
||||
];
|
||||
|
||||
cargoOverrides = pkgs: pkgs.buildRustCrate.override {
|
||||
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
|
||||
gobject-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
gio-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
gdk-pixbuf-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
libadwaita-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
cargoOverrides =
|
||||
pkgs:
|
||||
pkgs.buildRustCrate.override {
|
||||
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
|
||||
gobject-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
gio-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
gdk-pixbuf-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
libadwaita-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
|
||||
dashboard = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
fitnesstrax = import ./fitnesstrax/app/override.nix { gtkNativeInputs = gtkNativeInputs; };
|
||||
otg-gtk = import ./otg/gtk/override.nix { gtkNativeInputs = gtkNativeInputs; };
|
||||
# Ensure rusqlite build scripts can find sqlite via pkg-config
|
||||
rusqlite =
|
||||
attrs:
|
||||
attrs.overrideAttrs (old: {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
|
||||
pkgs.pkg-config
|
||||
pkgs.sqlite
|
||||
];
|
||||
});
|
||||
|
||||
# Ensure rusqlite_migration build.rs can read the README and also has sqlite available.
|
||||
# Use overrideAttrs so preBuild runs in the final derivation.
|
||||
rusqlite_migration =
|
||||
attrs:
|
||||
attrs.overrideAttrs (
|
||||
old:
|
||||
let
|
||||
prevNBI = old.nativeBuildInputs or [ ];
|
||||
prevPre = old.preBuild or "";
|
||||
in
|
||||
{
|
||||
nativeBuildInputs = prevNBI ++ [
|
||||
pkgs.pkg-config
|
||||
pkgs.sqlite
|
||||
];
|
||||
|
||||
# Run before build so build.rs can see CARGO_PKG_README.
|
||||
preBuild = ''
|
||||
# If the unpacked crate sources contain README.md, point the build script at it.
|
||||
if [ -n "${attrs.src}" ] && [ -f "${attrs.src}/README.md" ]; then
|
||||
export CARGO_PKG_README="${attrs.src}/README.md"
|
||||
elif [ -f "$PWD/README.md" ]; then
|
||||
# fallback to current working directory (extracted source)
|
||||
export CARGO_PKG_README="$PWD/README.md"
|
||||
fi
|
||||
|
||||
# Preserve any previous preBuild content from the original derivation.
|
||||
${prevPre}
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
||||
# Ensure GTK-based crates get the GTK native inputs
|
||||
dashboard = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
fitnesstrax = import ./fitnesstrax/app/override.nix { gtkNativeInputs = gtkNativeInputs; };
|
||||
simulator = attrs: { nativeBuildInputs = gtkNativeInputs; };
|
||||
otg-gtk = import ./otg/gtk/override.nix { gtkNativeInputs = gtkNativeInputs; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cargo_nix = pkgs.callPackage ./Cargo.nix {
|
||||
nixpkgs = nixpkgs;
|
||||
buildRustCrateForPkgs = cargoOverrides;
|
||||
};
|
||||
|
||||
in rec {
|
||||
# cyber-slides = cargo_nix.workspaceMembers.cyber-slides.build;
|
||||
in
|
||||
rec {
|
||||
cyberpunk-splash = cargo_nix.workspaceMembers.cyberpunk-splash.build;
|
||||
dashboard = cargo_nix.workspaceMembers.dashboard.build;
|
||||
# file-service = cargo_nix.workspaceMembers.file-service.build;
|
||||
fitnesstrax = cargo_nix.workspaceMembers.fitnesstrax.build;
|
||||
l10n-db = cargo_nix.workspaceMembers.l10n-db.build;
|
||||
# otg-gtk = cargo_nix.workspaceMembers.otg-gtk.build;
|
||||
|
||||
# visions-server is provided by crate2nix workspace members
|
||||
visions-server = cargo_nix.workspaceMembers."visions-server".build;
|
||||
|
||||
# visions-server is provided by crate2nix workspace members
|
||||
simulator = cargo_nix.workspaceMembers.simulator.build;
|
||||
|
||||
all = pkgs.symlinkJoin {
|
||||
name = "all";
|
||||
paths = [
|
||||
# cyber-slides
|
||||
cyberpunk-splash
|
||||
dashboard
|
||||
# file-service
|
||||
fitnesstrax
|
||||
l10n-db
|
||||
# otg-gtk
|
||||
cyberpunk-splash
|
||||
dashboard
|
||||
fitnesstrax
|
||||
l10n-db
|
||||
visions-server
|
||||
simulator
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
48
plan.md
Normal file
48
plan.md
Normal file
@@ -0,0 +1,48 @@
|
||||
Goal: Create a new flake.nix file which provides a shell for Rust development and build instructions for multiple Rust applications.
|
||||
|
||||
# The Shell
|
||||
|
||||
The shell is an interactive environment containing all of the tools commonly used for Rust development. These tools are:
|
||||
|
||||
- clang
|
||||
- trunk
|
||||
- glib
|
||||
- gtk4
|
||||
- libadwaita
|
||||
- librsvg
|
||||
- openssl
|
||||
- pkg-config
|
||||
- rustup
|
||||
- sqlite
|
||||
- go-task
|
||||
|
||||
# The Rust toolchain
|
||||
|
||||
The shell environment specifies that we will install rustup. I want to control Rust versions through the `rust-toolchain` file. The file should
|
||||
- use channel 1.92.0
|
||||
- include the targets x86_64-unknown-linux-gnu, wasm32-unknown-unknown, and thumbv6m-none-eabi
|
||||
- install the components cargo, rustc, rustfmt, rust-analyzer, clippy, cargo-nextest, and cargo-watch
|
||||
|
||||
# Build and distribution instructions
|
||||
|
||||
The following packages should, by default, be built for the host platform. There should also be a parameter which allows the user to specify any other platform supported by Rust and Nix.
|
||||
|
||||
- bike-lights/simulator
|
||||
- visions__build/bike-lights/simulator/Cargo.toml
|
||||
- dependencies: pkg-config, gtk4, libadwaita
|
||||
- cyberpunk-splash
|
||||
- visions__build/cyberpunk-splash/Cargo.toml
|
||||
- dependencies: pkg-config, gtk4, libadwaita
|
||||
- dashboard
|
||||
- visions__build/dashboard/Cargo.toml
|
||||
- dependencies: pkg-config, gtk4, libadwaita, openssl
|
||||
- fitnesstrax
|
||||
- visions__build/fitnesstrax/app/Cargo.toml
|
||||
- dependencies: pkg-config, gtk4, libadwaita
|
||||
- additional files: resources/fitnesstrax.desktop, resources/com.luminescent-dreams.fitnesstrax.gschema.xml
|
||||
- The fitnesstrax installation should install the desktop and gschema.xml files to their correct locations. It should include a launcher script that sets up paths for a GTK application.
|
||||
- visions-server
|
||||
- visions__build/visions/server/Cargo.toml
|
||||
- dependencies: openssl, sqlite
|
||||
|
||||
The following package should always be cross-compiled for wasm32-unknown-unknown: visions-ui. This package will never be installed through Nix. The Cargo.toml for this project is visions__build/visions/ui/Cargo.toml.
|
||||
@@ -1,5 +1,3 @@
|
||||
cargo-features = ["edition2024"]
|
||||
|
||||
[package]
|
||||
name = "scripts"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
cargo-features = ["edition2024"]
|
||||
|
||||
[package]
|
||||
name = "visions-core"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name = "visions-ui"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
# crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
async-std.workspace = true
|
||||
|
||||
Reference in New Issue
Block a user