1
0
Fork 0
nixos-config/home-manager/roles/kassandra.nix

34 lines
1.1 KiB
Nix
Raw Normal View History

2022-03-08 01:42:46 +00:00
{pkgs, ...}: let
dhallFiles = pkgs.runCommand "kassandra-config-src" {} ''
2021-04-27 12:26:09 +00:00
mkdir $out
2021-11-26 19:07:33 +00:00
${pkgs.kassandra}/bin/kassandra2 print-types > $out/types.dhall
2021-04-27 12:26:09 +00:00
ln -s ${./kassandra}/{config,backend}.dhall $out
2021-05-01 00:26:42 +00:00
ln -s ${pkgs.privateFile "kassandra-uiConfig.dhall"} $out/uiConfig.dhall
2021-04-27 12:26:09 +00:00
'';
backend = pkgs.dhallPackages.buildDhallPackage {
name = "kassandra-backend-config";
code = "${dhallFiles}/backend.dhall : (${dhallFiles}/types.dhall).BackendConfig";
source = true;
2022-03-08 01:42:46 +00:00
dependencies = [pkgs.dhallPackages.Prelude];
2021-04-27 12:26:09 +00:00
};
standalone = pkgs.dhallPackages.buildDhallPackage {
name = "kassandra-standalone-config";
code = "${dhallFiles}/config.dhall : (${dhallFiles}/types.dhall).StandaloneConfig";
source = true;
2022-03-08 01:42:46 +00:00
dependencies = [pkgs.dhallPackages.Prelude];
2021-04-27 12:26:09 +00:00
};
2022-03-08 01:42:46 +00:00
dhallResult = pkgs.runCommand "kassandra-config" {} ''
2021-04-27 12:26:09 +00:00
mkdir $out
ln -s ${backend}/source.dhall $out/backend.dhall
ln -s ${standalone}/source.dhall $out/config.dhall
'';
2022-03-08 01:42:46 +00:00
in {
2021-07-05 19:18:23 +00:00
xdg.configFile =
2022-03-08 01:42:46 +00:00
if pkgs.withSecrets
then {
2021-07-05 19:18:23 +00:00
kassandra.source = dhallResult.out;
2022-03-08 01:42:46 +00:00
}
else {};
2021-04-26 02:43:01 +00:00
}