nix: break out appview module into separate file #214

merged
opened by oppi.li targeting master from push-mlxxvvqpzvlw
Changed files
+46 -46
nix
modules
+1 -46
flake.nix
···
};
});
-
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,
···
})
];
};
+
nixosModules.appview = import ./nix/modules/appview.nix {inherit self;};
};
}
+45
nix/modules/appview.nix
···
+
{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;
+
};
+
};
+
};
+
}