Skip to content

numbat: add initFile #7159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

AyushmaanAggarwal
Copy link

This adds the option initFile for initialization of numbat shell with custom units, functions and constants

Description

Numbat has an optional ~/.config/numbat/init.nbt to define custom functions, constants, and units. This PR adds a string option to insert text into that file.

Checklist

  • Change is backwards compatible.

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt-rfc-style keep-sorted --run treefmt.

  • Code tested through nix-shell --pure tests -A run.all
    or nix build --reference-lock-file flake.lock ./tests#test-all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

@Aehmlo

This adds the option initFile for initialization of numbat shell with
custom units, functions and constants
@AyushmaanAggarwal
Copy link
Author

This is my first pull request to a nixos project, so if there is any formatting or style issues, please let me know

@Aehmlo
Copy link
Contributor

Aehmlo commented May 30, 2025

Thanks for the PR! Looks pretty good to me overall; with the suggested change(s), I think we should be good to merge.

Added the new types.sourceFileOrLines feature to allow for a declared
source file init.nbt
@AyushmaanAggarwal AyushmaanAggarwal requested a review from Aehmlo May 30, 2025 21:33
This reverts commit c8a2905 as a
variable of type sourceFileOrLines assigns source to null which is
incompatible with home.file.initFile.source being an absolute path.
This commit fixes the broken tests
Copy link
Collaborator

@teto teto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds 100 lines of code for something any user can do with xdg.configFile."numbat/init.nbt".text = ....
The option is not used in the module so I would say it's an unnecessary PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants