mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
Add --file argument for nix-on-droid
This commit is contained in:
parent
38e7b238ae
commit
daf69b959d
3 changed files with 19 additions and 10 deletions
|
|
@ -1,26 +1,26 @@
|
|||
# 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 ? { } }:
|
||||
{ pkgs ? import <nixpkgs> { }, config ? null }:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
homeDir = builtins.getEnv "HOME";
|
||||
configFile = homeDir + "/.config/nixpkgs/nix-on-droid.nix";
|
||||
defaultConfigFile = "${builtins.getEnv "HOME"}/.config/nixpkgs/nix-on-droid.nix";
|
||||
|
||||
hasConfigFile = builtins.pathExists configFile;
|
||||
configModule =
|
||||
if config != null then config
|
||||
else if builtins.pathExists defaultConfigFile then defaultConfigFile
|
||||
else if pkgs.config ? nix-on-droid then pkgs.config.nix-on-droid
|
||||
else throw "No config file found! Create one in ~/.config/nixpkgs/nix-on-droid.nix";
|
||||
|
||||
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;
|
||||
configModule
|
||||
] ++ import ./module-list.nix;
|
||||
};
|
||||
|
||||
failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue