Skip to content

Change nix to flake parts#3305

Closed
disassembler wants to merge 30 commits intoinput-output-hk:developfrom
DripDropz:sl/flake-parts
Closed

Change nix to flake parts#3305
disassembler wants to merge 30 commits intoinput-output-hk:developfrom
DripDropz:sl/flake-parts

Conversation

@disassembler
Copy link
Copy Markdown
Contributor

This PR is based on the mithril branch and cleans up the nix flake significantly by switching to flake-parts.

It also introduces a default formatter.

Todos

  • TODO

Screenshots

Testing Checklist


Review Checklist

Basics

  • PR assigned to the PR author(s)
  • input-output-hk/daedalus-dev and input-output-hk/daedalus-qa assigned as PR reviewers
  • If there are UI changes, Alexander Rukin assigned as an additional reviewer
  • PR has appropriate labels (release-vNext, feature/bug/chore, WIP)
  • PR link is added to a Jira ticket, ticket moved to In Review
  • PR is updated to the most recent version of the target branch (and there are no conflicts)
  • PR has a good description that summarizes all changes
  • PR contains screenshots (in case of UI changes)
  • CHANGELOG entry has been added to the top of the appropriate section (Features, Fixes, Chores) and is linked to the correct PR on GitHub
  • There are no missing translations (running yarn manage:translations produces no changes)
  • Text changes are proofread and approved (Jane Wild / Amy Reeve)
  • Japanese text changes are proofread and approved (Junko Oda)
  • Storybook works and no stories are broken (yarn storybook)
  • In case of dependency changes yarn.lock file is updated

Code Quality

  • Important parts of the code are properly commented and documented
  • Code is properly typed with typescript types
  • React components are split-up enough to avoid unnecessary re-renderings
  • Any code that only works in main process is neatly separated from components

Testing

  • New feature/change is covered by acceptance tests
  • New feature/change is manually tested and approved by QA team
  • All existing acceptance tests are still up-to-date
  • New feature/change is covered by Daedalus Testing scenario
  • All existing Daedalus Testing scenarios are still up-to-date

After Review

  • Update Slack QA thread by marking it with a green checkmark

AndrewWestberg and others added 19 commits February 19, 2026 16:56
- Add nixpkgsJs input pinned to nixpkgs-22.11-darwin
- Use pkgsJs for electron and native module builds to avoid glibc version mismatch
- Apply glibc-electron-loader.patch to pkgsJs.glibc for electron LD_PLEASE_INTERPRET support
- Update node_modules and daedalusJs derivations to use pkgsJs.stdenv
- Improve source filtering to exclude .direnv, .agent, node_modules, etc.

This fixes the 'GLIBC_2.38 not found' error when running daedalus-preview
by ensuring native Node.js modules are built with the same glibc version
as the bundled electron.
Mithril provides snapshots in in-memory format, not LMDB. The conversion
step was incorrectly converting them TO LMDB format, which was unnecessary
and causing issues.

Skip the _convertSnapshot step entirely to use the snapshots as-is.
- Add .envrc for automatic nix flake shell activation
- Ignore .direnv directory and nix build results
- Ignore .agent/settings.local.json for per-user agent settings
Fixes GLIBC_2.39 mismatch errors on non-NixOS systems when running
yarn dev. The native node modules (usb_bindings.node, HID.node,
detection.node) are now built and patched against libraries from
nixpkgs-22.11 (glibc 2.35) to match the electron bundle.

Changes:
- devshells.nix: Use pkgsJs for libusb1, systemd, and compiler runtime
- x86_64-windows.nix: Use pkgsJs.libusb1 for consistency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Allow selecting devShell cluster via environment variable:
  export DAEDALUS_CLUSTER=preprod  # or mainnet, preview, selfnode
  direnv reload

Defaults to preprod if not set.
- Add --disable-setuid-sandbox and --no-sandbox flags to match production
- Disable React Refresh plugin which has Electron compatibility issues
- Disable React Refresh transform in SWC config

These changes fix runtime errors in the development environment.
- Add bin/ directories with hard links to installers for all platforms
- Set meta.mainProgram to enable nix run .#installer-{cluster}
- Replace deprecated runCommandNoCC with runCommand

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The apple_sdk_11_0 was removed in nixpkgs-25.11. Use nixpkgs-22.11
(pkgsJs) for Darwin frameworks to maintain compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
GHC 8.10.7 (ghc8107) was removed in nixpkgs-25.11, so the Windows
installer build needs to use pkgsJs (nixpkgs-22.11) where it still exists.
disassembler and others added 4 commits February 21, 2026 11:06
…uilds

Use pkgsJs (nixpkgs-22.11) instead of pkgs (nixpkgs-25.11) for:
- Darwin: darwin.cctools, xcbuild, python3 to avoid clang compatibility
  issues with node-addon-api (enum value -1 error)
- Windows: haskell.lib.justStaticExecutables to avoid disallowGhcReference
  argument incompatibility in Haskell generic-builder

These components require the older toolchain from nixpkgs-22.11 to build
successfully after the nixpkgs-25.11 upgrade.
Use pkgsJs.stdenv.mkDerivation instead of pkgs.stdenv.mkDerivation for
the node_modules derivation on Darwin. This ensures the entire build
environment (compiler, linker, and build tools) comes from nixpkgs-22.11,
avoiding both clang enum compatibility issues and linker errors with
native node modules.

Also consolidate darwin.cctools, xcbuild, and python3 to use pkgsJs for
consistency.
Add -Wno-enum-constexpr-conversion flag to allow blake-hash and other
native modules to compile when cross-compiling x86_64-darwin on Apple
Silicon builders. The node-addon-api uses -1 as a sentinel enum value
which newer clang versions reject as invalid.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Previously, npm_config_cxxflags was only set as a derivation attribute but not
explicitly exported in the buildPhase script. This caused electron-rebuild on
native aarch64-darwin builds to not pick up the -Wno-enum-constexpr-conversion
flag, resulting in blake-hash compilation errors.

The export now ensures both x86_64-darwin cross-compilation and native
aarch64-darwin builds properly pass the flag to node-gyp/electron-rebuild.
Add explicit export of npm_config_cxxflags before electron-rebuild calls to
ensure the -Wno-enum-constexpr-conversion flag is passed to node-gyp. This
fixes blake-hash compilation errors on aarch64-darwin with newer clang that
rejects enum constexpr conversions.
@disassembler disassembler force-pushed the sl/flake-parts branch 4 times, most recently from 789b0e1 to 006d010 Compare February 22, 2026 01:40
Changes:
- Updated node_modules derivation to use -Wno-error instead of
  -Wno-enum-constexpr-conversion for npm_config_cxxflags
- Updated daedalus derivation to match
- Updated rebuild-native-modules.sh script to export the flag with multiple
  variations for compatibility

The -Wno-enum-constexpr-conversion flag is not supported by older clang
versions in nixpkgs-22.11 (used for aarch64-darwin native builds). Using
-Wno-error makes all warnings non-fatal and works across all clang versions,
fixing blake-hash compilation errors.

This fix applies to:
- x86_64-darwin (cross-compiled on aarch64)
- aarch64-darwin (native builds)

Fixes the enum constexpr conversion error in node-addon-api header that
occurs when compiling native Node.js modules with newer clang that enforces
stricter enum type checking.
disassembler and others added 2 commits February 21, 2026 20:52
Native module compilation during electron-rebuild fails because newer
clang enforces strict enum checking. Environment variables don't
propagate through the electron-rebuild -> node-gyp -> make -> clang++
chain.

Solution: Create a clang++ wrapper that automatically adds -Wno-error
to all compiler invocations. This intercepts the compiler calls from
make during native module builds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…mpilation

Switch from pkgs.stdenv (nixpkgs-25.11) to pkgsJs.stdenv (nixpkgs-22.11)
for Darwin daedalus derivation to fix native module compilation issues.

Root cause:
- Darwin native modules (bigint-buffer, blake-hash, etc.) fail to compile
  with the newer clang 21.1.7 from nixpkgs-25.11
- These modules were built/tested with the older toolchain from
  nixpkgs-22.11-darwin
- Using mismatched stdenv and darwin frameworks causes compilation errors

Solution:
- Use pkgsJs.stdenv.mkDerivation for the main daedalus package
- This provides the older, stable Darwin toolchain that native modules expect
- Aligns with existing use of pkgsJs.darwin frameworks and pkgsJs.python3
- Removes the clang++ wrapper that was causing 'Argument list too long' errors

The wrapper approach is no longer needed because:
- CXXFLAGS=-Wno-error is set via environment variables in patchElectronRebuild
- Using the correct stdenv avoids the enum-constexpr issues entirely
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