41 lines
		
	
	
	
		
			987 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			987 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  lib,
 | 
						|
  pkgs,
 | 
						|
  config,
 | 
						|
  ...
 | 
						|
}: {
 | 
						|
  options.programs.makemkv = {
 | 
						|
    enable = lib.mkEnableOption "enable makemkv";
 | 
						|
    appKeyFile = lib.mkOption {
 | 
						|
      type = lib.types.str;
 | 
						|
    };
 | 
						|
    destinationDir = lib.mkOption {
 | 
						|
      type = lib.types.str;
 | 
						|
    };
 | 
						|
  };
 | 
						|
 | 
						|
  config = lib.mkIf config.programs.makemkv.enable (lib.mkMerge [
 | 
						|
    {
 | 
						|
      home.packages = with pkgs; [
 | 
						|
        makemkv
 | 
						|
      ];
 | 
						|
 | 
						|
      sops.templates."MakeMKV.settings.conf".content = ''
 | 
						|
        app_DestinationDir = "${config.programs.makemkv.destinationDir}"
 | 
						|
        app_DestinationType = "2"
 | 
						|
        app_Key = "${config.programs.makemkv.appKeyFile}"
 | 
						|
      '';
 | 
						|
 | 
						|
      home.file.".MakeMKV/settings.conf".source = config.lib.file.mkOutOfStoreSymlink config.sops.templates."MakeMKV.settings.conf".path;
 | 
						|
    }
 | 
						|
    (
 | 
						|
      lib.mkIf config.impermanence.enable {
 | 
						|
        home.persistence."/persist${config.home.homeDirectory}" = {
 | 
						|
          directories = [
 | 
						|
            ".MakeMKV"
 | 
						|
          ];
 | 
						|
        };
 | 
						|
      }
 | 
						|
    )
 | 
						|
  ]);
 | 
						|
}
 |