From 4941f05f3eb2e1600733cbafcb5a34edfdf26e68 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Wed, 4 Jun 2025 20:49:05 +0100 Subject: [PATCH] nix: break out appview module into separate file Change-Id: mruwqrqloxynmsvzuyzxtnxlyqlzmsvt Signed-off-by: oppiliappan --- flake.nix | 47 +---------------------------------------- nix/modules/appview.nix | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 46 deletions(-) create mode 100644 nix/modules/appview.nix diff --git a/flake.nix b/flake.nix index 871153e..ee525ef 100644 --- a/flake.nix +++ b/flake.nix @@ -200,52 +200,6 @@ }; }); - nixosModules.appview = { - config, - pkgs, - lib, - ... - }: - with lib; { - options = { - services.tangled-appview = { - enable = mkOption { - type = types.bool; - default = false; - description = "Enable tangled appview"; - }; - port = mkOption { - type = types.int; - default = 3000; - description = "Port to run the appview on"; - }; - cookie_secret = mkOption { - type = types.str; - default = "00000000000000000000000000000000"; - description = "Cookie secret"; - }; - }; - }; - - config = mkIf config.services.tangled-appview.enable { - systemd.services.tangled-appview = { - description = "tangled appview service"; - wantedBy = ["multi-user.target"]; - - serviceConfig = { - ListenStream = "0.0.0.0:${toString config.services.tangled-appview.port}"; - ExecStart = "${self.packages.${pkgs.system}.appview}/bin/appview"; - Restart = "always"; - }; - - environment = { - TANGLED_DB_PATH = "appview.db"; - TANGLED_COOKIE_SECRET = config.services.tangled-appview.cookie_secret; - }; - }; - }; - }; - nixosModules.knot = { config, pkgs, @@ -448,5 +402,6 @@ }) ]; }; + nixosModules.appview = import ./nix/modules/appview.nix {inherit self;}; }; } diff --git a/nix/modules/appview.nix b/nix/modules/appview.nix new file mode 100644 index 0000000..0b7fe90 --- /dev/null +++ b/nix/modules/appview.nix @@ -0,0 +1,45 @@ +{self}: { + config, + pkgs, + lib, + ... +}: +with lib; { + options = { + services.tangled-appview = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable tangled appview"; + }; + port = mkOption { + type = types.int; + default = 3000; + description = "Port to run the appview on"; + }; + cookie_secret = mkOption { + type = types.str; + default = "00000000000000000000000000000000"; + description = "Cookie secret"; + }; + }; + }; + + config = mkIf config.services.tangled-appview.enable { + systemd.services.tangled-appview = { + description = "tangled appview service"; + wantedBy = ["multi-user.target"]; + + serviceConfig = { + ListenStream = "0.0.0.0:${toString config.services.tangled-appview.port}"; + ExecStart = "${self.packages.${pkgs.system}.appview}/bin/appview"; + Restart = "always"; + }; + + environment = { + TANGLED_DB_PATH = "appview.db"; + TANGLED_COOKIE_SECRET = config.services.tangled-appview.cookie_secret; + }; + }; + }; +} -- 2.43.0