flake: packages.visa for the fleet (phase 3.1)
CI / secret scan (push) Successful in 6s
CI / fmt, clippy, tests (push) Successful in 21s

The fleet (cnx-network-clan, modules/visa) takes the server from this
flake: crane builds one binary with its templates, static files and
migrations compiled in. The tests need PostgreSQL, so the build runs
none; CI and the fleet's VM test cover them. Built against the
fleet's nixpkgs (Rust 1.95): 9.8 MB, closure 58 MB.
This commit is contained in:
grabowski committed 2026-11-17 19:30:32 +07:00
1 parent 83bc481952
commit 2b1954a552
4 files changed
+121

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
{
description = "visa.buildfor.life: immigration records, deadlines and extension packs for foreigners in Thailand";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
crane.url = "github:ipetkov/crane";
};
outputs =
{
self,
nixpkgs,
crane,
}:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAll = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
# The server: one binary with its templates, static files and
# migrations compiled in (build.rs, sqlx::migrate!). The tests need
# PostgreSQL, so the package build runs none; CI and the fleet's VM
# test (checks.visa in cnx-network-clan) cover them.
package =
pkgs:
let
craneLib = crane.mkLib pkgs;
inherit (pkgs) lib;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./Cargo.toml
./Cargo.lock
./build.rs
./src
./templates
./static
./migrations
# Cargo.toml names tests/main.rs as a target
./tests
];
};
common = {
inherit src;
pname = "visa";
version = "0.1.0";
strictDeps = true;
doCheck = false;
};
cargoArtifacts = craneLib.buildDepsOnly common;
in
craneLib.buildPackage (
common
// {
inherit cargoArtifacts;
cargoExtraArgs = "--locked --bin visa";
meta = {
description = "Immigration records, deadlines and extension packs for foreigners in Thailand";
homepage = "https://git.b4l.co.th/B4L/visa";
mainProgram = "visa";
};
}
);
in
{
packages = forAll (pkgs: rec {
visa = package pkgs;
default = visa;
});
};
}