summaryrefslogtreecommitdiffstats
path: root/flake.nix
blob: 885922ede7b1a609a301475b5981960fb0d4c147 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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";
      };
    });
}