summaryrefslogtreecommitdiff
path: root/vms/configuration.nix
blob: c6e2cdffb6bce1ab177c5f932ae04e509e0a943a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ pkgs, ... }:
{
  config = {
    users.users.root.password = "";
    users.mutableUsers = false;

    environment.systemPackages = [
      pkgs.curl
    ];
    systemd.services.django-hello-world = {
      description = "An example django app";
      wantedBy = [ "multi-user.target" ];
      after    = [ "network.target" ];

      preStart = "rm -rf /var/lib/django_app/test_app && cp -a ${./test_django} /var/lib/django_app/test_app";
      script =
        let pythonWithDjango = pkgs.python3.withPackages (p: [ p.django ]);
        in "cd /var/lib/django_app/test_app && ${pythonWithDjango}/bin/python manage.py runserver";
      serviceConfig = {
        WorkingDirectory = "/var/lib/django_app";
        StateDirectory = "django_app";
      };
    };
  };
}