forked from extern/flakelight
Document defining packages for a subset of systems
This commit is contained in:
parent
32bf894a50
commit
f34d07dd57
24
API_GUIDE.md
24
API_GUIDE.md
@ -365,7 +365,9 @@ and have build checks in `checks.${system}`.
|
|||||||
|
|
||||||
`package` can be set to a package definition, and will set `packages.default`.
|
`package` can be set to a package definition, and will set `packages.default`.
|
||||||
|
|
||||||
`packages` can be set to attrs of package definitions.
|
`packages` can be set to attrs of package definitions. If it is a function, it
|
||||||
|
will additionally get a `system` arg in addition to module args, to allow
|
||||||
|
conditionally including package definitions depending on the system.
|
||||||
|
|
||||||
By default, the `packages.default` package's name (its attribute name in
|
By default, the `packages.default` package's name (its attribute name in
|
||||||
the package set and overlay) is automatically determined from the derivation's
|
the package set and overlay) is automatically determined from the derivation's
|
||||||
@ -451,6 +453,26 @@ To use the first example, but manually specify the package name:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To add a package only for certain systems, you can take `system` as an arg as
|
||||||
|
follows:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs.flakelight.url = "github:nix-community/flakelight";
|
||||||
|
outputs = { flakelight, ... }:
|
||||||
|
flakelight ./. {
|
||||||
|
packages = { system, ... }: if (system == "x86_64-linux") then {
|
||||||
|
pkg1 = { stdenv }:
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "pkg1";
|
||||||
|
src = ./.;
|
||||||
|
installPhase = "make DESTDIR=$out install";
|
||||||
|
};
|
||||||
|
} else { };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### devShell
|
### devShell
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user