From 9f8e719b483c60e80b5dceda833ca6e66ed57b54 Mon Sep 17 00:00:00 2001 From: DavHau Date: Wed, 10 Jan 2024 17:10:10 +0700 Subject: [PATCH] state: move options clanCore.state to a separate file --- nixosModules/clanCore/backups.nix | 31 +++---------------------------- nixosModules/clanCore/state.nix | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 nixosModules/clanCore/state.nix diff --git a/nixosModules/clanCore/backups.nix b/nixosModules/clanCore/backups.nix index 0c565faf0..44d6f4fe2 100644 --- a/nixosModules/clanCore/backups.nix +++ b/nixosModules/clanCore/backups.nix @@ -1,33 +1,8 @@ { lib, ... }: { - options.clanCore.state = lib.mkOption { - default = { }; - type = lib.types.attrsOf - (lib.types.submodule ({ ... }: { - options = { - folders = lib.mkOption { - type = lib.types.listOf lib.types.str; - description = '' - Folder where state resides in - ''; - }; - preRestoreScript = lib.mkOption { - type = lib.types.str; - default = ":"; - description = '' - script to run before restoring the state dir from a backup - ''; - }; - postRestoreScript = lib.mkOption { - type = lib.types.str; - default = ":"; - description = '' - script to restore the service after the state dir was restored from a backup - ''; - }; - }; - })); - }; + imports = [ + ./state.nix + ]; options.clanCore.backups = { providers = lib.mkOption { type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: { diff --git a/nixosModules/clanCore/state.nix b/nixosModules/clanCore/state.nix new file mode 100644 index 000000000..9d9f39444 --- /dev/null +++ b/nixosModules/clanCore/state.nix @@ -0,0 +1,31 @@ +{ lib, ... }: +{ + options.clanCore.state = lib.mkOption { + default = { }; + type = lib.types.attrsOf + (lib.types.submodule ({ ... }: { + options = { + folders = lib.mkOption { + type = lib.types.listOf lib.types.str; + description = '' + Folder where state resides in + ''; + }; + preRestoreScript = lib.mkOption { + type = lib.types.str; + default = ":"; + description = '' + script to run before restoring the state dir from a backup + ''; + }; + postRestoreScript = lib.mkOption { + type = lib.types.str; + default = ":"; + description = '' + script to restore the service after the state dir was restored from a backup + ''; + }; + }; + })); + }; +}