From 5c2ecff9722a03bb68c4c8228ba08f321c13406a Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Sat, 9 Aug 2025 21:42:01 +0200 Subject: [PATCH] feat: add flake --- .envrc | 1 + .gitignore | 2 ++ README.md | 16 ++++++++++++++++ default.nix | 16 ++++++++++++++++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 13 +++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 .envrc create mode 100644 README.md create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index ea8c4bf..1fbc882 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target +result +.direnv diff --git a/README.md b/README.md new file mode 100644 index 0000000..ec8ecf9 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# repo-rs + +## Usage + +`h repo-name` resolves the path to `repo-name` and changes the current working directory to it. +`h https://git.example.com/dadada/example.git` clones the repo `example` into `~/code/git.example.com/dadada/example` and changes the current working directory to it. +In this example `~/code` is the path in which repos should be stored; it can be specified using `export REPO_CODE_ROOT=$HOME/code`. + +## Installation + +Install the `repo` tool and install the shell function. The function changes your current working directory to the resolved directory. + +```sh +cargo install +eval "$(repo setup --root ~/git)" +``` diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..efaf12d --- /dev/null +++ b/default.nix @@ -0,0 +1,16 @@ +{ + lib, + rustPlatform, +}: +rustPlatform.buildRustPackage (finalAttrs: { + pname = "repo-rs"; + version = "0.0.1"; + src = ./.; + cargoHash = "sha256-iTny671GtQV4nTwF4W2sZyESWaYcYwH2UJAdLrhsW8g="; + meta = { + description = "repo-rs"; + license = lib.licenses.mit0; + maintainers = with lib.maintainers; [ dadada ]; + mainProgram = "repo"; + }; +}) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6005341 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1754498491, + "narHash": "sha256-erbiH2agUTD0Z30xcVSFcDHzkRvkRXOQ3lb887bcVrs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c2ae88e026f9525daf89587f3cbee584b92b6134", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1a30095 --- /dev/null +++ b/flake.nix @@ -0,0 +1,13 @@ +{ + description = "Repo RS"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs }: { + devShells.x86_64-linux.default = import ./shell.nix { pkgs = nixpkgs.legacyPackages.x86_64-linux; }; + packages.x86_64-linux.repo-rs = nixpkgs.legacyPackages.x86_64-linux.callPackage ./. { }; + packages.x86_64-linux.default = self.packages.x86_64-linux.repo-rs; + }; +}