aboutsummaryrefslogtreecommitdiff
path: root/modules/onboard/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/onboard/default.nix')
-rw-r--r--modules/onboard/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/modules/onboard/default.nix b/modules/onboard/default.nix
new file mode 100644
index 0000000..4af7573
--- /dev/null
+++ b/modules/onboard/default.nix
@@ -0,0 +1,49 @@
+{ config, pkgs, lib, ... }:
+with builtins // lib;
+let
+ cfg = config.onboard;
+in {
+ options.onboard = {
+
+ file = mkOption {
+ default = {};
+ type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {}));
+ apply = filterAttrs (_: v: v.enable);
+ };
+
+ devicePath = mkOption {
+ type = types.str;
+ readOnly = true;
+ internal = true;
+ default = "/mnt/onboard";
+ };
+
+ _createdFiles = mkOption {
+ type = types.package;
+ internal = true;
+ readOnly = true;
+ default = pkgs.buildEnv {
+ name = "onboard-files-created";
+ paths = mapAttrsToList (_: v: v._package) cfg.file;
+ extraPrefix = cfg.devicePath;
+ };
+ };
+
+ finalPackage = mkOption {
+ type = types.package;
+ readOnly = true;
+ internal = true;
+ default = pkgs.mergePaths {
+ name = "onboard-package";
+ paths = [
+ cfg._createdFiles
+ ];
+ };
+ };
+ };
+
+ config = {
+ koboroot.include = mkAfter [ cfg.finalPackage ];
+ };
+
+}