···11+{ lib }:
22+/**
33+ Override unfree licenses to free ones in a derivation.
44+55+ This function takes a derivation and replaces any unfree license with lib.licenses.free.
66+ Note: This only works for simple packages. Complex packages with unfree dependencies
77+ in their build process (like firefox-bin -> firefox-bin-unwrapped) cannot be handled
88+ this way and need other approaches.
99+1010+ # Example
1111+1212+ ```nix
1313+ halalify pkgs.someUnfreePackage
1414+ ```
1515+*/
1616+drv:
1717+if !lib.isDerivation drv then
1818+ drv
1919+else
2020+ let
2121+ # Helper to check if a license is unfree
2222+ isUnfreeLicense = license: lib.isAttrs license && license ? free && !license.free;
2323+2424+ # Helper to make a license free
2525+ makeFreeLicense =
2626+ license:
2727+ if isUnfreeLicense license then
2828+ lib.licenses.free
2929+ else if lib.isList license then
3030+ map makeFreeLicense license
3131+ else
3232+ license;
3333+ in
3434+ drv.overrideAttrs (old: {
3535+ # Override the license
3636+ meta =
3737+ (old.meta or { })
3838+ // lib.optionalAttrs (old.meta ? license) {
3939+ license = makeFreeLicense old.meta.license;
4040+ };
4141+ })
···11+# CLAUDE.md
22+33+This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44+55+## Instructions
66+77+- Use `--log-format bar-with-logs` with Nix for improved build log output.
88+- Add new untracked files in Nix flakes with `git add`.
99+- Format code with `nix fmt` if available.
1010+- Write shell scripts that pass ShellCheck.
1111+- Write Python code for 3.12 that conforms to `ruff format` and passes `ruff check`.
1212+- Always test/lint/format your code before committing.
1313+- Add debug output or unit tests when troubleshooting.
1414+- Avoid mocking in tests.
1515+- Use the `gh` tool to interact with GitHub.
1616+- Use `nix-locate` to find packages by file path.
1717+- Use `nix run` to execute applications that are not installed.
1818+- Do not include "claude" in commit messages.
1919+- Use `nix eval` instead of `nix flake show` to look up attributes in a flake.
2020+- Use tmux-mcp for long running tasks, use a session with a claude- prefix, create a session if you can't find any one that is idle
2121+- Use git-mcp for advanced git operations like interactive staging, stash management, and bisecting
2222+- Take extra care that we don't commit lines with trailing whitespaces