summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2024-03-12 18:06:52 +0000
committerAkshay <[email protected]>2024-03-12 18:06:52 +0000
commit841f1b5e9d6022bbe07825d06861ccb4f73cfa41 (patch)
tree0b1407616fb3246d7a2a3f7f2d66a79a993dd952
parent6798a20e5482b574c8e02e5ff260d72ea6431a29 (diff)
add service
-rw-r--r--.gitignore1
-rw-r--r--flake.nix42
2 files changed, 43 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b2be92b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
result
diff --git a/flake.nix b/flake.nix
index 742af2f..6d629dd 100644
--- a/flake.nix
+++ b/flake.nix
@@ -136,6 +136,48 @@
136 inherit (nixpkgsFor."${system}") flaresolverr; 136 inherit (nixpkgsFor."${system}") flaresolverr;
137 }); 137 });
138 138
139 nixosModules.default = { config, pkgs, lib, ... }:
140 with lib;
141 let
142 cfg = config.services.flaresolverr;
143 in
144 {
145 options = {
146 services.flaresolverr = {
147 enable = mkOption {
148 default = false;
149 description = ''
150 Whether to enable flaresolverr.
151 '';
152 };
153 };
154
155 openFirewall = mkOption {
156 type = types.bool;
157 default = false;
158 };
159 };
160
161 config = mkIf cfg.enable {
162
163 systemd.services.flaresolverr = {
164 description = "FlareSolverr";
165 after = [ "network.target" ];
166 wantedBy = [ "multi-user.target" ];
167
168 serviceConfig = {
169 Type = "simple";
170 ExecStart = "${pkgs.flaresolverr}/bin/flaresolverr";
171 Restart = "on-failure";
172 };
173 };
174
175 networking.firewall = mkIf cfg.openFirewall {
176 allowedTCPPorts = [ 8191 ];
177 };
178 };
179 };
180
139 defaultPackage = forAllSystems (system: self.packages."${system}".flaresolverr); 181 defaultPackage = forAllSystems (system: self.packages."${system}".flaresolverr);
140 182
141 }; 183 };