diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..fb9d00cc65 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use flake +dotenv_if_exists .env diff --git a/.gitignore b/.gitignore index 13c500cfca..9413d8de49 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,10 @@ **/*.rs.bk *.flamegraph.svg + +# direnv +/.direnv/ + +# Potential Nix stuff +/result +/result-* diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..1a57872210 --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1728492678, + "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1728527353, + "narHash": "sha256-GY755PX8CbGH3O9iKqauhkFTdP9WSKcOfOkZBe3SOqw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "94749eee5a2b351b6893d5bddb0a18f7f01251ac", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..dee23cd2b8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "git-cliff"; + + inputs = { + nixpkgs.url = + "github:nixos/nixpkgs/nixos-unstable"; # We want to use packages from the binary cache + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = inputs@{ self, nixpkgs, flake-utils, ... }: + flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ inputs.rust-overlay.overlays.rust-overlay ]; + }; + in { + devShell = pkgs.mkShell { + CARGO_INSTALL_ROOT = "${toString ./.}/.cargo"; + + buildInputs = with pkgs; [ + pkg-config + openssl + cargo-binutils + cargo-watch + lld + (rust-bin.fromRustupToolchain { + channel = "stable"; + components = + [ "rust-analyzer" "rust-src" "rustfmt" "rustc" "cargo" "clippy" ]; + }) + ]; + }; + }); +}