feat: add Nix packaging, devshell, and modules#25
Conversation
KristijanZic
commented
May 11, 2026
- Adds a flake.nix using crane and flake-parts for fast caching
- Provides a development shell with necessary dependencies
- Exports a Home Manager module to manage ratty.toml
- Exports a NixOS module to enforce system-wide config
- Patches hardcoded shell paths for NixOS compatibility
- Adds a flake.nix using crane and flake-parts for fast caching - Provides a development shell with necessary dependencies - Exports a Home Manager module to manage ratty.toml - Exports a NixOS module to enforce system-wide config - Patches hardcoded shell paths for NixOS compatibility
|
This built and ran on NixOS for me but for some reason the rat cursor was a white cube instead of the spinning rat. |
| ]; | ||
|
|
||
| doCheck = false; | ||
| postInstall = pkgs.lib.optionalString pkgs.stdenv.isLinux '' |
There was a problem hiding this comment.
Why are tests turned off, were they failing?
There was a problem hiding this comment.
I looked through the repo and didn't find any tests for ratty, which is why I also did doCheck = false; in the nixpkgs package
when nix builds a rust program it first builds it in release mode for the actual binary, then again in debug mode for tests (crane helps with it but you still need to build the ratty crate twice) - that slows down build time considerably and is the reason behind this
if I'm wrong about there being no tests please let me know, I'll update the package
|
what's the benefit of using flake-parts here? |
only got this for some custom models, since ratty falls back to the white cube when the cursor model path resolves to an absolute path outside its asset root. custom models only load reliably when placed under the expected |
|
Thanks for the PR! Any chance that we check the Nix flake in the CI as well? |
| inherit src buildInputs nativeBuildInputs; | ||
| }; | ||
|
|
||
| ratty = craneLib.buildPackage { |
There was a problem hiding this comment.
please move this package to a separate file, you can later still use it in inputsFrom as self.packages.${system}.ratty
| }; | ||
| }; | ||
|
|
||
| nixosModules.default = |
There was a problem hiding this comment.
same as the package with the nixos and home-manager modules, move them to separate files
I'd suggest nix/package.nix, nix/nixos-module.nix and nix/home-manager-module.nix (or move the modules into their own directory)
| "aarch64-linux" | ||
| "x86_64-darwin" | ||
| "aarch64-darwin" | ||
| ]; |
There was a problem hiding this comment.
maybe http://github.com/nix-systems/default as an input?
| crane, | ||
| ... | ||
| }: | ||
| flake-parts.lib.mkFlake { inherit inputs; } { |
There was a problem hiding this comment.
this could be removed, the attributes that don't depend on the system you could leave as is and the ones that do you can use the following function for:
forEachSystem = nixpkgs.lib.genAttrs (import systems);where systems is the input mentioned in another comment
otherwise if you don't decide to use that input, replace (import systems) with the array of systems
Yes, I can make a workflow. Thanks everyone for the reviews. I really appreciate it! |
|
Maybe this deserves a different issue/PR, but we should also include nix to the install instructions and packaging status! |