Skip to content

Commit

Permalink
nixos/services.v2ray: remove with lib;
Browse files Browse the repository at this point in the history
  • Loading branch information
Stunkymonkey committed Dec 30, 2024
1 parent d2df78d commit 12cb5fe
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions nixos/modules/services/networking/v2ray.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{ config, lib, pkgs, ... }:

with lib;

let
json = pkgs.formats.json { };
in {
options = {

services.v2ray = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to run v2ray server.
Expand All @@ -18,10 +15,10 @@ in {
'';
};

package = mkPackageOption pkgs "v2ray" { };
package = lib.mkPackageOption pkgs "v2ray" { };

configFile = mkOption {
type = types.nullOr types.str;
configFile = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "/etc/v2ray/config.json";
description = ''
Expand All @@ -33,8 +30,8 @@ in {
'';
};

config = mkOption {
type = types.nullOr json.type;
config = lib.mkOption {
type = lib.types.nullOr json.type;
default = null;
example = {
inbounds = [{
Expand Down Expand Up @@ -70,7 +67,7 @@ in {
'';
};

in mkIf cfg.enable {
in lib.mkIf cfg.enable {
assertions = [
{
assertion = (cfg.configFile == null) != (cfg.config == null);
Expand Down

0 comments on commit 12cb5fe

Please sign in to comment.