From bbd699d7b133092c1fb4bb11f558db4db3113af2 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Fri, 3 Mar 2023 20:04:39 +0000 Subject: [PATCH] add module for device-specific config in principle this module declares the config that's defined in devices/foo/default.nix --- default.nix | 1 + modules/base.nix | 27 --------------------------- modules/hardware.nix | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 27 deletions(-) create mode 100644 modules/hardware.nix diff --git a/default.nix b/default.nix index b679f57..9c90e74 100644 --- a/default.nix +++ b/default.nix @@ -20,6 +20,7 @@ let config = (pkgs.lib.evalModules { modules = [ { _module.args = { inherit pkgs; lib = pkgs.lib; }; } + ./modules/hardware.nix ./modules/base.nix device.module liminix-config diff --git a/modules/base.nix b/modules/base.nix index 435f38e..ab13e0a 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -52,38 +52,11 @@ in { type = types.attrsOf types.anything; }; boot = { - dts = { - src = mkOption { type = types.path; }; - includes = mkOption { - default = []; - type = types.listOf types.path; - }; - }; commandLine = mkOption { type = types.listOf types.nonEmptyStr; 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 = { defaultProfile.packages = with pkgs; diff --git a/modules/hardware.nix b/modules/hardware.nix new file mode 100644 index 0000000..9ec16fe --- /dev/null +++ b/modules/hardware.nix @@ -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; + }; + }; + }; +}