Skip to content

Commit

Permalink
feat: added missing stuff for graphite
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop committed Jan 15, 2024
1 parent 8b805df commit 6c0e433
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 33 deletions.
5 changes: 1 addition & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
{
overlays.default = import ./overlays/default.nix;

lib = {
go = import ./lib/go/go.nix;
nix = import ./lib/nix/nix.nix;
};
lib = import ./lib/lib.nix;
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
Expand Down
6 changes: 3 additions & 3 deletions lib/go/example/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions lib/go/example/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
inherit system overlays;
};

nixops-go = nixops.lib.go { inherit pkgs; };
nixops-lib = nixops.lib { inherit pkgs; };

src = nix-filter.lib.filter {
root = ./.;
Expand All @@ -38,24 +38,28 @@
in
{
checks = {
go-checks = nixops-go.check {
go-checks = nixops-lib.go.check {
inherit src ldflags tags buildInputs nativeBuildInputs checkDeps;
};
};

devShells = flake-utils.lib.flattenTree rec {
default = nixops-go.devShell {
default = nixops-lib.go.devShell {
buildInputs = with pkgs; [
mockgen
gqlgen
gqlgenc
oapi-codegen
];
};
};

packages = flake-utils.lib.flattenTree rec {
example = nixops-go.package {
example = nixops-lib.go.package {
inherit name src version ldflags buildInputs nativeBuildInputs;
};

docker-image = nixops-go.docker-image {
docker-image = nixops-lib.go.docker-image {
inherit name version buildInputs;

package = example;
Expand Down
5 changes: 5 additions & 0 deletions lib/lib.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ pkgs }:
{
go = import ./go/go.nix { inherit pkgs; };
nix = import ./nix/nix.nix { inherit pkgs; };
}
1 change: 1 addition & 0 deletions overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ final: prev:
{
nhost-cli = final.callPackage ./nhost-cli.nix { inherit final; };
} // import ./go.nix final prev
// import ./postgres.nix final prev
127 changes: 106 additions & 21 deletions overlays/go.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,122 @@ final: prev: rec {
});
};

govulncheck = prev.govulncheck.override rec {
buildGoModule = args: prev.buildGoModule.override { go = go; } (args // rec { });
};

gqlgenc = prev.gqlgenc.override rec {
buildGoModule = args: prev.buildGoModule.override { go = go; } (args // rec {
version = "0.16.2";
src = prev.fetchFromGitHub {
owner = "Yamashou";
repo = "gqlgenc";
rev = "v${version}";
sha256 = "sha256-XNmCSkgJJ2notrv0Din4jlU9EoHJcznjEUiXQgQ5a7I=";
};

vendorHash = "sha256-6iwNykvW1m+hl6FzMNbvvPpBNp8OQn2/vfJLmAj60Mw=";
});
};

mockgen = prev.mockgen.override rec {
buildGoModule = args: final.buildGoModule (args // rec {
version = "0.3.0";
version = "0.4.0";
src = final.fetchFromGitHub {
owner = "uber-go";
repo = "mock";
rev = "v${version}";
sha256 = "sha256-pwlssqk/2aXTOwchePJK7CqEQ6lkQv7E+aT3HzUhvpE=";
sha256 = "sha256-3nt70xrZisK5vgQa+STZPiY4F9ITKw8PbBWcKoBn4Vc=";
};
vendorHash = "sha256-mcNVud2jzvlPPQEaar/eYZkP71V2Civz+R5v10+tewA=";
});
};

golines = final.buildGoModule rec {
name = "golines";
version = "0.11.0";
src = final.fetchFromGitHub {
owner = "dbarrosop";
repo = "golines";
rev = "b7e767e781863a30bc5a74610a46cc29485fb9cb";
sha256 = "sha256-pxFgPT6J0vxuWAWXZtuR06H9GoGuXTyg7ue+LFsRzOk=";
};
vendorHash = "sha256-rxYuzn4ezAxaeDhxd8qdOzt+CKYIh03A9zKNdzILq18=";

}
meta = with final.lib; {
description = "A golang formatter that fixes long lines";
homepage = "https://github.com/segmentio/golines";
maintainers = [ "nhost" ];
platforms = platforms.linux ++ platforms.darwin;
};
};

govulncheck = final.buildGoModule rec {
name = "govulncheck";
version = "v1.0.1";
src = final.fetchFromGitHub {
owner = "golang";
repo = "vuln";
rev = "${version}";
sha256 = "sha256-wAZJruDyAavfqS/+7yDaT4suE4eivCbL7g4tQoqUDlQ=";
};
vendorHash = "sha256-LqKDQPOXOF+A2G3e483jeV7ziUb87ePnk8VMkLAms74=";

doCheck = false;

meta = with final.lib; {
description = "the database client and tools for the Go vulnerability database";
homepage = "https://github.com/golang/vuln";
maintainers = [ "nhost" ];
platforms = platforms.linux ++ platforms.darwin;
};
};

gqlgen = final.buildGoModule rec {
pname = "gqlgen";
version = "0.17.42";

src = final.fetchFromGitHub {
owner = "99designs";
repo = pname;
rev = "v${version}";
sha256 = "sha256-Rqet3wLRtyts493yUdUHNgEKkfKR9YuHGINT8IRXSpk=";
};

vendorHash = "sha256-0Yo2oqKGHDbMuqqjwO/CN/pApSZcVcPF3T//k5ogHM0=";

doCheck = false;

subPackages = [ "./." ];

meta = with final.lib; {
description = "go generate based graphql server library";
homepage = "https://gqlgen.com";
license = licenses.mit;
maintainers = [ "@nhost" ];
};
};

gqlgenc = final.buildGoModule rec {
pname = "gqlgenc";
version = "0.16.2";

src = final.fetchFromGitHub {
owner = "Yamashou";
repo = pname;
rev = "v${version}";
sha256 = "sha256-XNmCSkgJJ2notrv0Din4jlU9EoHJcznjEUiXQgQ5a7I=";
};

vendorHash = "sha256-6iwNykvW1m+hl6FzMNbvvPpBNp8OQn2/vfJLmAj60Mw=";

doCheck = false;

subPackages = [ "./." ];

meta = with final.lib; {
description = "This is Go library for building GraphQL client with gqlgen";
homepage = "https://github.com/Yamashou/gqlgenc";
license = licenses.mit;
maintainers = [ "@nhost" ];
};
};

oapi-codegen = prev.oapi-codegen.override rec {
buildGoModule = args: final.buildGoModule (args // rec {
version = "2.0.0";
src = final.fetchFromGitHub {
owner = "deepmap";
repo = "oapi-codegen";
rev = "v${version}";
sha256 = "sha256-LZaNuT2JMWYXllKxAOciKT9ybBFuCV1LyIP2MwxbJ2M=";
};

subPackages = [ "cmd/oapi-codegen" ];
vendorHash = "sha256-d5PvdxQCAwMPi1Oh2E7p4dVRukED26N+3cU8FMcT16U=";
});
};

}
43 changes: 43 additions & 0 deletions overlays/postgres.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
final: prev: rec {
postgresql_146 = prev.postgresql_14.overrideAttrs
(finalAttrs: previousAttrs: rec {
pname = "postgresql";
version = "14.6";

src = final.fetchurl {
url = "mirror://postgresql/source/v${version}/${pname}-${version}.tar.bz2";
hash = "sha256-UIhA/BgJ05q3InTV8Tfau5/X+0+TPaQWiu67IAae3yI=";
};
});

postgresql_146-client = postgresql_146.overrideAttrs
(finalAttrs: previousAttrs: {
buildInputs = with final.pkgs; [ zlib openssl ];
configureFlags = [
"--with-openssl"
"--without-readline"
"--sysconfdir=/etc"
"--libdir=$(lib)/lib"
"--with-system-tzdata=${final.pkgs.tzdata}/share/zoneinfo"
];

separateDebugInfo = false;
buildFlags = [ ];
installTargets = [ "-C src/bin install" "-C ../interfaces install" ];

postInstall =
''
cp src/bin/pg_dump/pg_dump $out/bin
cp src/bin/pg_dump/pg_restore $out/bin
cp src/bin/psql/psql $out/bin
moveToOutput "lib/pgxs" "$out" # looks strange, but not deleting it
moveToOutput "lib/libpgcommon*.a" "$out"
moveToOutput "lib/libpgport*.a" "$out"
moveToOutput "lib/libecpg*" "$out"
'';

postFixup = "";
outputs = [ "out" "lib" ];
});
}

0 comments on commit 6c0e433

Please sign in to comment.