lenticular_cloud2/flake.nix
2024-06-22 13:18:17 +02:00

127 lines
4.1 KiB
Nix

{
description = "Lenticular cloud interface";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = { # for shell.nix
url = "github:edolstra/flake-compat";
flake = false;
};
nix-node-package = {
url = "github:mkg20001/nix-node-package";
flake = false;
};
tuxpkgs = {
url = "git+ssh://git@git.o-g.at/nixpkg/tuxpkgs.git";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, nix-node-package, flake-utils, tuxpkgs, ... }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system}.extend (import ./overlay.nix);
in rec {
formatter = pkgs.nixpkgs-fmt;
devShells.default = pkgs.mkShell {packages = with pkgs; [
(python3.withPackages (ps: (
lenticular-cloud.propagatedBuildInputs ++
lenticular-cloud.testBuildInputs
)))
nodejs
];};
packages.default = pkgs.lenticular-cloud;
packages.frontend = pkgs.lenticular-cloud-frontend;
checks = {
package = packages.default;
devShells = devShells.default;
};
}) // {
nixosModules = {
default = import ./module.nix;
};
overlays.default = import ./overlay.nix;
nixosConfigurations.testSystem = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.default
tuxpkgs.nixosModules.ory-hydra
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
({lib, ...}:{
security.acme.acceptTerms = true;
security.acme.defaults.email = "acme@example.com";
services.lenticular-cloud = {
enable = true;
domain = "example.com";
service_domain = "account.example.com";
settings = {
HYDRA_ADMIN_URL = "http://127.0.0.1:8081";
HYDRA_PUBLIC_URL = "http://127.0.0.1:8082";
PUBLIC_URL = "http://localhost:5000";
ADMINS = [ "tuxcoder" ];
};
};
services.ory-hydra = {
enable = true;
admin_domain = "admin-hydra.local";
public_domain = "public-hydra.local";
extra_args = ["--dev"];
settings = {
urls.self = {
issuer = "http://127.0.0.1:8082";
public = "http://127.0.0.1:8082";
admin = "http://127.0.0.1:8081";
};
};
};
networking.hosts = {
"::1" = [ "admin-hydra.local" "public-hydra.local" "account.example.com" ];
};
networking.firewall.enable = false;
services.getty.autologinUser = "root";
services.nginx.virtualHosts = {
"admin-hydra.local" = {
addSSL = lib.mkForce false;
enableACME = lib.mkForce false;
listen = [{
addr = "0.0.0.0";
port = 8081;
}];
locations."/" = {
extraConfig = ''
allow all;
'';
};
};
"public-hydra.local" = {
addSSL = lib.mkForce false;
enableACME = lib.mkForce false;
listen = [{
addr = "0.0.0.0";
port = 8082;
}];
};
};
virtualisation = {
forwardPorts = [ {
from = "host";
host.port = 8080;
guest.port = 80;
} {
from = "host";
host.port = 8081;
guest.port = 8081;
} {
from = "host";
host.port = 8082;
guest.port = 8082;
} ];
qemu.options = [ "-vga none" "-nographic" ];
};
})
];
};
};
}