1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-09-11 12:05:26 +03:00

Make the package set a parameter instead of using <nixpkgs> everywhere.

Co-authored-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
Co-authored-by: Edward Amsden <edward@blackriversoft.com>
This commit is contained in:
Edward Amsden 2020-11-11 07:01:40 -05:00 committed by Samuel Dionne-Riel
parent 36724d443f
commit c507b39099
10 changed files with 39 additions and 23 deletions

View File

@ -20,11 +20,12 @@ let
inherit (strings) concatStringsSep stringAsChars;
in
{
pkgs ? import <nixpkgs> {}
# The identifier of the device this should be built for.
# (This gets massaged later on)
# This allows using `default.nix` as a pass-through function.
# See usage in examples folder.
device ? null
, device ? null
, configuration ? default_configuration
# Internally used to tack on configuration by release.nix
, additionalConfiguration ? {}
@ -40,7 +41,7 @@ let
else deviceFromEnv
;
inherit (import ./lib/release-tools.nix) evalWith;
inherit (import ./lib/release-tools.nix { inherit pkgs; }) evalWith;
# The "default" eval.
eval = evalWith {

View File

@ -23,8 +23,8 @@ in
];
disabledModules = [
<nixpkgs/nixos/modules/installer/cd-dvd/iso-image.nix>
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-base.nix>
"installer/cd-dvd/iso-image.nix"
"installer/cd-dvd/installation-cd-base.nix"
];
config = lib.mkMerge [

View File

@ -1,2 +0,0 @@
# Simple proxy to the upstream Nixpkgs eval-config.nix
import <nixpkgs/nixos/lib/eval-config.nix>

View File

@ -1,3 +1,22 @@
{ pkgs ? import <nixpkgs> {} }:
let
nixpkgsPath = pkgs.path;
# Original `evalConfig`
evalConfig' = import "${pkgs.path}/nixos/lib/eval-config.nix";
# Specialized `evalConfig` which injects the _mobile-nixos special arg.
evalConfig = args@{ specialArgs ? {}, ... }: evalConfig' (args // {
specialArgs = specialArgs // {
_mobile-nixos = {
inherit evalConfig;
inherit nixpkgsPath;
path = ../.;
};
};
});
in
{
# This should *never* rely on lib or pkgs.
all-devices =
@ -14,8 +33,11 @@
{ modules
, device
, additionalConfiguration ? {}
, baseModules ? ((import ../modules/module-list.nix) ++ [ ../modules/_nixos-integration.nix ])
}: import ./eval-config.nix {
, baseModules ? (
(import ../modules/module-list.nix)
++ (import "${toString pkgs.path}/nixos/modules/module-list.nix")
)
}: evalConfig {
inherit baseModules;
modules =
(if device ? special

View File

@ -5,8 +5,8 @@ let
in
{
disabledModules = [
<nixpkgs/nixos/modules/tasks/encrypted-devices.nix>
<nixpkgs/nixos/modules/tasks/filesystems/zfs.nix>
"tasks/encrypted-devices.nix"
"tasks/filesystems/zfs.nix"
];
config = {

View File

@ -3,7 +3,7 @@
# kernel package with arguments that makes the Mobile NixOS kernel
# builder less ergonomic to use.
{ pkgs, lib, config, ... }:
{ pkgs, lib, config, _mobile-nixos, ... }:
let
inherit (lib)
@ -14,13 +14,13 @@ let
in
{
disabledModules = [
<nixpkgs/nixos/modules/system/boot/kernel.nix>
"system/boot/kernel.nix"
];
imports = [
(
let
toOverride = import <nixpkgs/nixos/modules/system/boot/kernel.nix> {
toOverride = import "${_mobile-nixos.nixpkgsPath}/nixos/modules/system/boot/kernel.nix" {
inherit lib config pkgs;
};
in (

View File

@ -1,5 +0,0 @@
# Import the upstream module-list.
# Do not add this file to `module-list.nix`.
{
imports = import <nixpkgs/nixos/modules/module-list.nix>;
}

View File

@ -1,10 +1,10 @@
{ modules, baseModules, ... }:
{ pkgs, modules, baseModules, _mobile-nixos, ... }:
# This module provides the `recovery` build output.
# It is the same configuration, with minor customizations.
{
system.build.recovery = (import ../lib/eval-config.nix {
system.build.recovery = (_mobile-nixos.evalConfig {
inherit baseModules;
modules = modules ++ [{
mobile.system.android.bootimg.name = "recovery.img";

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, modules, baseModules, ... }:
{ config, lib, pkgs, modules, baseModules, _mobile-nixos, ... }:
# This module provides the `stage-0` build output.
# It is the same configuration, with minor customizations.
@ -22,7 +22,7 @@ in
};
config = {
system.build.stage-0 = (import ../lib/eval-config.nix {
system.build.stage-0 = (_mobile-nixos.evalConfig {
inherit baseModules;
modules = modules ++ [{
mobile.boot.stage-1.stage = if supportsStage-0 then 0 else 1;

View File

@ -8,7 +8,7 @@
# Note:
# Verify that .ci/instantiate-all.nix lists the expected paths when adding to this file.
let
mobileReleaseTools = (import ./lib/release-tools.nix);
mobileReleaseTools = (import ./lib/release-tools.nix {});
inherit (mobileReleaseTools) all-devices;
in
{ mobile-nixos ? builtins.fetchGit ./.