Add option
This commit is contained in:
		
							parent
							
								
									7d23fc01f0
								
							
						
					
					
						commit
						3687c94430
					
				
							
								
								
									
										25
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								flake.nix
									
									
									
									
									
								
							@ -38,9 +38,27 @@
 | 
				
			|||||||
        config = {
 | 
					        config = {
 | 
				
			||||||
          baseDomain = mkOption {
 | 
					          baseDomain = mkOption {
 | 
				
			||||||
            type = types.str;
 | 
					            type = types.str;
 | 
				
			||||||
            description = "Base domain";
 | 
					            description = "Base domain.";
 | 
				
			||||||
          };
 | 
					          };
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        users = mkOption {
 | 
				
			||||||
 | 
					          default = {};
 | 
				
			||||||
 | 
					          type = types.attrsOf (types.submodule {
 | 
				
			||||||
 | 
					            password = mkOption {
 | 
				
			||||||
 | 
					              type = types.str;
 | 
				
			||||||
 | 
					              default = null;
 | 
				
			||||||
 | 
					              description = "API password for the user";
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					          });
 | 
				
			||||||
 | 
					          example = literalExpression ''
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "exampleuser" = {
 | 
				
			||||||
 | 
					                password = "insecure";
 | 
				
			||||||
 | 
					              };
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          '';
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      config = mkIf cfg.enable {
 | 
					      config = mkIf cfg.enable {
 | 
				
			||||||
@ -50,7 +68,10 @@
 | 
				
			|||||||
          serviceConfig = let pkg = self.packages.${pkgs.system}.default;
 | 
					          serviceConfig = let pkg = self.packages.${pkgs.system}.default;
 | 
				
			||||||
          in {
 | 
					          in {
 | 
				
			||||||
            Restart = "on-failure";
 | 
					            Restart = "on-failure";
 | 
				
			||||||
            ExecStart = "${pkg}/bin/norbert ${toINI cfg.config}";
 | 
					            ExecStart = "${pkg}/bin/norbert ${pkgs.writeText "config" (generators.toINIWithGlobalSection {} {
 | 
				
			||||||
 | 
					              globalSection = cfg.config;
 | 
				
			||||||
 | 
					              sections = cfg.users;
 | 
				
			||||||
 | 
					            })}";
 | 
				
			||||||
            DynamicUser = "yes";
 | 
					            DynamicUser = "yes";
 | 
				
			||||||
          };
 | 
					          };
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user