mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
Add modules
This commit is contained in:
parent
5cc656fffc
commit
f40362898a
19 changed files with 1045 additions and 0 deletions
39
modules/default.nix
Normal file
39
modules/default.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||
|
||||
{ pkgs ? import <nixpkgs> { }, initialBuild ? false, config ? { } }:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
homeDir = builtins.getEnv "HOME";
|
||||
configFile = homeDir + "/.config/nixpkgs/nix-on-droid.nix";
|
||||
|
||||
hasConfigFile = builtins.pathExists configFile;
|
||||
|
||||
rawModule = evalModules {
|
||||
modules = [
|
||||
{
|
||||
_module.args = { inherit pkgs; };
|
||||
}
|
||||
]
|
||||
++ optional (!initialBuild && hasConfigFile) configFile
|
||||
++ optional (!initialBuild && !hasConfigFile && pkgs.config ? nix-on-droid) pkgs.config.nix-on-droid
|
||||
++ optional initialBuild config
|
||||
++ import ./module-list.nix;
|
||||
};
|
||||
|
||||
failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions);
|
||||
|
||||
module =
|
||||
if failedAssertions != []
|
||||
then throw "\nFailed assertions:\n${concatMapStringsSep "\n" (x: "- ${x}") failedAssertions}"
|
||||
else showWarnings rawModule.config.warnings rawModule;
|
||||
in
|
||||
|
||||
if initialBuild
|
||||
then module.config
|
||||
else {
|
||||
inherit (module.config.build) activationPackage;
|
||||
inherit (module.config.environment) path;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue