trivios: add web services

This commit is contained in:
Alejandro Soto 2023-09-11 00:45:52 -06:00
parent 5d0bebaefb
commit bdb02a607c
No known key found for this signature in database
GPG key ID: 570448E3382BDEC5
3 changed files with 45 additions and 1 deletions

View file

@ -10,6 +10,7 @@
imports = [
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
(modulesPath + "/profiles/minimal.nix")
./web.nix
];
disabledModules = [
@ -31,7 +32,6 @@
hardware.enableRedistributableFirmware = true;
environment.systemPackages = with pkgs; [
libraspberrypi
(python3.withPackages (py: [ py.django ]))
];
networking.wireless.enable = true;
networking.hostName = "tripi";

35
triviOS/web.nix Normal file
View file

@ -0,0 +1,35 @@
{ config, pkgs, ... }: {
config.services = {
nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
virtualHosts.home-manager = {
default = true;
locations = {
"/".extraConfig = ''
uwsgi_pass unix://${config.services.uwsgi.runDir}/uwsgi.sock;
include uwsgi_params;
'';
};
};
};
uwsgi = {
enable = true;
group = "nginx";
plugins = [ "python3" ];
instance = {
type = "normal";
pythonPackages = py: [ py.callPackage ../ui { } ];
module = "homemanager.wsgi";
};
};
};
}

9
ui/default.nix Normal file
View file

@ -0,0 +1,9 @@
{ buildPythonPackage, django_4 }:
buildPythonPackage {
pname = "homemanager";
version = "0.0.1";
src = ./.;
propagatedBuildInputs = [ django_4 ];
}