Skip to content

Conversation

@Jonsen94
Copy link
Contributor

This PR adds nix flake support to reitti.
It provides a dev shell with the basic tools needed to compile and build the application, can be used to build the jar and a docker image.

There are some limitations (see top of flake.nix). These limitations lead to different outputs based on whether nix was used to build or github-actions/maven.

Most notable is that the git info which the maven commit id plugin generates is not available and thus will not be shown correctly:

  • build time is "last modified time" which is equal to commit timestamp (and thus not correct for dirty states)
  • application version cannot be inferred from the tags and thus is set to "nix-build-"
    This is because the nix sandboxed environment does not keep the .git folder in order to provide better reproducibility.
    Thus the maven commit id plugin has no git folder to work with and needs to be patched out during build phase.
    Additionally the tests are patched out as they interfere with the sandboxed environment and will fail. This means that tests are NOT done when running this flake at all.

Additionally the reproducibility nix normally provides is broken by the contributors list and thus this is an impure build.
This is because the github api does not provide contributors for up until a given commit.

Thus we need to use the impure flag: nix build .#<jar|docker> --impure

==== Note ====
Feel free to decline this PR. It is just meant as an offer for everyone using nix to help nixify this project too.
I fully understand that this might be something you do not want to keep in the project given that it might need future adaptations to keep in sync with the rest of the project.

I will keep this branch on my fork nevertheless and thus hopefully provide some guidance for people who want to use nix.
As I am also fairly new to nix myself I cannot guarantee this is up to the best practices of nix and like to take criticism on it if anyone finds the potential to enhance this further!

Jonas Vothknecht and others added 7 commits February 1, 2026 09:47
- nix shell providing base tools needed to work with the repository
- build goals for:
  - docker image
  - jar

Notes:
- there are some known limitations, see flake.nix
- docker image is slightly bigger than the official one
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
@dgraf-gh
Copy link
Contributor

dgraf-gh commented Feb 1, 2026

Hi @Jonsen94,

I like your approach here but honestly can not add this to reitti directly. I do not use nix on my own and cant afford the technical burden to support this out of the box.

What I could do is linking your repo from the documentation in the setup section if that is ok for you. So let me know if i should add this.

Anyways, thank you for taking your time with this ❤️

@dgraf-gh dgraf-gh closed this Feb 1, 2026
@Jonsen94
Copy link
Contributor Author

Jonsen94 commented Feb 1, 2026

Hi,

I totally understand this and kinda expected this.
If you don't mind and think it might help others, feel free to link my branch. Otherwise ppl might find this PR and can find it this way.

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.

3 participants