### Create a Base Nilla Project Source: https://github.com/nilla-nix/nilla/blob/main/README.md This snippet shows the minimal configuration required to set up a new Nilla project by importing Nilla and calling its `create` function. It fetches the Nilla tarball and provides a placeholder for project configuration. ```nix let nilla = import (builtins.fetchTarball { url = "https://github.com/nilla-nix/nilla/archive/main.tar.gz"; sha256 = "0000000000000000000000000000000000000000000000000000"; }); in nilla.create { # You will add your project's configuration here! } ``` -------------------------------- ### Include Custom Module and Define Input in Nilla Project Source: https://github.com/nilla-nix/nilla/blob/main/README.md This Nix configuration file sets up a Nilla project, including the custom 'hello-loader.nix' module and defining a new input 'myinput' that uses the 'hello' loader. It shows how to fetch Nilla and configure inputs. ```nix # nilla.nix let nilla = import (builtins.fetchTarball { url = "https://github.com/nilla-nix/nilla/archive/main.tar.gz"; sha256 = "0000000000000000000000000000000000000000000000000000"; }); in nilla.create ({ config }: let # Get the loaded input data! text = config.inputs.myinput.result; in { # Include our module in the project. includes = [ ./hello-loader.nix ]; config = { inputs = { myinput = { # An input's source can be fetched, but in this simple example let's use a directory # located at `./my/input`. src = ./my/input; # Specify our loader's name so it is used. loader = "hello"; }; }; }; }) ``` -------------------------------- ### Package System and Builder Configuration Source: https://github.com/nilla-nix/nilla/blob/main/README.md Specify the target systems and the builder to use for a package. The default builder is 'nixpkgs'. ```nix { systems = [ "x86_64-linux" "aarch64-linux" ]; builder = "nixpkgs"; settings = {}; } ``` -------------------------------- ### Configure Nixpkgs Input and Development Shell Source: https://github.com/nilla-nix/nilla/blob/main/README.md This snippet extends the base Nilla project by adding a Nixpkgs input and defining a default development shell. It specifies the Nixpkgs source, loader, systems, and configures the shell to include the 'hello' package. ```nix let nilla = import (builtins.fetchTarball { url = "https://github.com/nilla-nix/nilla/archive/main.tar.gz"; sha256 = "0000000000000000000000000000000000000000000000000000"; }); in nilla.create { config = { inputs = { nixpkgs = { src = builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"; sha256 = "0000000000000000000000000000000000000000000000000000"; }; # Nilla will auto-detect the loader, but for this example we will set it manually. loader = "nixpkgs"; settings = { # The loaded form of this input will be for these systems. Then our packages, # shells, and other items can use these package sets. # By default this will be set to the same systems as Nixpkgs exposes for its flake interface. systems = [ "x86_64-linux" "aarch64-linux" ]; }; }; }; shells.default = { # Our shell will be available on each platform in the systems list. systems = [ "x86_64-linux" "aarch64-linux" ]; # Shell definitions are declared using Nixpkgs' callPackage convention by default. shell = { mkShell, hello, ... }: mkShell { packages = [ # The `hello` package will be available in our development shell. hello ]; }; }; }; } ``` -------------------------------- ### Shell System and Builder Configuration Source: https://github.com/nilla-nix/nilla/blob/main/README.md Define the target systems and the builder for a shell environment. Similar to packages, 'nixpkgs' is the default builder. ```nix { systems = [ "x86_64-linux" ]; builder = "nixpkgs"; settings = {}; } ``` -------------------------------- ### Enter Development Shell Source: https://github.com/nilla-nix/nilla/blob/main/README.md This snippet shows the command to use with the Nilla CLI to enter the development shell defined in your `nilla.nix` file. This command makes the configured packages and environments available. ```shell nilla shell ``` -------------------------------- ### Define a Custom Hello Loader Module Source: https://github.com/nilla-nix/nilla/blob/main/README.md This Nix module defines a custom loader named 'hello' that reads text from a 'hello.txt' file within an input's source directory. It demonstrates how to configure loader settings and the load function. ```nix # hello-loader.nix { lib }: { config.loaders.hello = { # Our simple loader won't take any customization into account. settings = { type = lib.types.attrs.any; default = {}; }; load = input: let text = builtins.readFile "${input.src}/hello.txt"; in # Loaders can return any form of data that they want. Typically this will be an attribute set, # but in this example we are going to load text from the input's `hello.txt` file directly. text; }; } ``` -------------------------------- ### Input Loader Configuration Source: https://github.com/nilla-nix/nilla/blob/main/README.md Specify the loader and its settings for an input. Nilla attempts to auto-detect loaders, but explicit configuration is recommended. ```nix { loader = "someLoader"; settings = { # loader-specific settings }; } ``` -------------------------------- ### Builder Function Definition Source: https://github.com/nilla-nix/nilla/blob/main/README.md Define the function that builds a package. It takes system information, builder name, settings, and a package argument. ```nix { systems = List; builder = String; settings = LoaderSettings; package = (PackageArgs) -> Derivation; } ``` -------------------------------- ### Package Definition Function Source: https://github.com/nilla-nix/nilla/blob/main/README.md Provide the function that defines the package, expected to return a Nix derivation. ```nix package = args: { # derivation definition }; ``` -------------------------------- ### Loader Settings Type and Default Source: https://github.com/nilla-nix/nilla/blob/main/README.md Define the expected type and default value for loader settings. This ensures consistent configuration across different inputs. ```nix { settings.type = "someSettingsType"; settings.default = {}; } ``` -------------------------------- ### Shell Definition Function Source: https://github.com/nilla-nix/nilla/blob/main/README.md Implement the function that defines the shell environment, which should return a Nix derivation. ```nix shell = args: { # shell derivation definition }; ``` -------------------------------- ### Input Source Derivation Source: https://github.com/nilla-nix/nilla/blob/main/README.md Define the source for an input, often fetched using `fetchTarball` or from tools like npins. ```nix { src = fetchTarball "https://example.com/some-package.tar.gz"; # or src = npins.somePackage; } ``` -------------------------------- ### Loader Function Definition Source: https://github.com/nilla-nix/nilla/blob/main/README.md Implement the function responsible for loading an input. It receives the source, loader name, and settings. ```nix { src = Derivation; loader = String; settings = LoaderSettings; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.