fix: wireguard config file permission issue

This commit is contained in:
DACHXY 2025-01-03 14:33:27 +08:00
parent 1c2b263904
commit 945f767d08
6 changed files with 33 additions and 24 deletions

View file

@ -41,6 +41,9 @@
## 🌐 VPN ## 🌐 VPN
- Wireguard (You need put your own `wg0.conf` file) - Wireguard (You need put your own `wg0.conf` file)
.
> NOTE: If import `wireguard.nix` without config file, the Build will fail.
--- ---

View file

@ -40,7 +40,6 @@
outputs = outputs =
{ {
self,
nixpkgs, nixpkgs,
nix-index-database, nix-index-database,
... ...
@ -48,6 +47,11 @@
let let
system = "x86_64-linux"; system = "x86_64-linux";
nix-version = "25.05"; nix-version = "25.05";
username = "danny";
git-config = {
username = "DACHXY";
email = "danny10132024@gmail.com";
};
in in
{ {
nixosConfigurations = { nixosConfigurations = {
@ -57,7 +61,13 @@
./system/dev/dn-pre7780 ./system/dev/dn-pre7780
]; ];
specialArgs = { specialArgs = {
inherit inputs system nix-version; inherit
inputs
system
nix-version
username
git-config
;
}; };
}; };
@ -67,7 +77,13 @@
./system/dev/dn-lap ./system/dev/dn-lap
]; ];
specialArgs = { specialArgs = {
inherit inputs system nix-version; inherit
inputs
system
nix-version
username
git-config
;
}; };
}; };
}; };

View file

@ -1,4 +1,4 @@
{ git-config }: { git-config, ... }:
let let
userName = git-config.username; userName = git-config.username;
email = git-config.email; email = git-config.email;

View file

@ -3,16 +3,13 @@
system, system,
inputs, inputs,
nix-version, nix-version,
git-config,
username,
... ...
}: }:
let let
cursor-size = "24"; cursor-size = "24";
username = "danny";
git-config = {
username = "DACHXY";
email = "danny10132024@gmail.com";
};
in in
{ {
imports = [ imports = [

View file

@ -3,16 +3,13 @@
inputs, inputs,
system, system,
nix-version, nix-version,
git-config,
username,
... ...
}: }:
let let
cursor-size = "32"; cursor-size = "32";
username = "danny";
git-config = {
username = "DACHXY";
email = "danny10132024@gmail.com";
};
in in
{ {
imports = [ imports = [

View file

@ -1,16 +1,12 @@
{ ... }: { lib, ... }:
let let
configPath = "/etc/wireguard/wg0.conf"; configPath = "/etc/wireguard/wg0.conf";
in in
{ {
networking.firewall = { networking = {
allowedUDPPorts = [ 51820 ]; firewall = {
allowedUDPPorts = [ 51820 ];
};
wg-quick.interfaces.wg0.configFile = configPath;
}; };
networking.wg-quick.interfaces.wg0 =
if builtins.pathExists configPath then
{
configFile = configPath;
}
else
{ };
} }