diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..784cb8a --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +flake.lock binary diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f628cb9 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1724300212, + "narHash": "sha256-x3jl6OWTs+L9C7EtscuWZmGZWI0iSBDafvg3X7JMa1A=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4de4818c1ffa76d57787af936e8a23648bda6be4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724338379, + "narHash": "sha256-kKJtaiU5Ou+e/0Qs7SICXF22DLx4V/WhG1P6+k4yeOE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "070f834771efa715f3e74cd8ab93ecc96fabc951", + "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..32bd363 --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +{ + description = "BeerBrawl"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, treefmt-nix, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + inherit (pkgs) lib; + + treefmt = treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs = { + nixfmt = { + enable = true; + package = pkgs.nixfmt-classic; + }; + statix.enable = true; + deadnix.enable = true; + }; + }; + + devShell = pkgs.mkShell { + inputsFrom = [ treefmt.config.build.devShell ]; + nativeBuildInputs = with pkgs; [ + jdk21 + kotlin-language-server + maven + nodePackages.prettier + nodePackages.typescript-language-server + nodejs + (java-language-server.overrideAttrs (oldAttrs: { + patches = (oldAttrs.patches or [ ]) ++ [ + (pkgs.fetchpatch { + url = + "https://github.com/georgewfraser/java-language-server/commit/801e5d233dff22627a8e2655288acffb9bd939c0.patch"; + hash = "sha256-9bPRMFPWjuIw1fbeFIzrFf9shrctT4OYnJSl2J4CwBE="; + }) + ]; + })) + ]; + }; + in { + checks.formatting = treefmt.config.build.check self; + + formatter = treefmt.config.build.wrapper; + + packages.default = devShell; + devShells.default = devShell; + }); +}