Skip to content

Add Nix flake for reproducible builds#136

Open
randomizedcoder wants to merge 4 commits intoModelioOpenSource:masterfrom
randomizedcoder:nix
Open

Add Nix flake for reproducible builds#136
randomizedcoder wants to merge 4 commits intoModelioOpenSource:masterfrom
randomizedcoder:nix

Conversation

@randomizedcoder
Copy link

Summary

  • Add a Nix flake providing reproducible source builds of Modelio 5.4.1 using a two-phase fixed-output derivation (FOD) approach for Maven/Tycho dependency caching
  • Include dev shell (nix develop), OCI container image (nix build .#container), xvfb-based smoke test (nix flake check), and nix run support
  • Add nix/README.md documenting usage, architecture, and design decisions

What's included

File Purpose
flake.nix Flake entry point with formatter
flake.lock Pinned nixpkgs 24.11 + flake-utils
nix/package.nix Two-phase source build (FOD + offline build)
nix/shell.nix Dev shell with Maven, JDK 11, native libs
nix/container.nix Minimal OCI container image
nix/test.nix Smoke test (binary exists, JRE linked, process starts)
nix/README.md Documentation

Test plan

  • nix build completes successfully
  • nix run launches Modelio
  • nix develop provides working Maven + JDK environment
  • nix build .#container produces loadable OCI image
  • nix flake check passes smoke tests
  • nix fmt runs cleanly (idempotent)

🤖 Generated with Claude Code

randomizedcoder and others added 3 commits March 23, 2026 14:12
Adds a Nix flake with:
- Source build using two-phase FOD for Maven/Tycho dependency caching
- Dev shell with Maven, JDK 11, native libs, and auto-generated toolchains.xml
- OCI container image via dockerTools.buildLayeredImage
- xvfb-based smoke test
- nixfmt formatter
- Documentation in nix/README.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add modelio-src flake input pinned to commit 53eb603
- Use pinned source for mvnDeps FOD instead of local working tree
- Local edits no longer invalidate the maven dependency cache
- Update pin with: nix flake update modelio-src

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Refactoring:
- Extract shared values (version, toolchains.xml, build.properties fixup,
  runtime libs) into nix/lib.nix — eliminates 3x toolchains duplication
- Split FOD into nix/maven-deps.nix — package.nix is now main build only
- Wire mvnDeps as separate callPackage in flake.nix

Reproducibility improvements:
- Delete maven-metadata-*.xml in FOD (contains <lastUpdated> timestamps)
- Set -Dproject.build.outputTimestamp=1980-01-01T00:00:02Z for deterministic
  JARs, following nixpkgs convention (scenebuilder, nzbhydra2, etc.)
- Update FOD hash to reflect new cleanup

New features:
- Add nix/container-run.nix — one-shot script to load and run the Docker
  container with X11 forwarding, config persistence, and workspace mount
- Expose as `nix run .#container-run`

Housekeeping:
- Add /result to .gitignore (Nix build output symlink)
- Add usage comments to top of flake.nix
- Fix nixfmt deprecation warning (nixfmt → nixfmt-classic)
- Update nix/README.md with new file layout, reproducibility strategy
  section, and container-run documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump nixpkgs input from nixos-24.11 to nixos-25.11
- Rename webkitgtk_4_0 → webkitgtk_4_1 (removed upstream)
- Apply nix fmt
- Verified: nix build, nix flake check, nix run .#container-run

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants