Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5b776288bd
|
@@ -119,9 +119,10 @@
|
|||||||
type = "app";
|
type = "app";
|
||||||
program = toString (nixpkgs.legacyPackages.${system}.writeShellScript "gatekeeper" ''
|
program = toString (nixpkgs.legacyPackages.${system}.writeShellScript "gatekeeper" ''
|
||||||
export LD_LIBRARY_PATH="${lib.getLib nixpkgs.legacyPackages.${system}.pcsclite}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
export LD_LIBRARY_PATH="${lib.getLib nixpkgs.legacyPackages.${system}.pcsclite}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||||
exec ${self.packages.${system}.default}/bin/fastapi run ${self}/app/main.py "$@";
|
exec ${self.packages.${system}.default}/bin/fastapi dev ${self}/app/main.py "$@";
|
||||||
'');
|
'');
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
nixosModules = { gatekeeper = import ./module.nix; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
41
module.nix
Normal file
41
module.nix
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{config, pkgs, lib, self, system, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.services.gatekeeper;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.gatekeeper = {
|
||||||
|
enable = lib.mkEnableOption "Enable the gatekeeper api service.";
|
||||||
|
dotenv = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = null;
|
||||||
|
description = "The path to a .env file with the keys";
|
||||||
|
};
|
||||||
|
db = {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = null;
|
||||||
|
description = "Where to save the database.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
users.extraGroups.gatekeeper = {};
|
||||||
|
users.extraUsers.gatekeeper = {
|
||||||
|
description = "gatekeeper user";
|
||||||
|
group = "gatekeeper";
|
||||||
|
isSystemUser = true;
|
||||||
|
};
|
||||||
|
#environment.systemPackages = [self.packages.${system}.default];
|
||||||
|
systemd.services.gatekeeper = {
|
||||||
|
script = ''
|
||||||
|
export LD_LIBRARY_PATH="${lib.getLib pkgs.pcsclite}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||||
|
exec ${pkgs.python3.pkgs.uvicorn}/bin/uvicorn run ${self}/app/main.py
|
||||||
|
'';
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
serviceConfig = {
|
||||||
|
User = "gatekeeper";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user