Skip to content
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

feat: expose AutoFirma configuration via HM module #67

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nilp0inter
Copy link
Collaborator

These changes implement a new programs.autofirma.config submodule to configure AutoFirma via Home Manager.

To achieve this in an automated way, several new components are in place:

  • XMLDoclet: A Java plugin included in pom.xml to export Javadoc in XML format.
  • properties-to-json: A custom Python script that combines the information from the aforementioned Javadoc and a properties file present in the source code. This file contains the parameters that can be set in the AutoFirma configuration.

During the compilation process, the Javadoc is generated and then transformed into a JSON file containing a list of configuration settings with their default values and descriptions.

The Home Manager module reads this JSON file and builds the config submodule.

If the user modifies any of the values under config, a configuration file is generated and linked to the path that AutoFirma expects. To prevent AutoFirma from overwriting the configuration (which happens every time the configuration dialog is opened), the directory containing the link has its permissions modified to forbid the user from writing.

These changes implement a new `programs.autofirma.config` submodule to configure AutoFirma via Home Manager.

To achieve this in an automated way, several new components are in place:
- **XMLDoclet**: A Java plugin included in `pom.xml` to export Javadoc in XML format.
- **properties-to-json**: A custom Python script that combines the information from the aforementioned Javadoc and a properties file present in the source code. This file contains the parameters that can be set in the AutoFirma configuration.

During the compilation process, the Javadoc is generated and then transformed into a JSON file containing a list of configuration settings with their default values and descriptions.

The Home Manager module reads this JSON file and builds the `config` submodule.

If the user modifies any of the values under `config`, a configuration file is generated and linked to the path that AutoFirma expects. To prevent AutoFirma from overwriting the configuration (which happens every time the configuration dialog is opened), the directory containing the link has its permissions modified to forbid the user from writing.
@nilp0inter nilp0inter self-assigned this Jan 20, 2025
@nilp0inter
Copy link
Collaborator Author

At the moment, the compilation process has been downgraded to openjdk8 due to XMLDoclet's lack of support for openjdk21 in Maven.

Luckily, a new contribution is changing that situation; see here: manticore-projects/xml-doclet#2

As soon as we can update the doclet to work on an up-to-date JDK, I'll remove the draft status of this PR for review.

Tracking XMLDoclet issue: manticore-projects/xml-doclet#3

@nilp0inter nilp0inter force-pushed the feature/autofirma-hm-config branch 2 times, most recently from ac3ba91 to 419eb86 Compare January 25, 2025 01:52
@nix-community nix-community deleted a comment from mergify bot Jan 26, 2025
@nilp0inter nilp0inter force-pushed the feature/autofirma-hm-config branch from 419eb86 to 7f19498 Compare January 29, 2025 23:56
@nilp0inter nilp0inter linked an issue Jan 29, 2025 that may be closed by this pull request
2 tasks
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.

Configure via NixOS/home-manager module
1 participant