(feat): improve iota thingy

This commit is contained in:
Alois 2026-07-25 13:44:48 +02:00
commit d9cfceacc7
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24

View file

@ -42,13 +42,11 @@
commonNativeBuildInputs = with pkgs; [cmake perl pkg-config]; commonNativeBuildInputs = with pkgs; [cmake perl pkg-config];
in { in {
packages = { packages = {
default = self'.packages.iota-daemon; default = pkgs.rustPlatform.buildRustPackage {
pname = "iota";
iota-daemon = pkgs.rustPlatform.buildRustPackage {
pname = "iota-daemon";
version = "0.1.0"; version = "0.1.0";
src = ./.; src = ./.;
cargoBuildFlags = ["-p" "iota-daemon"]; cargoBuildFlags = ["-p" "iota" "-p" "iota-daemon"];
cargoLock = { cargoLock = {
lockFile = ./Cargo.lock; lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true; allowBuiltinFetchGit = true;
@ -56,6 +54,12 @@
nativeBuildInputs = commonNativeBuildInputs; nativeBuildInputs = commonNativeBuildInputs;
buildInputs = commonBuildInputs; buildInputs = commonBuildInputs;
dontUseCmakeConfigure = true; dontUseCmakeConfigure = true;
passthru.dataDir = "/var/lib/iota";
};
iota-daemon = self'.packages.default.overrideAttrs (old: {
pname = "iota-daemon";
cargoBuildFlags = ["-p" "iota-daemon"];
postInstall = '' postInstall = ''
for f in $out/bin/*; do for f in $out/bin/*; do
if [ "$(basename "$f")" != "iota-daemon" ]; then if [ "$(basename "$f")" != "iota-daemon" ]; then
@ -63,33 +67,22 @@
fi fi
done done
''; '';
passthru.dataDir = "/var/lib/iota"; });
};
iota-ui = pkgs.rustPlatform.buildRustPackage { iota-ui = self'.packages.default.overrideAttrs (old: {
pname = "iota-ui"; pname = "iota-ui";
version = "0.1.0";
src = ./.;
cargoBuildFlags = ["-p" "iota"]; cargoBuildFlags = ["-p" "iota"];
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
nativeBuildInputs = commonNativeBuildInputs;
buildInputs = commonBuildInputs;
dontUseCmakeConfigure = true;
postInstall = '' postInstall = ''
for f in $out/bin/*; do for f in $out/bin/*; do
if [ "$(basename "$f")" != "iota" ]; then if [ "$(basename "$f")" != "iota" ]; then
rm "$f" rm "$f"
fi fi
done done
# Rename to avoid confusion
if [ -f "$out/bin/iota" ]; then if [ -f "$out/bin/iota" ]; then
mv "$out/bin/iota" "$out/bin/iota-ui" mv "$out/bin/iota" "$out/bin/iota-ui"
fi fi
''; '';
}; });
}; };
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
@ -106,7 +99,7 @@
... ...
}: let }: let
cfg = config.services.iota; cfg = config.services.iota;
defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.iota-daemon or (throw "iota: no pre-built package for system ${pkgs.stdenv.hostPlatform.system}"); defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default or (throw "iota: no pre-built package for system ${pkgs.stdenv.hostPlatform.system}");
configFormat = pkgs.formats.yaml {}; configFormat = pkgs.formats.yaml {};
configFile = configFile =