Skip to content

Nix flake - #123

Open
kratochvil-jan wants to merge 4 commits into
trnila:masterfrom
kratochvil-jan:nix-flake
Open

Nix flake#123
kratochvil-jan wants to merge 4 commits into
trnila:masterfrom
kratochvil-jan:nix-flake

Conversation

@kratochvil-jan

@kratochvil-jan kratochvil-jan commented May 24, 2026

Copy link
Copy Markdown

derivation configs for building:

  • frontend nix build .#frontend
  • backend nix build .#backend
  • runtime (combining frontend and backend)
  • wrapper with redis instance - nix run .#app

experimental management of pre-commit via nix flake:

  • nix flake check - fails on ruff right now
  • nix develop - running this would install the pre commit YAML file

nixos module to run the lunch assistant as native service - untested

Comment thread nix/module.nix
};

config = lib.mkIf cfg.enable {
users.users.lunch-assistant = {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would use Systemd dynamic user, or nobody

Comment thread nix/module.nix
RestartSec = 5;

StateDirectory = "assistant";
RuntimeDirectory = "assistant";

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would omit these dirs - theres no state in the service itself, but in redis instead

Comment thread backend/app.py
# from flask_redis import FlaskRedis
from lunches import RestaurantMenu, gather_restaurants
from public_transport import public_transport_connections
from .lunches import RestaurantMenu, gather_restaurants

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it strictly require package directory? If so, i would rename it maybe to assistant or lunchmenu - but theres still transport miniapp

Comment thread nix/frontend.nix

yarnOfflineCache = pkgs.fetchYarnDeps {
yarnLock = ../frontend/yarn.lock;
hash = "sha256-6xzFsvoGzzhizfDiHuzb4A3G1M48dNziJZ8PxcgOqFU=";

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if renovatebot will catch this?

Comment thread nix/module.nix
#
openFirewall = lib.mkOption {
type = lib.types.bool;
default = true;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about firewall here - some proxy (traefik/nginx) is needed to support more services and HTTPS termination

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants