Skip to content

Use Nix for reproducable building #78

Open
headblockhead wants to merge 1 commit intovanilla-wiiu:masterfrom
headblockhead:master
Open

Use Nix for reproducable building #78
headblockhead wants to merge 1 commit intovanilla-wiiu:masterfrom
headblockhead:master

Conversation

@headblockhead
Copy link

@headblockhead headblockhead commented Oct 8, 2024

This PR adds files for building vanilla with the Nix build system.

Nix is

  • A build system
  • A package manager
  • A package repository (nixpkgs)
  • An operating system (NixOS)

This PR adds a Nix Flake, which defines a set of dependencies and instructions on how to build Vanilla.

A flake in the Vanilla repository would allow Nix users to run vanilla with one command: nix run github:vanilla-wiiu/vanilla.

Nix could potentially replace Linux builds in the CI workflow to guarantee that CI-produced binaries are identical to locally-produced binaries, which could be useful for future issue diagnosis.

Finally, Nix build support would make it significantly easier for people running NixOS to run vanilla, as NixOS does not support generic dynamically-linked executables because it does not implement a typical FHS.

Please read through nix.dev for more on Nix and why it is useful if you have the time :)

To test:

To test this, install Nix from https://nixos.org/download/ and run nix run github:headblockhead/vanilla which will build and run vanilla using Nix.

Alternatives:

Additionally, I am currently adding vanilla to nixpkgs, which is NixOS's equivalent to Arch's AUR, and will make a PR to note this in the README when I am done. However, this would make it my responsibility to maintain instead.

@headblockhead headblockhead changed the title Use Nix for perfectly reproducable building Use Nix for reproducable building Oct 8, 2024
@headblockhead
Copy link
Author

Before I continue to work on this, would this be of interest to you, @itsmattkc?

I don't want to invest too much time into a PR with no hope of getting merged.

@headblockhead
Copy link
Author

All my issues preventing me from making this work have now been resolved! I will hopefully be able to put some time into making a proper Nix flake for vanilla soon.

@headblockhead
Copy link
Author

Currently:

  • 👍 Nix building is working!
  • 👍 Vanilla is working when built through Nix!
  • 👎 nix run github:headblockhead/vanilla requires --no-sandbox due to git pull for downloading hostap.

ihaveamac added a commit to ihaveamac/vanilla that referenced this pull request Jan 6, 2026
@ihaveamac
Copy link

To work around the git clone for hostap, use leaveDotGit = true, then make it do a local clone. If you didn't know, you can use git clone on a locally cloned repo e.g. git clone ~/my-repo will make a new clone, with its "remote" pointing to the original cloned path.

There are still other build issues however, but it means no arbitrary network access is needed during build anymore.

ihaveamac@41d856d#diff-16cddcd6b987528aee0e3d6930f04e9413e1e349c66d385fdc93290af456800dR78-R80

@ihaveamac
Copy link

This is the build error:

vanilla> /build/vanilla/pipe/linux/wpa.c: In function 'install_polkit':
vanilla> /build/vanilla/pipe/linux/wpa.c:1153:17: error: format not a string literal and no format arguments [8;;https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Warning-Options.html#index-Wformat-security-Werror=format-security8;;]
vanilla>  1153 |                 fprintf(rule, RULE_TEMPLATE);
vanilla>       |                 ^~~~~~~

This can be disabled with:

env.NIX_CFLAGS_COMPILE = "-Wno-format-security";

@ihaveamac
Copy link

I hope you don't mind, but I used this as a base to put in my nur, with some updates made to adapt to changes made to the vanilla repo since 2024 (including removing most phases and some dependencies):

https://github.com/ihaveamac/nur-packages/tree/staging/pkgs/vanilla

ihaveamac/nur-packages@f84d79c

I did this so that I could keep it easily up to date to experiment with on Steam Deck, without needing to manually add the flake to the repo. If this bothers you or you want to keep your original repo up to date then I will take it out.

@eku
Copy link

eku commented Jan 11, 2026

Why not make it an official nix package?

@headblockhead
Copy link
Author

headblockhead commented Jan 11, 2026

Been a while since I've touched this - I'll work on a nixpkgs pr today, as vanilla appears to be a little more stable now.

@headblockhead
Copy link
Author

Also added to nixpkgs as NixOS/nixpkgs#479026.

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