abouttreesummaryrefslogcommitdiff
path: root/flake.nix
blob: 2248cce1647f7bb36975b38563a2bd89b2fd1182 (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
45
46
47
48
49
50
{
  description = "A Nix Flake for a fork of cgit";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs }:
    let
      forAllSystems = nixpkgs.lib.genAttrs [
        "x86_64-linux"
        "aarch64-linux"
        "x86_64-darwin"
        "aarch64-darwin"
      ];
    in
    {
      packages = forAllSystems (system:
        let
          pkgs = nixpkgs.legacyPackages.${system};
        in
        {
          default = pkgs.callPackage ({ lib, fetchurl, callPackage, luajit, nixosTests }:
            # This logic was previously in package.nix
            callPackage (import ./common.nix rec {
              pname = "ps-cgit";
              version = "1.2.3";

              src = ./.;

              # cgit needs the git source code to compile.
              # Ensure this matches the version found in the Makefile of your fork.
              gitSrc = fetchurl {
                url = "mirror://kernel/software/scm/git/git-2.25.1.tar.xz";
                sha256 = "09lzwa183nblr6l8ib35g2xrjf9wm9yhk3szfvyzkwivdv69c9r2";
              };

              buildInputs = [ luajit ];

              passthru.tests = { inherit (nixosTests) cgit; };

              homepage = "https://git.zx2c4.com/cgit/about/";
              description = "Web frontend for git repositories (Custom Fork)";
              maintainers = with lib.maintainers; [  ];
            }) { }
          ) { };
        });
    };
}