mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-11-28 12:56:54 +03:00
default.nix: WIP minor refactor
This commit is contained in:
parent
546dce59a8
commit
77110eaa92
21
default.nix
21
default.nix
@ -1,28 +1,31 @@
|
||||
# This entry points allows calling `nix-build -A` with
|
||||
# anything defined in the overlay (or the host system).
|
||||
# Selection of the device can be made either through the environment or through
|
||||
# using `--argstr device [...]`.
|
||||
let deviceFromEnv = builtins.getEnv "MOBILE_NIXOS_DEVICE"; in
|
||||
{
|
||||
device ?
|
||||
|
||||
{ pkgs' ? import <nixpkgs> {}
|
||||
, device ?
|
||||
if deviceFromEnv == ""
|
||||
then throw "Please pass a device name or set the MOBILE_NIXOS_DEVICE environment variable."
|
||||
else deviceFromEnv
|
||||
}:
|
||||
with import <nixpkgs> {};
|
||||
let
|
||||
# Evaluation doesn't actually use the overlay.
|
||||
# The overlay has been re-defined in the modules system.
|
||||
inherit (pkgs'.lib) optional;
|
||||
inherit (pkgs') path;
|
||||
|
||||
eval = import ./lib/eval-config.nix {
|
||||
modules = [
|
||||
(import (./. + "/devices/${device}" ))
|
||||
]
|
||||
# TODO : allow loading from elsewhere through ENV
|
||||
++ lib.optional (builtins.pathExists ./local.nix) (import (./local.nix ))
|
||||
++ optional (builtins.pathExists ./local.nix) (import (./local.nix ))
|
||||
;
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit (eval.config.system.build) all;
|
||||
inherit (eval) config;
|
||||
inherit (eval) config pkgs;
|
||||
inherit (eval.pkgs) lib;
|
||||
inherit eval;
|
||||
|
||||
# Shortcut to allow building `nixos` from the same channel revision.
|
||||
# This is used by `./nixos/default.nix`
|
||||
|
Loading…
Reference in New Issue
Block a user