- Updated `.air.conf` for Nix compatibility and simplified build commands. - Enhanced `.gitignore` to include `tmp` directory. - Improved `README.md` with clearer instructions and added language details. - Refined CSS styles for better UI consistency and added alert styles. - Upgraded `flake.nix` to use Go 1.24 and improved shell environment setup. - Modified authentication logic in `auth.go` for better user handling. - Updated `main.go` to dynamically set the listening port and improved logging. - Added new `routes.go` file for handling game entry and history. - Enhanced user models and added statistics tracking in `models.go`. - Improved template rendering and added user feedback messages in HTML templates. - Removed obsolete build error logs and binaries.
52 lines
1.2 KiB
Nix
52 lines
1.2 KiB
Nix
{
|
|
description = "QRank Go (Gin + GORM) dev env with CGO (NixOS 25.05)";
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (import nixpkgs { inherit system; }));
|
|
in
|
|
{
|
|
devShells = forAllSystems (pkgs:
|
|
let
|
|
# Pick the Go you want. pkgs.go is fine; change to pkgs.go_1_23 if you prefer a fixed version.
|
|
go = pkgs.go_1_24;
|
|
in {
|
|
default = pkgs.mkShell {
|
|
buildInputs = [
|
|
go
|
|
pkgs.gcc
|
|
pkgs.pkg-config
|
|
pkgs.sqlite
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
pkgs.git
|
|
];
|
|
|
|
CGO_ENABLED = 1;
|
|
shellHook = ''
|
|
echo 'Inside nix shell.'
|
|
'';
|
|
};
|
|
});
|
|
|
|
# Used for nix run
|
|
apps = forAllSystems (pkgs: {
|
|
default = {
|
|
type = "app";
|
|
program = pkgs.writeShellScriptBin "run-qrank" ''
|
|
set -euo pipefail
|
|
export CGO_ENABLED=1
|
|
exec ${pkgs.go}/bin/go run .
|
|
'' + "/bin/run-qrank";
|
|
};
|
|
});
|
|
|
|
# Nix formatter
|
|
formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt);
|
|
};
|
|
}
|