mirror of
https://github.com/srid/nixos-config.git
synced 2026-05-11 17:36:07 +08:00
vira: hm service
This commit is contained in:
parent
ecc140c6d2
commit
e9c556ba9a
6 changed files with 32 additions and 80 deletions
|
|
@ -7,6 +7,7 @@ in
|
|||
imports = [
|
||||
self.homeModules.default
|
||||
self.homeModules.linux-only
|
||||
(self + /modules/home/all/vira.nix)
|
||||
];
|
||||
|
||||
home.username = "srid";
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ in
|
|||
imports = [
|
||||
self.nixosModules.default
|
||||
./configuration.nix
|
||||
# ./home-media.nix
|
||||
(self + /modules/nixos/linux/vira.nix)
|
||||
(self + /modules/nixos/linux/eternal-terminal.nix)
|
||||
(self + /modules/nixos/shared/github-runner.nix)
|
||||
];
|
||||
|
|
|
|||
8
flake.lock
generated
8
flake.lock
generated
|
|
@ -1147,16 +1147,16 @@
|
|||
"tabler-icons-hs": "tabler-icons-hs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1757210792,
|
||||
"narHash": "sha256-0zYOvVuoJCJ2WxZ0j7tMfRmsfkVw/FGjdEInqTK5sek=",
|
||||
"lastModified": 1757285089,
|
||||
"narHash": "sha256-GpzlomG05UNij+2i1LFKNACMPUQGfFToL1QyUGi7C+o=",
|
||||
"owner": "juspay",
|
||||
"repo": "vira",
|
||||
"rev": "a04d70b44bed44fa7d5533bdb436e685cd3f8dd3",
|
||||
"rev": "be4acdbecd2582975d3b0f4dfc8d8e21e280ee61",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "juspay",
|
||||
"ref": "rich-commit",
|
||||
"ref": "pull/144/head",
|
||||
"repo": "vira",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
flake-parts.follows = "flake-parts";
|
||||
};
|
||||
try.url = "github:tobi/try";
|
||||
vira.url = "github:juspay/vira/rich-commit";
|
||||
vira.url = "github:juspay/vira/pull/144/head";
|
||||
|
||||
# Neovim
|
||||
nixvim.url = "github:nix-community/nixvim";
|
||||
|
|
|
|||
26
modules/home/all/vira.nix
Normal file
26
modules/home/all/vira.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{ flake, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (flake) inputs;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.vira.homeManagerModules.vira
|
||||
];
|
||||
|
||||
services.vira = {
|
||||
enable = true;
|
||||
hostname = "0.0.0.0";
|
||||
port = 5001;
|
||||
https = true;
|
||||
package = inputs.vira.packages.${pkgs.system}.default;
|
||||
|
||||
initialState = {
|
||||
repositories = {
|
||||
nixos-config = "https://github.com/srid/nixos-config.git";
|
||||
haskell-flake = "https://github.com/srid/haskell-flake.git";
|
||||
vira = "https://github.com/juspay/vira.git";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
{ flake, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (flake) inputs;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.vira.nixosModules.vira
|
||||
];
|
||||
|
||||
services.vira = {
|
||||
enable = true;
|
||||
stateDir = "/var/lib/vira";
|
||||
hostname = "127.0.0.1"; # Cuz, nginx reverse proxy
|
||||
port = 5001;
|
||||
https = false; # Cuz, nginx reverse proxy
|
||||
basePath = "/vira/"; # Cuz, nginx reverse proxy
|
||||
package = inputs.vira.packages.${pkgs.system}.default;
|
||||
|
||||
initialState = {
|
||||
repositories = {
|
||||
nixos-config = "https://github.com/srid/nixos-config.git";
|
||||
haskell-flake = "https://github.com/srid/haskell-flake.git";
|
||||
vira = "https://github.com/juspay/vira.git";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Configure nginx reverse proxy for vira with SSL
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
recommendedTlsSettings = true;
|
||||
virtualHosts."pureintent" = {
|
||||
forceSSL = true;
|
||||
enableACME = false;
|
||||
sslCertificate = "/var/lib/acme/pureintent/cert.pem";
|
||||
sslCertificateKey = "/var/lib/acme/pureintent/key.pem";
|
||||
locations."/vira/" = {
|
||||
proxyPass = "http://127.0.0.1:5001/";
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Generate self-signed certificate for nginx
|
||||
systemd.services.nginx-self-signed-cert = {
|
||||
description = "Generate self-signed certificate for nginx";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "nginx.service" ];
|
||||
script = ''
|
||||
mkdir -p /var/lib/acme/pureintent
|
||||
if [ ! -f /var/lib/acme/pureintent/cert.pem ] || [ ! -f /var/lib/acme/pureintent/key.pem ]; then
|
||||
${pkgs.openssl}/bin/openssl req -x509 -newkey rsa:4096 -keyout /var/lib/acme/pureintent/key.pem -out /var/lib/acme/pureintent/cert.pem -days 365 -nodes -subj "/C=US/ST=Local/L=Local/O=Local/CN=pureintent"
|
||||
chmod 600 /var/lib/acme/pureintent/key.pem
|
||||
chmod 644 /var/lib/acme/pureintent/cert.pem
|
||||
chown -R nginx:nginx /var/lib/acme/pureintent
|
||||
fi
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue