{ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; }; pre-commit-hooks = { url = "github:cachix/git-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; devshell = { url = "github:numtide/devshell"; inputs.nixpkgs.follows = "nixpkgs"; }; templ = { url = "github:a-h/templ?ref=tags/v0.2.778"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = inputs @ {self, ...}: inputs.flake-parts.lib.mkFlake {inherit inputs;} { imports = [ inputs.devshell.flakeModule ]; systems = ["x86_64-linux"]; perSystem = { pkgs, system, ... }: { checks.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { src = ./.; hooks = { # Nix formatting alejandra.enable = true; # Go formatting, linting, static checking gofmt.enable = true; govet.enable = true; revive.enable = true; }; }; devshells.default = { env = [ { name = "FELU_LOG_LEVEL"; value = "debug"; } { name = "GIN_MODE"; value = "release"; } { name = "FELU_DB_PATH"; value = "tmp/"; } { name = "FELU_DNS_PATTERN"; value = "ddns.feludns.arpa."; } { name = "FELU_DNS_BIND_PORT"; value = "8053"; } ]; commands = [ { help = "run felu"; name = "felu-dev-run"; command = "go run cmd/felu/main.go"; } { help = "generate templ templates (watch)"; name = "felu-dev-templ"; command = "templ generate --watch"; } { help = "generate tailwindcss (watch)"; name = "felu-dev-tailwindcss"; command = "tailwindcss -i input.css -o ./static/styles.css --watch"; } ]; packages = with pkgs; [ gcc go gopls tailwindcss tailwindcss-language-server just bind dig ] ++ [ inputs.templ.packages.${system}.default ]; devshell.startup.pre-commit.text = self.checks.${system}.pre-commit-check.shellHook; }; }; }; }