add module for device-specific config

in principle this module declares the config that's defined in
devices/foo/default.nix
This commit is contained in:
Daniel Barlow 2023-03-03 20:04:39 +00:00
parent 0cd1bd99e1
commit bbd699d7b1
3 changed files with 37 additions and 27 deletions

View file

@ -20,6 +20,7 @@ let
config = (pkgs.lib.evalModules { config = (pkgs.lib.evalModules {
modules = [ modules = [
{ _module.args = { inherit pkgs; lib = pkgs.lib; }; } { _module.args = { inherit pkgs; lib = pkgs.lib; }; }
./modules/hardware.nix
./modules/base.nix ./modules/base.nix
device.module device.module
liminix-config liminix-config

View file

@ -52,38 +52,11 @@ in {
type = types.attrsOf types.anything; type = types.attrsOf types.anything;
}; };
boot = { boot = {
dts = {
src = mkOption { type = types.path; };
includes = mkOption {
default = [];
type = types.listOf types.path;
};
};
commandLine = mkOption { commandLine = mkOption {
type = types.listOf types.nonEmptyStr; type = types.listOf types.nonEmptyStr;
default = []; default = [];
}; };
}; };
device = {
defaultOutput = mkOption {
type = types.nonEmptyStr;
};
flash = {
address = mkOption { type = types.str; };
size = mkOption { type = types.str; };
};
loadAddress = mkOption { default = null; };
entryPoint = mkOption { };
radios = mkOption {
type = types.listOf types.str;
default = [];
example = ["ath9k" "ath10k"];
};
rootDevice = mkOption { };
networkInterfaces = mkOption {
type = types.attrsOf types.anything;
};
};
}; };
config = { config = {
defaultProfile.packages = with pkgs; defaultProfile.packages = with pkgs;

36
modules/hardware.nix Normal file
View file

@ -0,0 +1,36 @@
{ lib, pkgs, config, ...}:
let
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
in {
options = {
boot = {
dts = {
src = mkOption { type = types.path; };
includes = mkOption {
default = [];
type = types.listOf types.path;
};
};
};
device = {
defaultOutput = mkOption {
type = types.nonEmptyStr;
};
flash = {
address = mkOption { type = types.str; };
size = mkOption { type = types.str; };
};
loadAddress = mkOption { default = null; };
entryPoint = mkOption { };
radios = mkOption {
type = types.listOf types.str;
default = [];
example = ["ath9k" "ath10k"];
};
rootDevice = mkOption { };
networkInterfaces = mkOption {
type = types.attrsOf types.anything;
};
};
};
}