[Clean] Remove legacy TTP flake configuration

This commit is contained in:
Alois 2026-07-20 18:56:49 +02:00
commit 9d67824f28
2 changed files with 265 additions and 265 deletions

19
flake.lock generated
View file

@ -53,8 +53,7 @@
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"ttp": "ttp"
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
@ -76,22 +75,6 @@
"repo": "rust-overlay",
"type": "github"
}
},
"ttp": {
"flake": false,
"locked": {
"lastModified": 1780494955,
"narHash": "sha256-i2VRRF6yNips3c4JHgfvmvMxb0HTkTCn69lmsKZLHRw=",
"ref": "refs/heads/main",
"rev": "23438fa8f884e6ad0d32ca1004c0dedcce0cc8d2",
"revCount": 125,
"type": "git",
"url": "https://git.methanium.net/tensamin/ttp.git"
},
"original": {
"type": "git",
"url": "https://git.methanium.net/tensamin/ttp.git"
}
}
},
"root": "root",

101
flake.nix
View file

@ -8,18 +8,14 @@
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
ttp = {
url = "git+https://git.methanium.net/tensamin/ttp.git";
flake = false;
};
};
outputs = inputs @ {
outputs =
inputs@{
self,
nixpkgs,
flake-parts,
rust-overlay,
ttp,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
@ -30,20 +26,28 @@
"aarch64-darwin"
];
perSystem = {
perSystem =
{
self',
pkgs,
system,
...
}: let
}:
let
rustPkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustToolchain = rustPkgs.rust-bin.stable.latest.default.override {
extensions = ["rust-src" "rust-analyzer" "clippy" "rustfmt"];
extensions = [
"rust-src"
"rust-analyzer"
"clippy"
"rustfmt"
];
};
in {
in
{
packages = {
default = self'.packages.iota;
iota = pkgs.rustPlatform.buildRustPackage {
@ -54,14 +58,16 @@
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
nativeBuildInputs = with pkgs; [cmake perl pkg-config];
buildInputs = with pkgs; [openssl sqlite];
nativeBuildInputs = with pkgs; [
cmake
perl
pkg-config
];
buildInputs = with pkgs; [
openssl
sqlite
];
dontUseCmakeConfigure = true;
preConfigure = ''
if [ -d ../cargo-vendor-dir/ttp-core-0.1.0 ]; then
cp ${ttp}/ttp-codec.json ../cargo-vendor-dir/ttp-codec.json
fi
'';
postInstall = ''
mv $out/bin/iota-core $out/bin/iota
for f in $out/bin/*; do
@ -75,29 +81,44 @@
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [rustToolchain git cmake perl pkg-config];
buildInputs = with pkgs; [openssl sqlite];
nativeBuildInputs = with pkgs; [
rustToolchain
git
cmake
perl
pkg-config
];
buildInputs = with pkgs; [
openssl
sqlite
];
};
};
flake = {
nixosModules.default = {
nixosModules.default =
{
config,
pkgs,
lib,
...
}: let
}:
let
cfg = config.services.iota;
defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default 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}");
configFile =
if cfg.settingsFile != null
then cfg.settingsFile
else pkgs.writeText "iota-config.json" (builtins.toJSON cfg.settings);
if cfg.settingsFile != null then
cfg.settingsFile
else
pkgs.writeText "iota-config.json" (builtins.toJSON cfg.settings);
descriptionText = "Tensamin Iota";
#+ lib.optionalString cfg.useTmux " (attach TUI: tmux -S ${cfg.dataDir}/tmux.sock attach -t iota)";
in {
in
{
options.services.iota = {
enable = lib.mkEnableOption "Enable the Iota service.";
@ -132,12 +153,6 @@
description = "Whether to open the firewall for ports used by Iota.";
};
ttpBind = lib.mkOption {
type = lib.types.str;
default = "0.0.0.0";
description = "IP address to bind the TTP/QUIC server to.";
};
bindAddress = lib.mkOption {
type = lib.types.str;
default = "0.0.0.0";
@ -181,7 +196,8 @@
users.groups.iota = { };
systemd.services.iota = let
systemd.services.iota =
let
iotaTmuxCmd = pkgs.writeShellScript "iota-tmux-cmd" ''
mkdir -p ${cfg.dataDir}
echo "[$(date)] Running Iota..."
@ -193,21 +209,20 @@
read -r -n 1
exit $status
'';
in {
in
{
description = descriptionText;
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig =
{
serviceConfig = {
Type = "simple";
User = "iota";
Group = "iota";
WorkingDirectory = cfg.dataDir;
ExecStart =
if cfg.useTmux
then
if cfg.useTmux then
pkgs.writeShellScript "iota-start" ''
set -e
export TMUX_TMPDIR=${cfg.dataDir}
@ -227,10 +242,12 @@
done
echo "[iota-start] tmux session ended"
''
else "${cfg.package}/bin/iota";
else
"${cfg.package}/bin/iota";
ExecStartPre = [
("+"
(
"+"
+ pkgs.writeShellScript "iota-setup" ''
mkdir -p ${cfg.dataDir}/certs
@ -240,7 +257,8 @@
install -m 644 ${configFile} ${cfg.dataDir}/config.json
chown -R iota:iota ${cfg.dataDir}
'')
''
)
];
Restart = "always";
@ -262,7 +280,6 @@
LockPersonality = true;
MemoryDenyWriteExecute = true;
Environment = [
"TTP_BIND=${cfg.ttpBind}"
"BIND_ADDRESS=${cfg.bindAddress}"
];
}