fix nix build files

This commit is contained in:
theBreadCompany 2024-09-12 12:35:15 +02:00
parent d23db7e336
commit f823dc0118
2 changed files with 10 additions and 11 deletions

View file

@ -1,5 +1,4 @@
{ pkgs ? import <nixpkgs> { system = builtins.currentSystem; } { pkgs, lib, rustPlatform }:
, lib ? pkgs.lib, rustPlatform ? pkgs.rustPlatform }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "pxiv"; pname = "pxiv";

View file

@ -1,26 +1,26 @@
# rocket-service.nix # pxiv.service.nix
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
let let
# Import the Rocket application package inherit (lib) mkOption mkIf types;
pxivApp = import ./default.nix { inherit pkgs; }; pxivApp = import ./default.nix { inherit pkgs lib; rustPlatform = pkgs.rustPlatform; };
in in
{ {
options.services.rocket = { options.services.pxiv = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Enable the Rocket application service."; description = "Enable the pxiv embed helper service.";
}; };
port = mkOption { port = mkOption {
type = types.int; type = types.int;
default = 8000; default = 8000;
description = "Port on which the Rocket application listens."; description = "Port on which the pxiv embed helper listens.";
}; };
}; };
config = mkIf config.services.rocket.enable { config = mkIf config.services.pxiv.enable {
systemd.services.pxiv = { systemd.services.pxiv = {
description = "pxiv embed helper service"; description = "pxiv embed helper service";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
@ -29,7 +29,7 @@ in
serviceConfig.ExecStart = "${pxivApp}/bin/pxiv"; serviceConfig.ExecStart = "${pxivApp}/bin/pxiv";
# Set the port environment variable # Set the port environment variable
serviceConfig.Environment = [ "ROCKET_PORT=${toString config.services.rocket.port}" ]; serviceConfig.Environment = [ "ROCKET_PORT=${toString config.services.pxiv.port}" ];
# Restart on failure # Restart on failure
serviceConfig.Restart = "always"; serviceConfig.Restart = "always";