From 8eb07d94a12f0fb8d4a8f15043aedc8cadd7c676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 22 Jul 2020 01:16:01 +0200 Subject: Initial commit --- vms/configuration.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 vms/configuration.nix (limited to 'vms/configuration.nix') diff --git a/vms/configuration.nix b/vms/configuration.nix new file mode 100644 index 0000000..c6e2cdf --- /dev/null +++ b/vms/configuration.nix @@ -0,0 +1,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"; + }; + }; + }; +} -- cgit v1.2.3