Add --file argument for nix-on-droid

This commit is contained in:
Tobias Happ 2020-01-06 01:03:07 +01:00 committed by Alexander Sosedkin
parent 38e7b238ae
commit daf69b959d
3 changed files with 19 additions and 10 deletions

View file

@ -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);