From 545e3bd1b60392eccae467d365f1fad84368719d Mon Sep 17 00:00:00 2001 From: Spencer Brower Date: Wed, 8 Jul 2026 10:15:35 -0400 Subject: [PATCH] feat: Init. --- .envrc | 3 ++ .gitignore | 3 ++ Caddyfile | 34 ++++++++++++++++ flake.lock | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 94 ++++++++++++++++++++++++++++++++++++++++++++ main.odin | 5 +++ 6 files changed, 251 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 Caddyfile create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 main.odin diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..48a5693 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +use flake + +export PATH="$PATH:./vendor/bin" \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a8461c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.direnv +node_modules +vendor diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..3b3788e --- /dev/null +++ b/Caddyfile @@ -0,0 +1,34 @@ +(cors) { + @origin header Origin {args[0]} + header @origin Access-Control-Allow-Origin "{args[0]}" + header @origin Access-Control-Allow-Methods "OPTIONS,HEAD,GET,POST,PUT,PATCH,DELETE" +} + +wp.test { + root * . + + encode zstd gzip + file_server + php_fastcgi 127.0.0.1:9009 + + tls internal +} + +laravel.test { + # import cors laravel.test + + respond /caddy/live OK + + root * ./public + + try_files {path} page-cache/{path}.html page-cache/{path}.json page-cache/{path}.xml + + encode zstd gzip + file_server + php_fastcgi 127.0.0.1:9009 + + # Uncomment for Laravel Octane + # reverse_proxy :8000 + + tls internal +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..85ef1eb --- /dev/null +++ b/flake.lock @@ -0,0 +1,112 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1782949081, + "narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1783279667, + "narHash": "sha256-2l8yOB5aYd+05Q9V9Y1YhgbSa1j1o5QX+nvYs5FL80A=", + "rev": "f205b5574fd0cb7da5b702a2da51507b7f4fdd1b", + "type": "tarball", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1028110.f205b5574fd0/nixexprs.tar.xz" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1782614948, + "narHash": "sha256-ePjCwr1sNm9NYUqywL7QfK3JnlS015msC+eBu2zKlp8=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "db3f255737b94216eb71cce308e2912cf6bc2d7c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1783279667, + "narHash": "sha256-/NAkDSsve+GNM0Bt6tleJdCGfsTlK89nPjkVOzZMo0s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f205b5574fd0cb7da5b702a2da51507b7f4fdd1b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "process-compose-flake": { + "locked": { + "lastModified": 1782060835, + "narHash": "sha256-Q8HH2t1l3MITtWCWY4ytcH5F/Q7aAHo3Iq/QTMAKTe0=", + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "rev": "464ff6880737f063c3f0d3d2c7781fda9190868f", + "type": "github" + }, + "original": { + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", + "process-compose-flake": "process-compose-flake", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1780220602, + "narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "db947814a175b7ca6ded66e21383d938df01c227", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b5241ef --- /dev/null +++ b/flake.nix @@ -0,0 +1,94 @@ +{ + description = "A dev environment"; + + inputs = { + # nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + flake-parts.url = "github:hercules-ci/flake-parts"; + process-compose-flake.url = "github:Platonic-Systems/process-compose-flake"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = + inputs@{ self + , flake-parts + , nixpkgs + , nixpkgs-unstable + , process-compose-flake + , treefmt-nix + }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + inputs.treefmt-nix.flakeModule + # inputs.process-compose-flake.flakeModule + ]; + systems = [ "x86_64-linux" ]; + + perSystem = + { pkgs, system, inputs', ... }: { + _module.args.pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + + overlays = [ + (final: prev: { unstable = inputs'.nixpkgs-unstable.legacyPackages; }) + ]; + }; + + treefmt = { + # Used to find the project root + projectRootFile = "flake.nix"; + settings.global.excludes = [ + ".direnv/**" + ".jj/**" + ".env" + ".envrc" + ".env.local" + ]; + + + # Format nix files + programs.nixpkgs-fmt.enable = true; + programs.deadnix.enable = true; + + # Format js, json, and yaml files + programs.prettier.enable = true; + settings.formatter.prettier = + { + excludes = [ + "public/**" + "resources/js/modernizr.js" + "storage/app/caniuse.json" + "*.md" + ]; + }; + }; + + /* + process-compose.default.settings.processes = { + web.command = "sudo ${pkgs.caddy}/bin/caddy run"; + mail.command = "${pkgs.mailhog}/bin/MailHog"; + php.command = "${php}/bin/php-fpm -F -y php-fpm.conf"; + redis.command = "${$pks.redis}/bin/redis-server"; + }; + */ + + devShells.default = pkgs.mkShell + { + buildInputs = with pkgs; [ + odin + ols + + zeromq + + # IDE + unstable.helix + typescript-language-server + vscode-langservers-extracted + ]; + }; + }; + }; +} diff --git a/main.odin b/main.odin new file mode 100644 index 0000000..88d089a --- /dev/null +++ b/main.odin @@ -0,0 +1,5 @@ +package main + +main :: proc () { + +}