nixos/twingate: add package option and test
This commit is contained in:
parent
73d174c62b
commit
160edcf2c5
4 changed files with 27 additions and 17 deletions
|
@ -1,28 +1,24 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.twingate;
|
||||
|
||||
in {
|
||||
|
||||
in
|
||||
{
|
||||
options.services.twingate = {
|
||||
enable = mkEnableOption (lib.mdDoc "Twingate Client daemon");
|
||||
enable = lib.mkEnableOption (lib.mdDoc "Twingate Client daemon");
|
||||
package = lib.mkPackageOptionMD pkgs "twingate" { };
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.packages = [ cfg.package ];
|
||||
systemd.services.twingate = {
|
||||
preStart = "cp -r -n ${cfg.package}/etc/twingate/. /etc/twingate/";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
networking.firewall.checkReversePath = lib.mkDefault false;
|
||||
networking.networkmanager.enable = true;
|
||||
networking.firewall.checkReversePath = lib.mkDefault "loose";
|
||||
services.resolved.enable = !(config.networking.networkmanager.enable);
|
||||
|
||||
environment.systemPackages = [ pkgs.twingate ]; # for the CLI
|
||||
systemd.packages = [ pkgs.twingate ];
|
||||
|
||||
systemd.services.twingate.preStart = ''
|
||||
cp -r -n ${pkgs.twingate}/etc/twingate/. /etc/twingate/
|
||||
'';
|
||||
|
||||
systemd.services.twingate.wantedBy = [ "multi-user.target" ];
|
||||
environment.systemPackages = [ cfg.package ]; # For the CLI.
|
||||
};
|
||||
}
|
||||
|
|
|
@ -801,6 +801,7 @@ in {
|
|||
tuptime = handleTest ./tuptime.nix {};
|
||||
turbovnc-headless-server = handleTest ./turbovnc-headless-server.nix {};
|
||||
tuxguitar = handleTest ./tuxguitar.nix {};
|
||||
twingate = runTest ./twingate.nix;
|
||||
ucarp = handleTest ./ucarp.nix {};
|
||||
udisks2 = handleTest ./udisks2.nix {};
|
||||
ulogd = handleTest ./ulogd.nix {};
|
||||
|
|
10
nixos/tests/twingate.nix
Normal file
10
nixos/tests/twingate.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
name = "twingate";
|
||||
|
||||
nodes.machine.services.twingate.enable = true;
|
||||
|
||||
testScript = { nodes, ... }: ''
|
||||
machine.wait_for_unit("twingate.service")
|
||||
machine.succeed("twingate --version | grep '${nodes.machine.services.twingate.package.version}' >&2")
|
||||
'';
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
, udev
|
||||
, cryptsetup
|
||||
, stdenv
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -41,6 +42,8 @@ stdenv.mkDerivation rec {
|
|||
mv usr/share $out/share
|
||||
'';
|
||||
|
||||
passthru.tests = { inherit (nixosTests) twingate; };
|
||||
|
||||
meta = with lib; {
|
||||
description = "Twingate Client";
|
||||
homepage = "https://twingate.com";
|
||||
|
|
Loading…
Reference in a new issue