mirror of
https://github.com/juspay/services-flake.git
synced 2024-09-11 12:26:04 +03:00
parent
2c1bbc1258
commit
14904d0b7f
@ -7,6 +7,8 @@
|
|||||||
path = builtins.path { path = ./example; filter = path: _: baseNameOf path == "flake.nix"; };
|
path = builtins.path { path = ./example; filter = path: _: baseNameOf path == "flake.nix"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lib = import ./nix/lib.nix;
|
||||||
|
|
||||||
# Config for https://github.com/srid/nixci
|
# Config for https://github.com/srid/nixci
|
||||||
# To run this, `nix run github:srid/nixci`
|
# To run this, `nix run github:srid/nixci`
|
||||||
nixci = let overrideInputs = { "services-flake" = ./.; }; in {
|
nixci = let overrideInputs = { "services-flake" = ./.; }; in {
|
||||||
|
@ -1,38 +1,7 @@
|
|||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
# Create an attrsOf module wrapper (`services.${name}`) around the given submodule.
|
inherit (import ./lib.nix) multiService;
|
||||||
#
|
in {
|
||||||
# where module filename is of form `${name}.nix`. The submodule takes this
|
|
||||||
# 'name' parameter, and is expected to set the final process-compose config in
|
|
||||||
# its `outputs.settings` option.
|
|
||||||
multiService = mod:
|
|
||||||
let
|
|
||||||
# Derive name from filename
|
|
||||||
name = lib.pipe mod [
|
|
||||||
builtins.baseNameOf
|
|
||||||
(lib.strings.splitString ".")
|
|
||||||
builtins.head
|
|
||||||
];
|
|
||||||
in
|
|
||||||
{ config, ... }: {
|
|
||||||
options.services.${name} = lib.mkOption {
|
|
||||||
description = ''
|
|
||||||
${name} service
|
|
||||||
'';
|
|
||||||
default = { };
|
|
||||||
type = lib.types.attrsOf (lib.types.submoduleWith {
|
|
||||||
specialArgs = { inherit pkgs; };
|
|
||||||
modules = [ mod ];
|
|
||||||
});
|
|
||||||
};
|
|
||||||
config.settings.imports =
|
|
||||||
lib.pipe config.services.${name} [
|
|
||||||
(lib.filterAttrs (_: cfg: cfg.enable))
|
|
||||||
(lib.mapAttrsToList (_: cfg: cfg.outputs.settings))
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = builtins.map multiService [
|
imports = builtins.map multiService [
|
||||||
./apache-kafka.nix
|
./apache-kafka.nix
|
||||||
./postgres.nix
|
./postgres.nix
|
||||||
|
32
nix/lib.nix
Normal file
32
nix/lib.nix
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
# Create an attrsOf module wrapper (`services.${name}`) around the given submodule.
|
||||||
|
#
|
||||||
|
# where module filename is of form `${name}.nix`. The submodule takes this
|
||||||
|
# 'name' parameter, and is expected to set the final process-compose config in
|
||||||
|
# its `outputs.settings` option.
|
||||||
|
multiService = mod:
|
||||||
|
{ config, pkgs, lib, ... }: let
|
||||||
|
# Derive name from filename
|
||||||
|
name = lib.pipe mod [
|
||||||
|
builtins.baseNameOf
|
||||||
|
(lib.strings.splitString ".")
|
||||||
|
builtins.head
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
options.services.${name} = lib.mkOption {
|
||||||
|
description = ''
|
||||||
|
${name} service
|
||||||
|
'';
|
||||||
|
default = { };
|
||||||
|
type = lib.types.attrsOf (lib.types.submoduleWith {
|
||||||
|
specialArgs = { inherit pkgs; };
|
||||||
|
modules = [ mod ];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
config.settings.imports =
|
||||||
|
lib.pipe config.services.${name} [
|
||||||
|
(lib.filterAttrs (_: cfg: cfg.enable))
|
||||||
|
(lib.mapAttrsToList (_: cfg: cfg.outputs.settings))
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user