- Rename crate from dynu-monitor to ddns-monitor - Add flake.nix: pinned Rust stable (rust-overlay), devShell with cargo-watch, cargo-nextest, cargo-audit, curl, jq; package and checks outputs scaffolded - Update .gitignore: cover Rust/Nix build artefacts, secrets, runtime state files (state.json, *.jsonl), editor cruft; keep flake.lock tracked - Rewrite README.md: reflects broadened multi-provider scope, architecture overview, dev-shell quick start, config example, NixOS integration plan, invariants - Add ROADMAP.md: 10-phase plan from cleanup through additional providers; fan-out semantics and partial-success policy documented - Fix models.rs: correct IpDiscoveryResult syntax error, upgrade types to Option<usize> / Ipv4Addr, add doc comments - Update main.rs: scaffold stub that initialises logging and exits cleanly instead of hello-world placeholder - Add Cargo.toml dependencies through Phase 5: serde, serde_json, toml, reqwest (blocking), thiserror, log, env_logger, mockito cargo check: passes with only expected dead_code warnings
122 lines
4.3 KiB
Nix
122 lines
4.3 KiB
Nix
{
|
|
description = "ddns-monitor — provider-agnostic DDNS monitor with plugin architecture";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
# Pinned Rust toolchain — gives us stable + clippy + rustfmt + rust-analyzer
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, rust-overlay, ... }:
|
|
let
|
|
system = "x86_64-linux";
|
|
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [ rust-overlay.overlays.default ];
|
|
};
|
|
|
|
# Pin to stable Rust. Edit the date to roll forward.
|
|
# rustc, cargo, clippy, rustfmt, and rust-analyzer are all included.
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
|
|
};
|
|
|
|
# Shared native build inputs used by both the devShell and the package
|
|
nativeBuildInputs = with pkgs; [
|
|
rustToolchain
|
|
pkg-config
|
|
];
|
|
|
|
# Runtime / link-time dependencies
|
|
buildInputs = with pkgs; [
|
|
openssl # reqwest TLS backend
|
|
];
|
|
|
|
in
|
|
{
|
|
# ── Development shell ─────────────────────────────────────────────────────
|
|
# Enter with: nix develop
|
|
devShells.${system}.default = pkgs.mkShell {
|
|
inherit nativeBuildInputs buildInputs;
|
|
|
|
packages = with pkgs; [
|
|
# Linting & formatting (also available via rustToolchain, listed
|
|
# here for clarity)
|
|
cargo-watch # cargo watch -x check -- live recompile on save
|
|
cargo-nextest # faster test runner (drop-in for cargo test)
|
|
|
|
# Dependency auditing
|
|
cargo-audit
|
|
|
|
# Useful during DDNS API development
|
|
curl
|
|
jq
|
|
];
|
|
|
|
# Point OpenSSL build scripts at the Nix store paths
|
|
OPENSSL_NO_VENDOR = "1";
|
|
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
|
|
|
shellHook = ''
|
|
echo ""
|
|
echo " ddns-monitor dev shell"
|
|
echo " ─────────────────────────────────────────────"
|
|
echo " rustc $(rustc --version)"
|
|
echo " cargo $(cargo --version)"
|
|
echo ""
|
|
echo " Useful commands:"
|
|
echo " cargo build compile the binary"
|
|
echo " cargo test run unit tests"
|
|
echo " cargo nextest run run tests with nextest"
|
|
echo " cargo watch -x check live check on save"
|
|
echo " cargo audit scan dependencies for CVEs"
|
|
echo " cargo clippy lint"
|
|
echo " cargo fmt format"
|
|
echo ""
|
|
'';
|
|
};
|
|
|
|
# ── Package ───────────────────────────────────────────────────────────────
|
|
# Build the binary: nix build
|
|
packages.${system} = rec {
|
|
ddns-monitor = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "ddns-monitor";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
|
|
# Update this hash after running: nix build 2>&1 | grep "got:"
|
|
cargoHash = pkgs.lib.fakeHash;
|
|
|
|
inherit nativeBuildInputs buildInputs;
|
|
|
|
meta = with pkgs.lib; {
|
|
description = "Provider-agnostic DDNS monitor with plugin architecture";
|
|
license = licenses.unlicense;
|
|
maintainers = [ ];
|
|
};
|
|
};
|
|
|
|
default = ddns-monitor;
|
|
};
|
|
|
|
# ── Checks ────────────────────────────────────────────────────────────────
|
|
# Run with: nix flake check
|
|
checks.${system} = {
|
|
# cargo test inside a sandbox — proves tests pass without network/fs
|
|
cargo-test = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "ddns-monitor-tests";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
cargoHash = pkgs.lib.fakeHash;
|
|
inherit nativeBuildInputs buildInputs;
|
|
doCheck = true;
|
|
};
|
|
};
|
|
};
|
|
}
|