Advertisement
elkcl

tgpy nix

Jul 27th, 2022
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1.  
  2. {config, pkgs, lib, ...}:
  3.  
  4. let
  5. mach-nix = import (builtins.fetchGit { url = "https://github.com/DavHau/mach-nix"; ref = "refs/tags/3.4.0"; }) {};
  6. tgpy = mach-nix.mkPython { requirements = ''tgpy
  7. requests
  8. prettytable
  9. opencv-python
  10. pillow
  11. base65536
  12. aiohttp''; };
  13. in {
  14.  
  15. containers.tgpy = {
  16. privateNetwork = true;
  17. hostAddress = "192.168.100.1";
  18. localAddress = "192.168.100.2";
  19. config = {config, pkgs, ...}: {
  20. system.stateVersion = "21.11";
  21. users.users.tgpy = {
  22. isNormalUser = true;
  23. };
  24. environment.systemPackages = with pkgs; [ tgpy wget curl ghc rustc ];
  25. systemd.services.tgpy = {
  26. enable = true;
  27. wantedBy = [ "multi-user.target" ];
  28. after = [ "network-online.target" ];
  29. wants = [ "network-online.target" ];
  30. description = "tgpy userbot autostart";
  31. serviceConfig = {
  32. User = "tgpy";
  33. Group = "users";
  34. Type = "simple";
  35. WorkingDirectory = "/home/tgpy";
  36. ExecStart = ''${tgpy}/bin/tgpy'';
  37. #ExecStartPre = ''/bin/sh -c "until /run/wrappers/bin/ping -c1 t.me; do /run/current-system/sw/bin/sleep 1; done;"'';
  38. ExecStartPre = ''/bin/sh -c "/run/current-system/sw/bin/sleep 30"'';
  39. };
  40. };
  41. };
  42. autoStart = true;
  43. ephemeral = true;
  44. bindMounts = {
  45. "/home/tgpy/.config" = {
  46. hostPath = "/var/config/";
  47. isReadOnly = false;
  48. };
  49. };
  50. };
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement