diff --git a/.gitignore b/.gitignore index 78cd84318a8..0bf4caa0dad 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # Generated by Cargo # will have compiled files and executables target/ +/result # repositories used for local testing /tests/fixtures/repos diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000000..f1fc2c76350 --- /dev/null +++ b/flake.lock @@ -0,0 +1,255 @@ +{ + "nodes": { + "android-nixpkgs": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "flakebox", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749500520, + "owner": "tadfisher", + "repo": "android-nixpkgs", + "rev": "7dc07be20c7a516cc7490969c4072ff692fb1b27", + "type": "github" + }, + "original": { + "owner": "tadfisher", + "repo": "android-nixpkgs", + "rev": "7dc07be20c7a516cc7490969c4072ff692fb1b27", + "type": "github" + } + }, + "crane": { + "locked": { + "lastModified": 1745454774, + "owner": "ipetkov", + "repo": "crane", + "rev": "efd36682371678e2b6da3f108fdb5c613b3ec598", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "rev": "efd36682371678e2b6da3f108fdb5c613b3ec598", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": [ + "flakebox", + "android-nixpkgs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1741473158, + "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", + "owner": "numtide", + "repo": "devshell", + "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1759991958, + "narHash": "sha256-OtGPB1TeRCY6+tWArGi5B+ojcVwR5BZUsHSpS69H9U8=", + "owner": "nix-community", + "repo": "fenix", + "rev": "d771abc0cf455e53278c07bc91377dc2804df8fc", + "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" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "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" + } + }, + "flake-utils_3": { + "inputs": { + "systems": [ + "flakebox", + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flakebox": { + "inputs": { + "android-nixpkgs": "android-nixpkgs", + "crane": "crane", + "fenix": [ + "fenix" + ], + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3" + }, + "locked": { + "lastModified": 1758323844, + "narHash": "sha256-vkmkLWHpE2/f2jOH1Zacz36EUE64WM6KbIrHvFfdzCg=", + "owner": "rustshop", + "repo": "flakebox", + "rev": "261180f894d74ab95f7afbf14c7418fedb0d3cbf", + "type": "github" + }, + "original": { + "owner": "rustshop", + "repo": "flakebox", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1759735786, + "narHash": "sha256-a0+h02lyP2KwSNrZz4wLJTu9ikujNsTWIC874Bv7IJ0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "20c4598c84a671783f741e02bf05cbfaf4907cff", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "flake-utils": "flake-utils", + "flakebox": "flakebox", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1759966831, + "narHash": "sha256-4B8MMaVQo3QdPPEeIZ6lkrqkfY6cIeuOw56C2InuRDk=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "1941dfe8e2815f233a88313d2a4a1f8a41e0e97f", + "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" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "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 00000000000..36f86e2c04a --- /dev/null +++ b/flake.nix @@ -0,0 +1,121 @@ +{ + description = "`gitoxide` compiled in a nix shell, using `crane` and `flakebox`."; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05"; + flake-utils.url = "github:numtide/flake-utils"; + + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flakebox = { + url = "github:rustshop/flakebox"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.fenix.follows = "fenix"; + }; + }; + + outputs = { self, nixpkgs, flakebox, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (arch: let + pkgs = import nixpkgs { system = arch; }; + flakeboxLib = flakebox.lib.mkLib pkgs { }; + + rustSrc = flakeboxLib.filterSubPaths { + root = builtins.path { name = "gitoxide"; path = ./.; }; + paths = [ "Cargo.toml" "Cargo.lock" ".cargo" + + "etc" + "examples" + "gitoxide-core" + "gix" + "gix-actor" + "gix-archive" + "gix-attributes" + "gix-bitmap" + "gix-blame" + "gix-chunk" + "gix-command" + "gix-commitgraph" + "gix-config" + "gix-config-value" + "gix-credentials" + "gix-date" + "gix-diff" + "gix-dir" + "gix-discover" + "gix-features" + "gix-fetchhead" + "gix-filter" + "gix-fs" + "gix-fsck" + "gix-glob" + "gix-hash" + "gix-hashtable" + "gix-ignore" + "gix-index" + "gix-lfs" + "gix-lock" + "gix-macros" + "gix-mailmap" + "gix-merge" + "gix-negotiate" + "gix-note" + "gix-object" + "gix-odb" + "gix-pack" + "gix-packetline" + "gix-packetline-blocking" + "gix-path" + "gix-pathspec" + "gix-prompt" + "gix-protocol" + "gix-quote" + "gix-rebase" + "gix-ref" + "gix-refspec" + "gix-revision" + "gix-revwalk" + "gix-sec" + "gix-sequencer" + "gix-shallow" + "gix-status" + "gix-submodule" + "gix-tempfile" + "gix-tix" + "gix-trace" + "gix-transport" + "gix-traverse" + "gix-tui" + "gix-url" + "gix-utils" + "gix-validate" + "gix-worktree" + "gix-worktree-state" + "gix-worktree-stream" + "src" + "tests" + + ]; + }; + + legacyPackages = (flakeboxLib.craneMultiBuild { }) (craneLib': let + craneLib = with pkgs; (craneLib'.overrideArgs { + pname = "gitoxide"; + src = rustSrc; + buildInputs = [ openssl.dev ]; + nativeBuildInputs = [ pkg-config ]; + }); + in rec { + workspaceDeps = craneLib.buildWorkspaceDepsOnly { }; + workspaceBuild = craneLib.buildWorkspace { cargoArtifacts = workspaceDeps; }; + gitoxide = craneLib.buildPackage { }; + }); + in { + inherit legacyPackages; + packages.default = legacyPackages.gitoxide; + devShells = flakeboxLib.mkShells { + packages = [ ]; + }; + }); +}