twingate: PR comments' fixes

This commit is contained in:
anton
2023-07-26 14:41:01 +03:00
parent 6a5370f0f1
commit 946d940eba
2 changed files with 18 additions and 19 deletions
+13 -17
View File
@@ -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;
services.resolved.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.
};
}
@@ -8,6 +8,7 @@
, udev
, cryptsetup
, stdenv
, nixosTests
}:
stdenv.mkDerivation rec {
@@ -16,7 +17,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "https://binaries.twingate.com/client/linux/DEB/x86_64/${version}/twingate-amd64.deb";
sha256 = "acf623192ae348d49d8cc6513f419dedaf65442f88d3aa0ebd964450427ab399";
hash = "sha256-rPYjGSrjSNSdjMZRP0Gd7a9lRC+I06oOvZZEUEJ6s5k=";
};
buildInputs = [ dbus curl libnl udev cryptsetup ];
@@ -41,11 +42,13 @@ stdenv.mkDerivation rec {
mv usr/share $out/share
'';
passthru.tests = { inherit (nixosTests) twingate; };
meta = with lib; {
description = "Twingate Client";
homepage = "https://twingate.com";
license = licenses.unfree;
maintainers = with maintainers; [ tonyshkurenko ];
platforms = platforms.linux;
platforms = [ "x86_64-linux" ];
};
}