commit 701f61e56d9461314cea9e3c358458effa5f31fe from: mtmn date: Wed May 6 19:52:10 2026 UTC feat: add nix flake and prek.toml commit - ad223e83513219be2dc5c4929a22d7158cf1d0f6 commit + 701f61e56d9461314cea9e3c358458effa5f31fe blob - /dev/null blob + 6df7acaed918ab99c1e7d26b67e5cb6eb18bf181 (mode 644) --- /dev/null +++ flake.lock @@ -0,0 +1,115 @@ +{ + "nodes": { + "crane": { + "locked": { + "lastModified": 1777830388, + "narHash": "sha256-2uoQAqUk2H0ijQtGiWAyNeQYGYc6yfAcRRLlJAz4Gp8=", + "owner": "ipetkov", + "repo": "crane", + "rev": "d459c1350e96ce1a7e3859c513ef5e9869d67d6f", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1777969788, + "narHash": "sha256-8sr3w0KyQ0K7TEd8pYwYrxiDk0GZ4A7iIcl1lsxlzVM=", + "owner": "nix-community", + "repo": "fenix", + "rev": "3abc2d5559f4dc30c710ab152abcb4cb60b561ba", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1777954456, + "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "crane": "crane", + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1777924689, + "narHash": "sha256-9Z0puLyCSYvtYhP1IZMxC05DSgwA+5rE99jsv1KErc4=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "91c7c2c4ca6a0520cfbf97e369e4fb7bf0b63b7a", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} blob - /dev/null blob + 2f33f585bc1f557086a830f57c1eeae2cc960a8c (mode 644) --- /dev/null +++ flake.nix @@ -0,0 +1,63 @@ +{ + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + crane = { + url = "github:ipetkov/crane"; + }; + }; + + outputs = { + nixpkgs, + flake-utils, + fenix, + crane, + ... + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + fenixPkgs = fenix.packages.${system}; + + rustToolchain = fenixPkgs.stable.toolchain; + + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; + src = craneLib.cleanCargoSource ./.; + + baseNativeBuildInputs = with pkgs; [ + pkg-config + sqlite + openssl + ]; + + commonArgs = { + inherit src; + pname = "matchakey"; + version = "0.1.0"; + + strictDeps = true; + nativeBuildInputs = baseNativeBuildInputs; + buildInputs = with pkgs; [sqlite.dev openssl.dev]; + }; + + matchakey = craneLib.buildPackage (commonArgs + // { + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + }); + in { + packages = { + default = matchakey; + inherit matchakey; + }; + + devShells.default = pkgs.mkShell { + nativeBuildInputs = [rustToolchain fenixPkgs.rust-analyzer] ++ baseNativeBuildInputs; + inherit (commonArgs) buildInputs; + }; + }); +} blob - /dev/null blob + ea9b6abb41ba3e87be1033b62fc9aae49b20579e (mode 644) --- /dev/null +++ prek.toml @@ -0,0 +1,41 @@ +[[repos]] +repo = "https://github.com/pre-commit/pre-commit-hooks" +rev = "v6.0.0" +hooks = [ + { id = "trailing-whitespace" }, + { id = "end-of-file-fixer" }, + { id = "double-quote-string-fixer" } +] + +[[repos]] +repo = "https://github.com/biomejs/pre-commit" +rev = "v2.4.14" +hooks = [ + { id = "biome-format" } +] + +[[repos]] +repo = "https://github.com/gitleaks/gitleaks" +rev = "v8.30.1" +hooks = [ + { id = "gitleaks" } +] + +[[repos]] +repo = "https://github.com/astro/deadnix" +rev = "v1.3.1" +hooks = [ + { id = "deadnix" } +] + +[[repos]] +repo = "local" +hooks = [ + { + id = "alejandra", + name = "alejandra", + language = "system", + entry = "alejandra", + files = '\.nix$' + }, +]