001-reference-board-viewer #1
56
flake.nix
56
flake.nix
@@ -6,12 +6,15 @@
|
|||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
outputs =
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
{ self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
pythonEnv = pkgs.python3.withPackages (
|
||||||
|
ps: with ps; [
|
||||||
# Core backend dependencies
|
# Core backend dependencies
|
||||||
fastapi
|
fastapi
|
||||||
uvicorn
|
uvicorn
|
||||||
@@ -36,7 +39,8 @@
|
|||||||
pytest
|
pytest
|
||||||
pytest-cov
|
pytest-cov
|
||||||
pytest-asyncio
|
pytest-asyncio
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
@@ -98,6 +102,18 @@
|
|||||||
|
|
||||||
# Apps - Scripts that can be run with `nix run`
|
# Apps - Scripts that can be run with `nix run`
|
||||||
apps = {
|
apps = {
|
||||||
|
default = {
|
||||||
|
type = "app";
|
||||||
|
program = "${pkgs.writeShellScript "help" ''
|
||||||
|
echo "Available commands:"
|
||||||
|
echo " nix run .#lint - Run linting checks"
|
||||||
|
echo " nix run .#lint-fix - Auto-fix linting issues"
|
||||||
|
''}";
|
||||||
|
meta = {
|
||||||
|
description = "Show available commands";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Unified linting for all code
|
# Unified linting for all code
|
||||||
lint = {
|
lint = {
|
||||||
type = "app";
|
type = "app";
|
||||||
@@ -132,6 +148,9 @@
|
|||||||
echo ""
|
echo ""
|
||||||
echo "✅ All linting checks passed!"
|
echo "✅ All linting checks passed!"
|
||||||
''}";
|
''}";
|
||||||
|
meta = {
|
||||||
|
description = "Run linting checks on backend and frontend code";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Auto-fix linting issues
|
# Auto-fix linting issues
|
||||||
@@ -162,29 +181,48 @@
|
|||||||
echo ""
|
echo ""
|
||||||
echo "✅ Auto-fix complete!"
|
echo "✅ Auto-fix complete!"
|
||||||
''}";
|
''}";
|
||||||
|
meta = {
|
||||||
|
description = "Auto-fix linting issues in backend and frontend code";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Package definitions (for production deployment)
|
# Package definitions (for production deployment)
|
||||||
packages = {
|
packages = rec {
|
||||||
# Backend package
|
# Backend package
|
||||||
backend = pkgs.python3Packages.buildPythonApplication {
|
backend = pkgs.python3Packages.buildPythonApplication {
|
||||||
pname = "webref-backend";
|
pname = "webref-backend";
|
||||||
version = "1.0.0";
|
version = "1.0.0";
|
||||||
|
pyproject = true;
|
||||||
src = ./backend;
|
src = ./backend;
|
||||||
|
|
||||||
|
build-system = with pkgs.python3Packages; [
|
||||||
|
setuptools
|
||||||
|
];
|
||||||
|
|
||||||
propagatedBuildInputs = with pkgs.python3Packages; [
|
propagatedBuildInputs = with pkgs.python3Packages; [
|
||||||
fastapi
|
fastapi
|
||||||
uvicorn
|
uvicorn
|
||||||
sqlalchemy
|
sqlalchemy
|
||||||
alembic
|
alembic
|
||||||
pydantic
|
pydantic
|
||||||
|
pydantic-settings
|
||||||
|
psycopg2
|
||||||
python-jose
|
python-jose
|
||||||
passlib
|
passlib
|
||||||
pillow
|
pillow
|
||||||
boto3
|
boto3
|
||||||
httpx
|
httpx
|
||||||
python-multipart
|
python-multipart
|
||||||
|
email-validator
|
||||||
|
bcrypt
|
||||||
];
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Reference Board Viewer - Backend API";
|
||||||
|
homepage = "https://github.com/yourusername/webref";
|
||||||
|
license = pkgs.lib.licenses.mit;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Frontend package
|
# Frontend package
|
||||||
@@ -200,12 +238,18 @@
|
|||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -r build/* $out/
|
cp -r build/* $out/
|
||||||
'';
|
'';
|
||||||
|
meta = {
|
||||||
|
description = "Reference Board Viewer - Frontend SPA";
|
||||||
|
homepage = "https://github.com/yourusername/webref";
|
||||||
|
license = pkgs.lib.licenses.mit;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
default = backend;
|
||||||
|
};
|
||||||
|
|
||||||
# NixOS VM tests
|
# NixOS VM tests
|
||||||
checks = import ./nixos/tests.nix { inherit pkgs; };
|
checks = import ./nixos/tests.nix { inherit pkgs; };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
# Gitea Actions Runner Configuration
|
# Gitea Actions Runner Configuration
|
||||||
@@ -83,7 +83,10 @@
|
|||||||
trusted-users = [ "gitea-runner" ];
|
trusted-users = [ "gitea-runner" ];
|
||||||
|
|
||||||
# Enable flakes for the runner
|
# Enable flakes for the runner
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
];
|
||||||
|
|
||||||
# Optimize for CI performance
|
# Optimize for CI performance
|
||||||
max-jobs = "auto";
|
max-jobs = "auto";
|
||||||
@@ -109,4 +112,3 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,19 @@
|
|||||||
name = "webref-backend-integration";
|
name = "webref-backend-integration";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
machine = { config, pkgs, ... }: {
|
machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
# PostgreSQL service
|
# PostgreSQL service
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ensureDatabases = [ "webref" ];
|
ensureDatabases = [ "webref" ];
|
||||||
ensureUsers = [{
|
ensureUsers = [
|
||||||
|
{
|
||||||
name = "webref";
|
name = "webref";
|
||||||
ensureDBOwnership = true;
|
ensureDBOwnership = true;
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
authentication = ''
|
authentication = ''
|
||||||
local all all trust
|
local all all trust
|
||||||
host all all 127.0.0.1/32 trust
|
host all all 127.0.0.1/32 trust
|
||||||
@@ -71,15 +75,19 @@
|
|||||||
name = "webref-full-stack";
|
name = "webref-full-stack";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
machine = { config, pkgs, ... }: {
|
machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
# PostgreSQL
|
# PostgreSQL
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ensureDatabases = [ "webref" ];
|
ensureDatabases = [ "webref" ];
|
||||||
ensureUsers = [{
|
ensureUsers = [
|
||||||
|
{
|
||||||
name = "webref";
|
name = "webref";
|
||||||
ensureDBOwnership = true;
|
ensureDBOwnership = true;
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# MinIO
|
# MinIO
|
||||||
@@ -125,7 +133,9 @@
|
|||||||
name = "webref-performance";
|
name = "webref-performance";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
machine = { config, pkgs, ... }: {
|
machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
services.postgresql.enable = true;
|
services.postgresql.enable = true;
|
||||||
services.minio.enable = true;
|
services.minio.enable = true;
|
||||||
|
|
||||||
@@ -148,14 +158,18 @@
|
|||||||
name = "webref-security";
|
name = "webref-security";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
machine = { config, pkgs, ... }: {
|
machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ensureDatabases = [ "webref" ];
|
ensureDatabases = [ "webref" ];
|
||||||
ensureUsers = [{
|
ensureUsers = [
|
||||||
|
{
|
||||||
name = "webref";
|
name = "webref";
|
||||||
ensureDBOwnership = true;
|
ensureDBOwnership = true;
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Create system user for testing
|
# Create system user for testing
|
||||||
|
|||||||
Reference in New Issue
Block a user