mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
simplify usage of lib.nixOnDroidConfiguration
This commit is contained in:
parent
d68467d679
commit
a99c1e0416
10 changed files with 43 additions and 30 deletions
|
|
@ -16,6 +16,9 @@
|
||||||
* Fix usage of `extraSpecialArgs`: All values were previously set in
|
* Fix usage of `extraSpecialArgs`: All values were previously set in
|
||||||
`_module.args` instead of passing them as `specialArgs` into `evalModules`.
|
`_module.args` instead of passing them as `specialArgs` into `evalModules`.
|
||||||
This enables usage of `specialArgs` to use in `imports` in module defintions.
|
This enables usage of `specialArgs` to use in `imports` in module defintions.
|
||||||
|
* In an effort to reduce the number of arguments to `lib.nixOnDroidConfiguration`
|
||||||
|
function in flake configurations, `system` is now inferred from `pkgs.system`
|
||||||
|
and `config` and `extraModules` are now combined into `modules`
|
||||||
|
|
||||||
## Release 22.05
|
## Release 22.05
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,8 +193,7 @@ A minimal example could look like the following:
|
||||||
outputs = { self, nixpkgs, nix-on-droid }: {
|
outputs = { self, nixpkgs, nix-on-droid }: {
|
||||||
|
|
||||||
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
system = "aarch64-linux";
|
modules = [ ./nix-on-droid.nix ];
|
||||||
config = ./nix-on-droid.nix;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
30
flake.nix
30
flake.nix
|
|
@ -72,20 +72,36 @@
|
||||||
formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgsFor.${system});
|
formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgsFor.${system});
|
||||||
|
|
||||||
lib.nixOnDroidConfiguration =
|
lib.nixOnDroidConfiguration =
|
||||||
{ config
|
{ modules ? [ ]
|
||||||
, system ? "aarch64-linux" # unused, only supported variant
|
|
||||||
, extraModules ? [ ]
|
|
||||||
, extraSpecialArgs ? { }
|
, extraSpecialArgs ? { }
|
||||||
, pkgs ? pkgs'
|
, pkgs ? pkgs'
|
||||||
, home-manager-path ? home-manager.outPath
|
, home-manager-path ? home-manager.outPath
|
||||||
|
# deprecated:
|
||||||
|
, config ? null
|
||||||
|
, extraModules ? null
|
||||||
|
, system ? null
|
||||||
}:
|
}:
|
||||||
if system != "aarch64-linux" then
|
if pkgs.system != "aarch64-linux" then
|
||||||
throw "aarch64-linux is the only currently supported system type"
|
throw "aarch64-linux is the only currently supported system type"
|
||||||
else
|
else
|
||||||
import ./modules {
|
pkgs.lib.throwIf
|
||||||
inherit config extraModules extraSpecialArgs home-manager-path pkgs;
|
(config != null || extraModules != null)
|
||||||
|
''
|
||||||
|
The 'nixOnDroidConfiguration' arguments
|
||||||
|
|
||||||
|
- 'config'
|
||||||
|
- 'extraModules'
|
||||||
|
- 'system'
|
||||||
|
|
||||||
|
have been removed. Instead use the argument 'modules'. The
|
||||||
|
'system' will be inferred by 'pkgs.system'.
|
||||||
|
See the 22.11 release notes for more.
|
||||||
|
''
|
||||||
|
(import ./modules {
|
||||||
|
inherit extraSpecialArgs home-manager-path pkgs;
|
||||||
|
config.imports = modules;
|
||||||
isFlake = true;
|
isFlake = true;
|
||||||
};
|
});
|
||||||
|
|
||||||
overlays.default = overlay;
|
overlays.default = overlay;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
|
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||||
|
|
||||||
{ config ? null
|
{ config ? null
|
||||||
, extraModules ? [ ]
|
|
||||||
, extraSpecialArgs ? { }
|
, extraSpecialArgs ? { }
|
||||||
, pkgs ? import <nixpkgs> { }
|
, pkgs ? import <nixpkgs> { }
|
||||||
, home-manager-path ? <home-manager>
|
, home-manager-path ? <home-manager>
|
||||||
|
|
@ -21,7 +20,7 @@ let
|
||||||
nodModules = import ./module-list.nix { inherit pkgs home-manager-path isFlake; };
|
nodModules = import ./module-list.nix { inherit pkgs home-manager-path isFlake; };
|
||||||
|
|
||||||
rawModule = evalModules {
|
rawModule = evalModules {
|
||||||
modules = [ configModule ] ++ extraModules ++ nodModules;
|
modules = [ configModule ] ++ nodModules;
|
||||||
specialArgs = extraSpecialArgs;
|
specialArgs = extraSpecialArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,16 @@ let
|
||||||
modules = import ../modules {
|
modules = import ../modules {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
|
||||||
extraModules = [ ../modules/build/initial-build.nix ];
|
isFlake = true;
|
||||||
extraSpecialArgs = {
|
|
||||||
|
config = {
|
||||||
|
imports = [ ../modules/build/initial-build.nix ];
|
||||||
|
|
||||||
|
_module.args = {
|
||||||
inherit initialPackageInfo;
|
inherit initialPackageInfo;
|
||||||
pkgs = pkgs.lib.mkForce pkgs; # to override ./modules/nixpkgs/config.nix
|
pkgs = pkgs.lib.mkForce pkgs; # to override ./modules/nixpkgs/config.nix
|
||||||
};
|
};
|
||||||
|
|
||||||
isFlake = true;
|
|
||||||
|
|
||||||
config = {
|
|
||||||
# Fix invoking bash after initial build.
|
# Fix invoking bash after initial build.
|
||||||
user.shell = "${initialPackageInfo.bash}/bin/bash";
|
user.shell = "${initialPackageInfo.bash}/bin/bash";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,10 @@
|
||||||
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
|
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
|
||||||
|
|
||||||
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
system = "aarch64-linux";
|
modules = [
|
||||||
config = ./nix-on-droid.nix;
|
./nix-on-droid.nix
|
||||||
|
|
||||||
# list of extra modules for nix-on-droid system
|
# list of extra modules for nix-on-droid system
|
||||||
extraModules = [
|
|
||||||
# { nix.registry.nixpkgs.flake = nixpkgs; }
|
# { nix.registry.nixpkgs.flake = nixpkgs; }
|
||||||
# ./path/to/module.nix
|
# ./path/to/module.nix
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@
|
||||||
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
|
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
|
||||||
|
|
||||||
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
system = "aarch64-linux";
|
modules = [ ./nix-on-droid.nix ];
|
||||||
config = ./nix-on-droid.nix;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@
|
||||||
outputs = { self, nixpkgs, nix-on-droid }: {
|
outputs = { self, nixpkgs, nix-on-droid }: {
|
||||||
|
|
||||||
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
system = "aarch64-linux";
|
modules = [ ./nix-on-droid.nix ];
|
||||||
config = ./nix-on-droid.nix;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,7 @@
|
||||||
outputs = { nix-on-droid, ... }: {
|
outputs = { nix-on-droid, ... }: {
|
||||||
nixOnDroidConfigurations = {
|
nixOnDroidConfigurations = {
|
||||||
device = nix-on-droid.lib.nixOnDroidConfiguration {
|
device = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
config = ./nix-on-droid.nix;
|
modules = [ ./nix-on-droid.nix ];
|
||||||
system = "aarch64-linux";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@
|
||||||
outputs = { nix-on-droid, ... }: {
|
outputs = { nix-on-droid, ... }: {
|
||||||
nixOnDroidConfigurations = {
|
nixOnDroidConfigurations = {
|
||||||
device = nix-on-droid.lib.nixOnDroidConfiguration {
|
device = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
config = ./nix-on-droid.nix;
|
modules = [ ./nix-on-droid.nix ];
|
||||||
system = "aarch64-linux";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue