forked from fediversity/fediversity
		
	closes #93. note that this includes classes: - `nixos` - `nixosTest` - `nixops4Resource` - `nixops4Deployment` .. and my (made-up, as per the [docs](https://ryantm.github.io/nixpkgs/module-system/module-system/#module-system-lib-evalModules-param-class)): - `nix-unit` - `package` .. while i did not manage to cover: - service tests, given `pkgs.nixosTest` seemed to not actually like `_class = "nixosTest"` (?!) ... nor #93's mentioned destructured arguments for that matter, as per Fediversity/Fediversity#93 (comment) - let me know if that is still desired as well. Reviewed-on: Fediversity/Fediversity#398 Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Kiara Grouwstra <kiara@procolix.eu> Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
## NOTE: Not a module, but a helper function to create options for Fediversity
 | 
						|
## services, as they tend to require the same ones.
 | 
						|
 | 
						|
{
 | 
						|
  config,
 | 
						|
  lib,
 | 
						|
  serviceName,
 | 
						|
  serviceDocName,
 | 
						|
}:
 | 
						|
 | 
						|
let
 | 
						|
  inherit (lib) mkOption mkEnableOption;
 | 
						|
  inherit (lib.types) types;
 | 
						|
 | 
						|
in
 | 
						|
{
 | 
						|
  _class = "nixos";
 | 
						|
 | 
						|
  enable = mkEnableOption "Enable a ${serviceDocName} server on the machine";
 | 
						|
 | 
						|
  s3AccessKeyFile = mkOption {
 | 
						|
    type = types.nullOr types.path;
 | 
						|
    description = ''
 | 
						|
      S3 access key for ${serviceDocName}'s bucket/s
 | 
						|
 | 
						|
      In AWS CLI, this would be AWS_ACCESS_KEY_ID. The S3 bucket is only created
 | 
						|
      when non-`null`.
 | 
						|
    '';
 | 
						|
    default = null;
 | 
						|
  };
 | 
						|
 | 
						|
  s3SecretKeyFile = mkOption {
 | 
						|
    type = types.nullOr types.path;
 | 
						|
    description = ''
 | 
						|
      S3 secret key for ${serviceDocName}'s bucket/s
 | 
						|
 | 
						|
      In AWS CLI, this would be AWS_SECRET_ACCESS_KEY. The S3 bucket is only
 | 
						|
      created when non-`null`.
 | 
						|
    '';
 | 
						|
    default = null;
 | 
						|
  };
 | 
						|
 | 
						|
  domain = mkOption {
 | 
						|
    type = types.str;
 | 
						|
    description = "Internal option — change at your own risk";
 | 
						|
    default = "${serviceName}.${config.fediversity.domain}";
 | 
						|
  };
 | 
						|
}
 |