-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
102 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,78 @@ | ||
{ | ||
inputs = { | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
inputs = { flake-utils.url = "github:numtide/flake-utils"; }; | ||
|
||
outputs = { self, nixpkgs, flake-utils, ... }: | ||
let | ||
outputsWithoutSystem = { }; | ||
outputsWithSystem = flake-utils.lib.eachDefaultSystem | ||
(system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
outputsWithSystem = flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
# lib = pkgs.lib; | ||
in { | ||
devShells = { | ||
default = pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
go | ||
mockgen # Go mock generator | ||
gopls # Go LSP | ||
golangci-lint # Go linter | ||
wire # Go dependency injection | ||
go-migrate # Go SQL migration | ||
bunyan-rs # Bunyan format pretty print | ||
entr # FS watcher | ||
bun # Bun JS runtime | ||
minify # JS minifier | ||
clickhouse # clickhouse client | ||
hyperfine # binary benchmarks | ||
]; | ||
}; | ||
# lib = pkgs.lib; | ||
in | ||
{ | ||
devShells = { | ||
default = pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
go | ||
mockgen # Go mock generator | ||
gopls # Go LSP | ||
golangci-lint # Go linter | ||
wire # Go dependency injection | ||
go-migrate # Go SQL migration | ||
bunyan-rs # Bunyan format pretty print | ||
entr # FS watcher | ||
bun # Bun JS runtime | ||
minify # JS minifier | ||
clickhouse # clickhouse client | ||
hyperfine # binary benchmarks | ||
]; | ||
}; | ||
}; | ||
packages = { | ||
default = pkgs.buildGoModule { | ||
pname = "prisme"; | ||
version = "0.16.0"; | ||
vendorHash = "sha256-OfLvMEEp+rraejuX1B9g9Pc/pk5Xtm2ec+wxTBjSFBk="; | ||
}; | ||
packages = { | ||
default = pkgs.buildGoModule { | ||
pname = "prisme"; | ||
version = "0.16.0"; | ||
vendorHash = | ||
"sha256-F3ZUU+hixLOOZrDjfHOuxHnopzIdc/9qxR6rMeUbt/0="; | ||
|
||
src = ./.; | ||
# Skip go test. | ||
doCheck = false; | ||
src = ./.; | ||
# Skip go test. | ||
doCheck = false; | ||
|
||
postBuild = '' | ||
mv "$GOPATH/bin/server" "$GOPATH/bin/prisme" | ||
''; | ||
postBuild = '' | ||
mv "$GOPATH/bin/server" "$GOPATH/bin/prisme" | ||
''; | ||
|
||
subPackages = "./cmd/server"; | ||
}; | ||
subPackages = "./cmd/server"; | ||
}; | ||
|
||
docker = pkgs.dockerTools.buildImage { | ||
name = "prismelabs/analytics"; | ||
tag = "dev"; | ||
docker = pkgs.dockerTools.buildImage { | ||
name = "prismelabs/analytics"; | ||
tag = "dev"; | ||
|
||
copyToRoot = [ pkgs.cacert ]; | ||
runAsRoot = '' | ||
#!${pkgs.runtimeShell} | ||
mkdir -p /app | ||
cp -r ${self.packages."${system}".prisme-healthcheck}/bin/* /healthcheck | ||
''; | ||
copyToRoot = [ pkgs.cacert ]; | ||
runAsRoot = '' | ||
#!${pkgs.runtimeShell} | ||
mkdir -p /app | ||
cp -r ${ | ||
self.packages."${system}".prisme-healthcheck | ||
}/bin/* /healthcheck | ||
''; | ||
|
||
config = { | ||
Cmd = [ "${self.packages.${system}.default}/bin/prisme" ]; | ||
WorkingDir = "/app"; | ||
Env = [ "PRISME_ADMIN_HOSTPORT=0.0.0.0:9090" ]; | ||
}; | ||
config = { | ||
Cmd = [ "${self.packages.${system}.default}/bin/prisme" ]; | ||
WorkingDir = "/app"; | ||
Env = [ "PRISME_ADMIN_HOSTPORT=0.0.0.0:9090" ]; | ||
}; | ||
}; | ||
|
||
prisme-healthcheck = pkgs.writeShellApplication { | ||
name = "prisme-healthcheck"; | ||
runtimeInputs = with pkgs; [ wget ]; | ||
text = '' | ||
wget --no-verbose --tries=1 --spider "http://localhost:''${PRISME_PORT:-80}/api/v1/healthcheck" || exit 1 | ||
''; | ||
}; | ||
prisme-healthcheck = pkgs.writeShellApplication { | ||
name = "prisme-healthcheck"; | ||
runtimeInputs = with pkgs; [ wget ]; | ||
text = '' | ||
wget --no-verbose --tries=1 --spider "http://localhost:''${PRISME_PORT:-80}/api/v1/healthcheck" || exit 1 | ||
''; | ||
}; | ||
}); | ||
in | ||
outputsWithSystem // outputsWithoutSystem; | ||
}; | ||
}); | ||
in outputsWithSystem // outputsWithoutSystem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters