Resources

Resources are a way to easily attach files to your flakes using MyNixOS.

They can be used for options where a NixOS path type is expected.

How to use resources

To use a resource, navigate to an option which includes a NixOS path type, such as boot.loader.grub.splashImage. Setting this option will change the splash image on boot for the GRUB bootloader.

At the option screen, a new resource may be created either by clicking the "Resource" button and selecting "Browse", or by dragging and dropping a file onto the option value.

Existing flake resources may be selected from the "Resource" button dropdown menu.

Files vs directories

Resources created from archive file types are treated as directories, while other file types are treated as single files. This means that the resulting Nix path within the generated Nix code will refer to a directory for resources created from archive file types, and to specific file paths for resources created from other file types.

Archive file types currently supported are zip and tar, including bz2, gz, and xz compression extensions.

Managing resources

Resources can be managed from the flake resources screen. New resources may be created with the "Browse" button", and existing resources may be deleted by clicking the red delete button to the right when hovering a resource entry.

Technical details

When creating a resource, the contents are uploaded to cloud storage.

In the Nix code generated when releasing a flake, each resource is referenced using the Nix function builtins.fetchTarball. This means that the contents of a resource is not stored together with each flake version in order to avoid bloat.

Generated Nix code references resource objects with their SHA-256 checksum, ensuring that contents cannot be altered.