all repos — legit @ 68f08e38aada8d5e8f89679121beef9104430942

web frontend for git

flake.nix (view raw)

 1{
 2  description = "web frontend for git";
 3
 4  inputs.nixpkgs.url = "github:nixos/nixpkgs";
 5
 6  outputs =
 7    { self
 8    , nixpkgs
 9    ,
10    }:
11    let
12      supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
13      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
14      nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
15    in
16    {
17      packages = forAllSystems (system:
18        let
19          pkgs = nixpkgsFor.${system};
20          legit = self.packages.${system}.legit;
21          files = pkgs.lib.fileset.toSource {
22            root = ./.;
23            fileset = pkgs.lib.fileset.unions [
24              ./config.yaml
25              ./static
26              ./templates
27            ];
28          };
29        in
30        {
31          legit = pkgs.buildGoModule {
32            name = "legit";
33            rev = "master";
34            src = ./.;
35
36            vendorHash = "sha256-EBVD/RzVpxNcwyVHP1c4aKpgNm4zjCz/99LvfA0Oc/Q=";
37          };
38          docker = pkgs.dockerTools.buildLayeredImage {
39            name = "sini:5000/legit";
40            tag = "latest";
41            contents = [ files legit ];
42            config = {
43              Entrypoint = [ "${legit}/bin/legit" ];
44              ExposedPorts = { "5555/tcp" = { }; };
45            };
46          };
47        });
48
49      defaultPackage = forAllSystems (system: self.packages.${system}.legit);
50      devShells = forAllSystems (system:
51        let
52          pkgs = nixpkgsFor.${system};
53        in
54        {
55          default = pkgs.mkShell {
56            nativeBuildInputs = with pkgs; [
57              go
58            ];
59          };
60        });
61    };
62}