Skip to content

Commit

Permalink
nixos/hysteria: set default = null for all options
Browse files Browse the repository at this point in the history
  • Loading branch information
eum3l committed Jun 2, 2024
1 parent 471e898 commit 318e597
Show file tree
Hide file tree
Showing 3 changed files with 486 additions and 474 deletions.
61 changes: 36 additions & 25 deletions check/default.nix
Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
{ testers, hysteria, ... }:
{
testers,
hysteria,
...
}:
let
password = "apfelmus";
in
testers.runNixOSTest {
name = "hysteria";
nodes.machine =
{ ... }:
{
imports = [ hysteria ];
services.hysteria = {
server = {
enable = true;
settings = {
tls = {
cert = ./cert.crt;
key = ./priv.key;
};
auth = {
inherit password;
nodes = {
machine =
{ ... }:
{
imports = [ hysteria ];
services.hysteria = {
server = {
enable = true;
settings = {
tls = {
cert = ./cert.crt;
key = ./priv.key;
};
auth = {
inherit password;
};
};
};
};
client = {
enable = true;
settings = {
server = "127.0.0.1:443";
tls.insecure = true;
auth = password;
socks5.listen = "127.0.0.1:1080";
http.listen = "127.0.0.1:8080";
client = {
enable = true;
settings = {
server = "127.0.0.1:443";
tls.insecure = true;
auth = password;
socks5.listen = "127.0.0.1:1080";
http.listen = "127.0.0.1:8080";
};
};
};
};
};
loadtest =
{ ... }:
{
imports = [ hysteria ];
};
};

testScript = ''
machine.wait_for_unit("hysteria-server")
Expand Down
83 changes: 42 additions & 41 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ rec {
};

outputs =
{
self,
nixpkgs,
flake-utils,
src,
options-nix,
uspkgs,
{ self
, nixpkgs
, flake-utils
, src
, options-nix
, uspkgs
,
}:
let
platforms = [
Expand All @@ -39,47 +39,48 @@ rec {
"x86_64-darwin"
];
in
flake-utils.lib.eachSystem platforms (
system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnsupportedSystem = true;
};
in
rec {
formatter = uspkgs.legacyPackages.${system}.nixfmt-rfc-style;

packages = rec {
default = hysteria;
hysteria = pkgs.callPackage ./package.nix {
inherit platforms src;
inherit (self.inputs.src) lastModifiedDate rev;
version = pkgs.lib.removePrefix "app/v" inputs.src.ref;
flake-utils.lib.eachSystem platforms
(
system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnsupportedSystem = true;
};
in
rec {
formatter = uspkgs.legacyPackages.${system}.nixfmt-rfc-style;

packages = rec {
default = hysteria;
hysteria = pkgs.callPackage ./package.nix {
inherit platforms src;
inherit (self.inputs.src) lastModifiedDate rev;
version = pkgs.lib.removePrefix "app/v" inputs.src.ref;
};

options = options-nix.lib.${system}.mkOptionScript {
module = self.nixosModules.default;
modulePrefix = "services.hysteria";
options = options-nix.lib.${system}.mkOptionScript {
module = self.nixosModules.default;
modulePrefix = "services.hysteria";
};
};
};

checks.default = pkgs.callPackage ./check { hysteria = self.nixosModules.default; };
checks.default = pkgs.callPackage ./check { hysteria = self.nixosModules.default; };

devShells.default = pkgs.mkShellNoCC {
HYSTERIA_LOG_LEVEL = "debug";
HYSTERIA_TMP = "/tmp/hysteria";
devShells.default = pkgs.mkShellNoCC {
HYSTERIA_LOG_LEVEL = "debug";
HYSTERIA_TMP = "/tmp/hysteria";

inputsFrom = [ packages.hysteria ];
inputsFrom = [ packages.hysteria ];

shellHook = ''
rm -r $HYSTERIA_TMP
cp -r --no-preserve=mode,ownership ${src} $HYSTERIA_TMP
cd $HYSTERIA_TMP
'';
};
}
)
shellHook = ''
rm -r $HYSTERIA_TMP
cp -r --no-preserve=mode,ownership ${src} $HYSTERIA_TMP
cd $HYSTERIA_TMP
'';
};
}
)
// {
nixosModules.default = import ./module.nix self.packages;

Expand Down
Loading

0 comments on commit 318e597

Please sign in to comment.