Added sharkey-service nixos module

This commit is contained in:
Werner Kroneman 2024-12-05 15:33:12 +02:00
parent 73c128dbcb
commit 03df443aa8
2 changed files with 7 additions and 31 deletions

View file

@ -3,36 +3,9 @@
outputs = { self, nixpkgs }: {
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
[
( import ./sharkey-service.nix )
({ pkgs, ... }: {
boot.isContainer = true;
nixosModules.sharkey-service = args : import ./sharkey-service.nix ( args // { sharkey = self.packages.sharkey; } );
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
# Network configuration.
networking.useDHCP = false;
networking.firewall.allowedTCPPorts = [ 3000 ];
system.stateVersion = "24.04";
services.sharkey = {
enable = true;
package = (pkgs.callPackage ./sharkey.nix {});
settings = {
url = "https://sharkey.localhost";
};
redis.createLocally = true;
database.createLocally = true;
};
})
];
};
packages."x86_64-linux".sharkey = nixpkgs.legacyPackages."x86_64-linux".callPackage ./sharkey.nix { };
};
}

View file

@ -2,6 +2,7 @@
config,
pkgs,
lib,
sharkey,
...
}:
@ -186,9 +187,11 @@ in
{
options = {
services.sharkey = {
enable = lib.mkEnableOption "sharkey";
package = (pkgs.callPackage ./sharkey.nix { });
inherit settings;
database = {
createLocally = lib.mkOption {
@ -340,7 +343,7 @@ in
${pkgs.replace-secret}/bin/replace-secret '@MEILISEARCH_KEY@' "${cfg.meilisearch.keyFile}" /run/sharkey/default.yml
'');
serviceConfig = {
ExecStart = "${cfg.package}/bin/sharkey migrateandstart";
ExecStart = "${sharkey}/bin/sharkey migrateandstart";
RuntimeDirectory = "sharkey";
RuntimeDirectoryMode = "700";
StateDirectory = "sharkey";