Ready for nix testing
This commit is contained in:
parent
afa0cd2218
commit
a50efdeea0
4 changed files with 187 additions and 95 deletions
27
flake.nix
27
flake.nix
|
@ -62,8 +62,7 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
|
|||
pname = "status_cloud";
|
||||
version = "0.1.0";
|
||||
buildAndTestSubdir = "status_cloud";
|
||||
cargoHash = "sha256-GpAWrgFBzOTBCfZy/Ehy7IszuSgSOc/4N
|
||||
2gbeed0jqI=";
|
||||
cargoHash = "sha256-2eSCxWKf2VH9escaWUDFcozJyyo4xt9SCgBPxlwckTk=";
|
||||
meta = meta // {
|
||||
description = "Server status saved to a nextcloud note service.";
|
||||
};
|
||||
|
@ -83,11 +82,10 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
|
|||
The status_cloud package that should be used.
|
||||
'';
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 3001;
|
||||
config_path = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = lib.mdDoc ''
|
||||
The port at which to run.
|
||||
The file path to the toml that contains user information secrets
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -96,16 +94,23 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
|
|||
pkg = self.packages.${system}.status_cloud;
|
||||
in lib.mkIf cfg.enable {
|
||||
description = pkg.meta.description;
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = ''
|
||||
${cfg.package}/bin/status_cloud --port ${builtins.toString cfg.port}
|
||||
${cfg.package}/bin/status_cloud --config_file ${builtins.toString cfg.config_path}
|
||||
'';
|
||||
Restart = "always";
|
||||
DynamicUser = true;
|
||||
};
|
||||
};
|
||||
|
||||
config.systemd.timers.status_cloud = let
|
||||
cfg = config.services.status_cloud;
|
||||
pkg = self.packages.${system}.status_cloud;
|
||||
in lib.mkIf cfg.enable {
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "status_cloud.service" ];
|
||||
timerConfig.OnCalendar = [ "*:0/15" ];
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue