mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
airlift: add module
This commit is contained in:
parent
6238bbc0ae
commit
8a1357854d
4 changed files with 90 additions and 0 deletions
53
modules/programs/airlift.nix
Normal file
53
modules/programs/airlift.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
;
|
||||
|
||||
cfg = config.programs.airlift;
|
||||
yamlFormat = pkgs.formats.yaml { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||
options.programs.airlift = {
|
||||
enable = mkEnableOption "airlift";
|
||||
package = mkPackageOption pkgs "airlift" { nullable = true; };
|
||||
settings = mkOption {
|
||||
inherit (yamlFormat) type;
|
||||
default = { };
|
||||
example = {
|
||||
dag_path = "/path/to/dags";
|
||||
plugin_path = "/path/to/plugins";
|
||||
requirements_file = "/path/to/requirements.txt";
|
||||
helm_values_file = "/path/to/values.yaml";
|
||||
extra_volume_mounts = [
|
||||
"hostPath=/my/cool/path,containerPath=/my/mounted/path,name=a_unique_name"
|
||||
];
|
||||
cluster_config_file = "/path/to/cluster/config.yaml";
|
||||
image = "apache/airflow:2.6.0";
|
||||
helm_chart_version = "1.0.0";
|
||||
port = 8080;
|
||||
post_start_dag_id = "example_dag_id";
|
||||
};
|
||||
description = ''
|
||||
Configuration settings for airlift. All the available options can be found here:
|
||||
<https://artifacthub.io/packages/helm/apache-airflow/airflow?modal=values>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
home.file.".config/airlift/config.yaml" = mkIf (cfg.settings != { }) {
|
||||
source = yamlFormat.generate "airlift-config.yaml" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
11
tests/modules/programs/airlift/config.yaml
Normal file
11
tests/modules/programs/airlift/config.yaml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
cluster_config_file: /path/to/cluster/config.yaml
|
||||
dag_path: /path/to/dags
|
||||
extra_volume_mounts:
|
||||
- hostPath=/my/cool/path,containerPath=/my/mounted/path,name=a_unique_name
|
||||
helm_chart_version: 1.0.0
|
||||
helm_values_file: /path/to/values.yaml
|
||||
image: apache/airflow:2.6.0
|
||||
plugin_path: /path/to/plugins
|
||||
port: 8080
|
||||
post_start_dag_id: example_dag_id
|
||||
requirements_file: /path/to/requirements.txt
|
||||
1
tests/modules/programs/airlift/default.nix
Normal file
1
tests/modules/programs/airlift/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ airlift-settings = ./settings.nix; }
|
||||
25
tests/modules/programs/airlift/settings.nix
Normal file
25
tests/modules/programs/airlift/settings.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
programs.airlift = {
|
||||
enable = true;
|
||||
settings = {
|
||||
dag_path = "/path/to/dags";
|
||||
plugin_path = "/path/to/plugins";
|
||||
requirements_file = "/path/to/requirements.txt";
|
||||
helm_values_file = "/path/to/values.yaml";
|
||||
extra_volume_mounts = [
|
||||
"hostPath=/my/cool/path,containerPath=/my/mounted/path,name=a_unique_name"
|
||||
];
|
||||
cluster_config_file = "/path/to/cluster/config.yaml";
|
||||
image = "apache/airflow:2.6.0";
|
||||
helm_chart_version = "1.0.0";
|
||||
port = 8080;
|
||||
post_start_dag_id = "example_dag_id";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/airlift/config.yaml
|
||||
assertFileContent home-files/.config/airlift/config.yaml \
|
||||
${./config.yaml}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue