mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-12 15:24:14 +03:00
03ea2a690d
This preserves location information, e.g. in the `nixos-option` tool or in errors about duplicate option definitions.
50 lines
1.5 KiB
Nix
50 lines
1.5 KiB
Nix
{ device ? null
|
|
, configuration ? null
|
|
, pkgs ? (import ./pkgs.nix {})
|
|
}@args':
|
|
|
|
let
|
|
# Inherit default values correctly in `args`
|
|
args = args' // {
|
|
inherit pkgs;
|
|
};
|
|
|
|
# Selection of the configuration can by made either through NIX_PATH,
|
|
# through local.nix or as a parameter.
|
|
defaultConfiguration =
|
|
let
|
|
configPathFromNixPath = (builtins.tryEval <mobile-nixos-configuration>).value;
|
|
in
|
|
if configPathFromNixPath != false then
|
|
[ configPathFromNixPath ]
|
|
else if configuration != null then
|
|
[ configuration ]
|
|
else if (builtins.pathExists ./local.nix) then
|
|
builtins.trace ''
|
|
${"\n"}
|
|
********************************************
|
|
* WARNING: evaluation includes ./local.nix *
|
|
********************************************
|
|
'' [ ./local.nix ]
|
|
else
|
|
[]
|
|
;
|
|
in
|
|
|
|
import ./lib/eval-with-configuration.nix (args // {
|
|
configuration = defaultConfiguration;
|
|
additionalHelpInstructions = ''
|
|
You can build the `-A outputs.default` attribute to build an empty and
|
|
un-configured image. That image can be configured using `local.nix`.
|
|
|
|
** Note that an unconfigured image may appear to hang at boot. **
|
|
|
|
An alternative is to use one of the `examples` system. They differ in their
|
|
configuration. An example that should be building, and working using
|
|
cross-compilation is the `examples/hello` system. Read its README for more
|
|
information.
|
|
|
|
$ nix-build examples/hello --argstr device ${device} -A outputs.default
|
|
'';
|
|
})
|