Skip to content

multi-derivation-package

state: internal
maintainers: @DavHau

Introduction

Options

deps

All dependencies of the package. This option should be set by the "outer world" and can be used to inherit attributes from pkgs or inputs etc.

By separating the task of retrieving things from the outside world, it is ensured that the dependencies are overridable. Nothing will stop users from adding nixpkgs itself as a dependency, but this will make it very hard for the user of the package to override any dependencies, because they'd have to figure out a way to insert their changes into the Nixpkgs fixpoint. By adding specific attributes to deps instead, the user has a realistic chance of overriding those dependencies.

So deps should be specific, but not overly specific. For instance, the caller shouldn't have to know the version of a dependency in order to override it. The name should suffice. (e.g. nix = nixVersions.nix_2_12 instead of inherit (nixVersions) nix_2_12.

type lazy attribute set of raw value
source dream2nix/modules/dream2nix/core/deps
default
{ }
example
{nixpkgs, ...}: {
  inherit (nixpkgs) stdenv;
  inherit (nixpkgs.haskellPackages) pandoc;
}

env

environment variables passed to the build environment

type attribute set of (null or boolean or signed integer or string or path or package or list of (boolean or signed integer or string or path or package))
source dream2nix/modules/dream2nix/core/env
default
{ }

lock.content

The content of the lock file. All fields declared via lock.fields are contained pointing to their respective values.

type anything
source dream2nix/modules/dream2nix/core/lock/interface.nix

lock.extraScripts

Extra shell scripts to execute when nix run .#{package}.lock is called.

This allows adding custom logic to the lock file generation.

type list of path
source dream2nix/modules/dream2nix/core/lock/interface.nix
default
[ ]

lock.fields

Fields of the lock file

type attribute set of (submodule)
source dream2nix/modules/dream2nix/core/lock/interface.nix
default
{ }
example
{
  pname = true;
  version = true;
}

lock.fields.<name>.default

The default value in case the lock file doesn't exist or doesn't yet contain the field.

type null or anything
source dream2nix/modules/dream2nix/core/lock/interface.nix
default
null

lock.fields.<name>.script

A script to refresh the value of this lock file field. The script should write the result as json file to $out.

type path
source dream2nix/modules/dream2nix/core/lock/interface.nix

lock.invalidationData

Pass any data that should invalidate the lock file when changed. This is useful for example when the lock file should be regenerated when the requirements change.

type anything
source dream2nix/modules/dream2nix/core/lock/interface.nix
default
{ }
example
{
  pip = {
    lockVersion = "2";
    requirements = [
      "requests"
      "pillow"
    ];
  };
}

lock.isValid

Check whether the current lock file is valid, which means we don't need to lock again.

type boolean (read only)
source dream2nix/modules/dream2nix/core/lock/interface.nix

lock.lib.computeFODHash

Helper function to write the hash of a given FOD to $out.

type function that evaluates to a(n) path (read only)
source dream2nix/modules/dream2nix/core/lock/interface.nix

lock.refresh

Script to refresh the lock file

type package (read only)
source dream2nix/modules/dream2nix/core/lock/interface.nix

name

The name of the package

type string
source dream2nix/modules/dream2nix/core/ui/interface.nix

out

default output 'out'

type submodule
source dream2nix/modules/dream2nix/multi-derivation-package/interface.nix

out.deps

All dependencies of the package. This option should be set by the "outer world" and can be used to inherit attributes from pkgs or inputs etc.

By separating the task of retrieving things from the outside world, it is ensured that the dependencies are overridable. Nothing will stop users from adding nixpkgs itself as a dependency, but this will make it very hard for the user of the package to override any dependencies, because they'd have to figure out a way to insert their changes into the Nixpkgs fixpoint. By adding specific attributes to deps instead, the user has a realistic chance of overriding those dependencies.

So deps should be specific, but not overly specific. For instance, the caller shouldn't have to know the version of a dependency in order to override it. The name should suffice. (e.g. nix = nixVersions.nix_2_12 instead of inherit (nixVersions) nix_2_12.

type lazy attribute set of raw value
source dream2nix/modules/dream2nix/core/deps
default
{ }
example
{nixpkgs, ...}: {
  inherit (nixpkgs) stdenv;
  inherit (nixpkgs.haskellPackages) pandoc;
}

out.env

environment variables passed to the build environment

type attribute set of (null or boolean or signed integer or string or path or package or list of (boolean or signed integer or string or path or package))
source dream2nix/modules/dream2nix/core/env
default
{ }

out.lock.content

The content of the lock file. All fields declared via lock.fields are contained pointing to their respective values.

type anything
source dream2nix/modules/dream2nix/core/lock/interface.nix

out.lock.extraScripts

Extra shell scripts to execute when nix run .#{package}.lock is called.

This allows adding custom logic to the lock file generation.

type list of path
source dream2nix/modules/dream2nix/core/lock/interface.nix
default
[ ]

out.lock.fields

Fields of the lock file

type attribute set of (submodule)
source dream2nix/modules/dream2nix/core/lock/interface.nix
default
{ }
example
{
  pname = true;
  version = true;
}

out.lock.fields.<name>.default

The default value in case the lock file doesn't exist or doesn't yet contain the field.

type null or anything
source dream2nix/modules/dream2nix/core/lock/interface.nix
default
null

out.lock.fields.<name>.script

A script to refresh the value of this lock file field. The script should write the result as json file to $out.

type path
source dream2nix/modules/dream2nix/core/lock/interface.nix

out.lock.invalidationData

Pass any data that should invalidate the lock file when changed. This is useful for example when the lock file should be regenerated when the requirements change.

type anything
source dream2nix/modules/dream2nix/core/lock/interface.nix
default
{ }
example
{
  pip = {
    lockVersion = "2";
    requirements = [
      "requests"
      "pillow"
    ];
  };
}

out.lock.isValid

Check whether the current lock file is valid, which means we don't need to lock again.

type boolean (read only)
source dream2nix/modules/dream2nix/core/lock/interface.nix

out.lock.lib.computeFODHash

Helper function to write the hash of a given FOD to $out.

type function that evaluates to a(n) path (read only)
source dream2nix/modules/dream2nix/core/lock/interface.nix

out.lock.refresh

Script to refresh the lock file

type package (read only)
source dream2nix/modules/dream2nix/core/lock/interface.nix

out.name

The name of the package

type string
source dream2nix/modules/dream2nix/core/ui/interface.nix

out.paths.cacheFile

Path to the eval cache file of the current package. Relative to "${paths.projectRoot}/${paths.package}"".

type string
source dream2nix/modules/dream2nix/core/paths/interface.nix
default
"cache.json"

out.paths.lockFile

Path to the lock file of the current package. Relative to "${paths.projectRoot}/${paths.package}"".

type string
source dream2nix/modules/dream2nix/core/paths/interface.nix
default
"lock.json"

out.paths.package

Path to the directory containing the definition of the current package. Relative to 'paths.projectRoot'.

This helps locating package definitions for lock & update scripts.

type path or string
source dream2nix/modules/dream2nix/core/paths/interface.nix

out.paths.projectRoot

Path to the root of the project on which dream2nix operates. Must contain the marker file specified by 'paths.projectRootFile'

This helps locating lock files at evaluation time.

type path
source dream2nix/modules/dream2nix/core/paths/interface.nix
example
./.

out.paths.projectRootFile

File name to look for to determine the root of the project. Ensure 'paths.projectRoot' contains a file named like this.

This helps locating package definitions for lock & update scripts.

type string
source dream2nix/modules/dream2nix/core/paths/interface.nix
default
".git"
example
".git"

out.public

The final result of the evaluated package. Contains everything that nix expects from a derivation. Contains fields like name, outputs, drvPath, outPath, etc. Can be build with nix-build or nix build.

type lazy attribute set of anything
source dream2nix/modules/dream2nix/core/public/interface.nix, dream2nix/modules/dream2nix/core/docs

out.public.docs

The manual of the package as a website

type package (read only)
source dream2nix/modules/dream2nix/core/docs

out.version

The version of the package

type string
source dream2nix/modules/dream2nix/core/ui/interface.nix

paths.cacheFile

Path to the eval cache file of the current package. Relative to "${paths.projectRoot}/${paths.package}"".

type string
source dream2nix/modules/dream2nix/core/paths/interface.nix
default
"cache.json"

paths.lockFile

Path to the lock file of the current package. Relative to "${paths.projectRoot}/${paths.package}"".

type string
source dream2nix/modules/dream2nix/core/paths/interface.nix
default
"lock.json"

paths.package

Path to the directory containing the definition of the current package. Relative to 'paths.projectRoot'.

This helps locating package definitions for lock & update scripts.

type path or string
source dream2nix/modules/dream2nix/core/paths/interface.nix

paths.projectRoot

Path to the root of the project on which dream2nix operates. Must contain the marker file specified by 'paths.projectRootFile'

This helps locating lock files at evaluation time.

type path
source dream2nix/modules/dream2nix/core/paths/interface.nix
example
./.

paths.projectRootFile

File name to look for to determine the root of the project. Ensure 'paths.projectRoot' contains a file named like this.

This helps locating package definitions for lock & update scripts.

type string
source dream2nix/modules/dream2nix/core/paths/interface.nix
default
".git"
example
".git"

public

The final result of the evaluated package. Contains everything that nix expects from a derivation. Contains fields like name, outputs, drvPath, outPath, etc. Can be build with nix-build or nix build.

type lazy attribute set of anything
source dream2nix/modules/dream2nix/core/public/interface.nix, dream2nix/modules/dream2nix/core/docs

public.docs

The manual of the package as a website

type package (read only)
source dream2nix/modules/dream2nix/core/docs

version

The version of the package

type string
source dream2nix/modules/dream2nix/core/ui/interface.nix