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
aa69103026
commit
da878afb9d
10 changed files with 43 additions and 30 deletions
|
|
@ -16,6 +16,9 @@
|
|||
* Fix usage of `extraSpecialArgs`: All values were previously set in
|
||||
`_module.args` instead of passing them as `specialArgs` into `evalModules`.
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -193,8 +193,7 @@ A minimal example could look like the following:
|
|||
outputs = { self, nixpkgs, nix-on-droid }: {
|
||||
|
||||
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
system = "aarch64-linux";
|
||||
config = ./nix-on-droid.nix;
|
||||
modules = [ ./nix-on-droid.nix ];
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
30
flake.nix
30
flake.nix
|
|
@ -72,20 +72,36 @@
|
|||
formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgsFor.${system});
|
||||
|
||||
lib.nixOnDroidConfiguration =
|
||||
{ config
|
||||
, system ? "aarch64-linux" # unused, only supported variant
|
||||
, extraModules ? [ ]
|
||||
{ modules ? [ ]
|
||||
, extraSpecialArgs ? { }
|
||||
, pkgs ? pkgs'
|
||||
, 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"
|
||||
else
|
||||
import ./modules {
|
||||
inherit config extraModules extraSpecialArgs home-manager-path pkgs;
|
||||
pkgs.lib.throwIf
|
||||
(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;
|
||||
};
|
||||
});
|
||||
|
||||
overlays.default = overlay;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||
|
||||
{ config ? null
|
||||
, extraModules ? [ ]
|
||||
, extraSpecialArgs ? { }
|
||||
, pkgs ? import <nixpkgs> { }
|
||||
, home-manager-path ? <home-manager>
|
||||
|
|
@ -21,7 +20,7 @@ let
|
|||
nodModules = import ./module-list.nix { inherit pkgs home-manager-path isFlake; };
|
||||
|
||||
rawModule = evalModules {
|
||||
modules = [ configModule ] ++ extraModules ++ nodModules;
|
||||
modules = [ configModule ] ++ nodModules;
|
||||
specialArgs = extraSpecialArgs;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,16 @@ let
|
|||
modules = import ../modules {
|
||||
inherit pkgs;
|
||||
|
||||
extraModules = [ ../modules/build/initial-build.nix ];
|
||||
extraSpecialArgs = {
|
||||
isFlake = true;
|
||||
|
||||
config = {
|
||||
imports = [ ../modules/build/initial-build.nix ];
|
||||
|
||||
_module.args = {
|
||||
inherit initialPackageInfo;
|
||||
pkgs = pkgs.lib.mkForce pkgs; # to override ./modules/nixpkgs/config.nix
|
||||
};
|
||||
|
||||
isFlake = true;
|
||||
|
||||
config = {
|
||||
# Fix invoking bash after initial build.
|
||||
user.shell = "${initialPackageInfo.bash}/bin/bash";
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,10 @@
|
|||
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
|
||||
|
||||
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
system = "aarch64-linux";
|
||||
config = ./nix-on-droid.nix;
|
||||
modules = [
|
||||
./nix-on-droid.nix
|
||||
|
||||
# list of extra modules for nix-on-droid system
|
||||
extraModules = [
|
||||
# { nix.registry.nixpkgs.flake = nixpkgs; }
|
||||
# ./path/to/module.nix
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@
|
|||
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
|
||||
|
||||
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
system = "aarch64-linux";
|
||||
config = ./nix-on-droid.nix;
|
||||
modules = [ ./nix-on-droid.nix ];
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@
|
|||
outputs = { self, nixpkgs, nix-on-droid }: {
|
||||
|
||||
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
system = "aarch64-linux";
|
||||
config = ./nix-on-droid.nix;
|
||||
modules = [ ./nix-on-droid.nix ];
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@
|
|||
outputs = { nix-on-droid, ... }: {
|
||||
nixOnDroidConfigurations = {
|
||||
device = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
config = ./nix-on-droid.nix;
|
||||
system = "aarch64-linux";
|
||||
modules = [ ./nix-on-droid.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@
|
|||
outputs = { nix-on-droid, ... }: {
|
||||
nixOnDroidConfigurations = {
|
||||
device = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
config = ./nix-on-droid.nix;
|
||||
system = "aarch64-linux";
|
||||
modules = [ ./nix-on-droid.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue