-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
50c8fba
commit 473f4b3
Showing
5 changed files
with
388 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# use https://github.com/nix-community/nix-direnv to load all tools needed to develop in the repository | ||
# $ cp .envrc.example .envrc | ||
# $ direnv allow . | ||
use flake --impure . | ||
|
||
# alternatively just use `nix develop` or `nix-shell` |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{ | ||
description = "ddapm_test_agent"; | ||
nixConfig.bash-prompt-prefix = "\[ddapm_test_agent\] "; | ||
|
||
inputs = { | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
treefmt-nix.url = "github:numtide/treefmt-nix"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/24.05"; | ||
|
||
|
||
ddsketch-flake.url = "github:pawelchcki/sketches-py/pawel/nix"; | ||
|
||
nix2containerPkg.url = "github:nlewo/nix2container"; | ||
}; | ||
|
||
outputs = | ||
{ self | ||
, nixpkgs | ||
, flake-utils | ||
, treefmt-nix | ||
, ddsketch-flake | ||
, nix2containerPkg | ||
, | ||
}: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
nix2container = nix2containerPkg.packages.${system}.nix2container; | ||
ddsketch = ddsketch-flake.packages.${system}.default; | ||
|
||
python = ddsketch-flake.packages.${system}.python; | ||
|
||
pythonDevEnv = python; | ||
|
||
treefmt = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; | ||
|
||
finalApp = python.pkgs.buildPythonApplication rec { | ||
name = "ddapm-test-agent"; | ||
version = "0.0.0"; | ||
src = ./.; | ||
|
||
doCheck = false; | ||
|
||
propagatedBuildInputs = with python.pkgs; [ aiohttp msgpack ddsketch ]; | ||
nativeBuildInputs = with python.pkgs; [ | ||
setuptools | ||
setuptools_scm | ||
yarl | ||
requests | ||
]; | ||
env.SETUPTOOLS_SCM_PRETEND_VERSION = version; | ||
}; | ||
|
||
devEnv = pkgs.buildEnv { | ||
name = "root"; | ||
paths = [ pkgs.bashInteractive pkgs.coreutils treefmt.config.build.wrapper pythonDevEnv ]; | ||
pathsToLink = [ "/bin" ]; | ||
}; | ||
in | ||
{ | ||
packages = { | ||
python = python; | ||
ddsketch = ddsketch-flake; | ||
ciContainer = nix2container.buildImage { | ||
name = "registry.ddbuild.io/apm-reliability-environment/handmade/nixci"; | ||
|
||
copyToRoot = pkgs.buildEnv { | ||
name = "root"; | ||
paths = [ devEnv python.pkgs.pytest ]; | ||
pathsToLink = [ "/bin" ]; | ||
}; | ||
}; | ||
toolContainer = nix2container.buildImage { | ||
name = "registry.ddbuild.io/apm-reliability-environment/handmade/docker-builder"; | ||
tag = "latest"; | ||
config = { | ||
entrypoint = [ "/bin/docker-builder" ]; | ||
}; | ||
|
||
copyToRoot = pkgs.buildEnv { | ||
name = "root"; | ||
paths = [ finalApp ]; | ||
pathsToLink = [ "/bin" ]; | ||
}; | ||
}; | ||
}; | ||
|
||
packages.default = finalApp; | ||
formatter = treefmt.config.build.wrapper; | ||
|
||
devShells.default = | ||
pkgs.mkShell | ||
{ | ||
venvDir = "./.venv"; | ||
nativeBuildInputs = [ pythonDevEnv python.pkgs.venvShellHook ]; | ||
packages = [ | ||
devEnv | ||
python.pkgs.pytest | ||
]; | ||
postShellHook = '' | ||
export PYTHONPATH="$PYTHONPATH:$(pwd)" # ensuring pytest invocation works | ||
''; | ||
}; | ||
}); | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
(builtins.getFlake ("git+file://" + toString ./.)).devShells.${builtins.currentSystem}.default |