Skip to content

Commit

Permalink
fix: daed missing geo database (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
oluceps authored Mar 23, 2024
1 parent 0ad5d3c commit 9e021a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 25 additions & 2 deletions daed/module.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, pkgs, lib, ... }:

let
cfg = config.services.daed;
Expand All @@ -23,10 +23,26 @@ in

listen = mkOption {
type = types.str;
default = "0.0.0.0:2023";
default = "127.0.0.1:2023";
description = "The daed listen address.";
};

assetsPaths = mkOption {
type = with types; listOf str;
default = [
"${pkgs.v2ray-geoip}/share/v2ray/geoip.dat"
"${pkgs.v2ray-domain-list-community}/share/v2ray/geosite.dat"
];
description = ''
Geo database required to run daed.
Notice that this defines different from `assetsPath` in dae module.
This will be linked into `configDir`.
'';
example = ''
["/var/lib/dae/geoip.dat" "/home/who/geosite.dat"]
'';
};

openFirewall = mkOption {
type = with types; submodule {
options = {
Expand Down Expand Up @@ -84,6 +100,13 @@ in
"network-online.target"
];

preStart = ''
umask 0077
mkdir -p ${cfg.configDir}
${lib.foldl' (acc: elem: acc + elem + "\n") ""
(map (n: "ln -sfn ${n} ${cfg.configDir}")
cfg.assetsPaths)}
'';
serviceConfig = {
Type = "simple";
User = "root";
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
nixosModules = {
${n} = { pkgs, ... }: {
imports = [ ./${n}/module.nix ];
services.dae.package =
services.${n}.package =
withSystem pkgs.stdenv.hostPlatform.system ({ config, ... }:
config.packages.${n}
);
Expand Down

0 comments on commit 9e021a7

Please sign in to comment.