summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyborus <cyborus@noreply.codeberg.org>2024-08-10 17:19:01 +0200
committerCyborus <cyborus@noreply.codeberg.org>2024-08-10 17:19:01 +0200
commitfd6dd52728abb150e56a3fb7f122a699a28d132c (patch)
treef3aadfccd3f2f4722393ee40a59dfbaec95514ce
parentMerge pull request 'bump version to 0.1.1' (#117) from bump-0.1.1 into main (diff)
parentdocs: add Nix instructions to README (diff)
downloadforgejo-cli-fd6dd52728abb150e56a3fb7f122a699a28d132c.tar.xz
forgejo-cli-fd6dd52728abb150e56a3fb7f122a699a28d132c.zip
Merge pull request 'feat: add Nix flake' (#118) from LordMZTE/forgejo-cli:nix-flake into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/118 Reviewed-by: Cyborus <cyborus@noreply.codeberg.org>
-rw-r--r--.gitignore3
-rw-r--r--README.md19
-rw-r--r--flake.lock61
-rw-r--r--flake.nix44
4 files changed, 127 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index ea8c4bf..ffb1283 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
/target
+
+# Nix output
+/result*
diff --git a/README.md b/README.md
index 82cbb25..9a900ec 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,25 @@ cargo install forgejo-cli
cargo install --git https://codeberg.org/Cyborus/forgejo-cli.git --branch main
```
+### Nix
+
+A Nix flake is included in this repository that you may use. You could install it into your Nix
+profile, for example:
+```
+nix profile install git+https://codeberg.org/Cyborus/forgejo-cli
+```
+...or include it in the flake inputs of your NixOS system:
+```nix
+{
+ inputs = {
+ # ...
+ forgejo-cli.url = "git+https://codeberg.org/Cyborus/forgejo-cli";
+ };
+ # ...
+}
+```
+
+
### OCI Container
`forgejo-cli` is available as an OCI container for use in CI, at
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..f804c47
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1723151389,
+ "narHash": "sha256-9AVY0ReCmSGXHrlx78+1RrqcDgVSRhHUKDVV1LLBy28=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "13fe00cb6c75461901f072ae62b5805baef9f8b2",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs",
+ "utils": "utils"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
+ "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"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..885922e
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,44 @@
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ in
+ rec {
+ packages.forgejo-cli = pkgs.rustPlatform.buildRustPackage {
+ pname = "forgejo-cli";
+ version = "0.1.1";
+ src = pkgs.lib.cleanSource ./.;
+
+ cargoLock.lockFile = ./Cargo.lock;
+
+ nativeBuildInputs = with pkgs; [ pkg-config ];
+ buildInputs = with pkgs; [ openssl ];
+
+ meta = with pkgs.lib; {
+ description = "CLI tool for Forgejo";
+ homepage = "https://codeberg.org/Cyborus/forgejo-cli/";
+ license = with licenses; [ asl20 /* or */ mit ];
+ };
+ };
+
+ packages.default = packages.forgejo-cli;
+
+ devShells.default = pkgs.mkShell {
+ inputsFrom = [ packages.default ];
+
+ nativeBuildInputs = with pkgs; [
+ cargo
+ rustc
+ ];
+
+ # Required for rust-analyzer to work
+ RUST_SRC_PATH = "${pkgs.rustPlatform.rustcSrc}/library";
+ };
+ });
+}
+