diff --git a/.gitignore b/.gitignore index 0246eb5b..cef45c23 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ tmp *.db .bin/ -appview/pages/static/ +appview/pages/static/* +!.gitkeep diff --git a/appview/pages/static/.gitkeep b/appview/pages/static/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/flake.lock b/flake.lock index de86a041..2e97642a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "htmx-src": { "flake": false, "locked": { @@ -45,6 +65,7 @@ }, "root": { "inputs": { + "gitignore": "gitignore", "htmx-src": "htmx-src", "indigo": "indigo", "nixpkgs": "nixpkgs" diff --git a/flake.nix b/flake.nix index 9c4756e1..43622cb9 100644 --- a/flake.nix +++ b/flake.nix @@ -11,13 +11,18 @@ url = "https://unpkg.com/htmx.org@2.0.4/dist/htmx.min.js"; flake = false; }; + gitignore = { + url = "github:hercules-ci/gitignore.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { - self - , nixpkgs - , indigo - , htmx-src + self, + nixpkgs, + indigo, + htmx-src, + gitignore, }: let supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; @@ -26,6 +31,7 @@ inherit system; overlays = [self.overlays.default]; }); + inherit (gitignore.lib) gitignoreSource; in { overlays.default = final: prev: { indigo-lexgen = with final; @@ -33,20 +39,43 @@ pname = "indigo-lexgen"; version = "0.1.0"; src = indigo; - subPackage = ["cmd/lexgen"]; + subPackages = ["cmd/lexgen"]; vendorHash = "sha256-pGc29fgJFq8LP7n/pY1cv6ExZl88PAeFqIbFEhB3xXs="; doCheck = false; }; + + appview = with final; + final.buildGoModule { + pname = "appview"; + version = "0.1.0"; + src = gitignoreSource ./.; + postConfigureHook = '' + cp -f ${htmx-src} appview/pages/static/htmx.min.js + ${pkgs.tailwindcss}/bin/tailwindcss -i input.css -o appview/pages/static/tw.css + ''; + subPackages = ["cmd/appview"]; + vendorHash = "sha256-QgUPTOgAdKUTg+ztfs194G7pt3/qDtqTMkDRmMECxSo="; + env.CGO_ENABLED = 1; + }; + knotserver = with final; + final.buildGoModule { + pname = "knotserver"; + version = "0.1.0"; + src = gitignoreSource ./.; + subPackages = ["cmd/knotserver"]; + vendorHash = "sha256-QgUPTOgAdKUTg+ztfs194G7pt3/qDtqTMkDRmMECxSo="; + env.CGO_ENABLED = 1; + }; }; packages = forAllSystems (system: { - inherit (nixpkgsFor."${system}") indigo-lexgen; + inherit (nixpkgsFor."${system}") indigo-lexgen appview knotserver; }); - defaultPackage = forAllSystems (system: nixpkgsFor.${system}.indigo-lexgen); + defaultPackage = forAllSystems (system: nixpkgsFor.${system}.appview); formatter = forAllSystems (system: nixpkgsFor."${system}".alejandra); devShells = forAllSystems (system: let pkgs = nixpkgsFor.${system}; staticShell = pkgs.mkShell.override { - stdenv = pkgs.pkgsStatic.stdenv; + stdenv = pkgs.pkgsStatic.stdenv; }; in { default = staticShell {