Compare commits
1 commit
0d3ad9c5e7
...
4249a4e51e
Author | SHA1 | Date | |
---|---|---|---|
Félix Baylac Jacqué | 4249a4e51e |
|
@ -14,6 +14,7 @@ ENABLE_FUNCTIONAL_TESTS = @ENABLE_FUNCTIONAL_TESTS@
|
|||
ENABLE_INTERNAL_API_DOCS = @ENABLE_INTERNAL_API_DOCS@
|
||||
ENABLE_S3 = @ENABLE_S3@
|
||||
ENABLE_UNIT_TESTS = @ENABLE_UNIT_TESTS@
|
||||
ENABLE_TRACY = @ENABLE_TRACY@
|
||||
GTEST_LIBS = @GTEST_LIBS@
|
||||
HAVE_LIBCPUID = @HAVE_LIBCPUID@
|
||||
HAVE_SECCOMP = @HAVE_SECCOMP@
|
||||
|
|
|
@ -14,6 +14,5 @@ TODO: explain
|
|||
|
||||
## TODOs
|
||||
|
||||
- Add config flag to enable tracing.
|
||||
- Remove tracy submodule approach, inject it through Nix.
|
||||
-
|
||||
- Document everything.
|
||||
- Rewrite autotools madness with somebody who actually know what they're doing.
|
||||
|
|
11
configure.ac
11
configure.ac
|
@ -348,6 +348,17 @@ if test "$gc" = yes; then
|
|||
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(tracy-profiler, AS_HELP_STRING([--enable-tracy-profiler],[Profile the Nix evaluation using the Tracy profiler (default no)]),
|
||||
TRACY_PROFILER=$enableval, TRACY_PROFILER=no)
|
||||
if test "$TRACY_PROFILER" != no; then
|
||||
CXXFLAGS="-I $TRACY_PROFILER/include/Tracy $CXXFLAGS"
|
||||
echo "TRACY ENABLED: $TRACY_PROFILER"
|
||||
else
|
||||
echo "TRACY DISABLED"
|
||||
exit 1
|
||||
fi
|
||||
AC_SUBST(TRACY_PROFILER)
|
||||
|
||||
AS_IF([test "$ENABLE_UNIT_TESTS" == "yes"],[
|
||||
|
||||
# Look for gtest.
|
||||
|
|
19
flake.lock
19
flake.lock
|
@ -64,12 +64,29 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-tracy": {
|
||||
"locked": {
|
||||
"lastModified": 1707205788,
|
||||
"narHash": "sha256-dFPctGYh7cNPAuJQY9i4+1/M+LdrRDpk0RRwpClEQ4w=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e311f423a6e56505afae9d4b621759826e7270c0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"libgit2": "libgit2",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-regression": "nixpkgs-regression"
|
||||
"nixpkgs-regression": "nixpkgs-regression",
|
||||
"nixpkgs-tracy": "nixpkgs-tracy"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
13
flake.nix
13
flake.nix
|
@ -2,11 +2,14 @@
|
|||
description = "The purely functional package manager";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05-small";
|
||||
# Tracy is in a half-broken situation on 23.05. We need the changes
|
||||
# introduced by https://github.com/NixOS/nixpkgs/pull/261589.
|
||||
inputs.nixpkgs-tracy.url = "github:NixOS/nixpkgs/nixos-23.11-small";
|
||||
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
||||
inputs.flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
||||
inputs.libgit2 = { url = "github:libgit2/libgit2"; flake = false; };
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-regression, libgit2, ... }:
|
||||
outputs = { self, nixpkgs, nixpkgs-regression, libgit2, nixpkgs-tracy, ... }:
|
||||
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
@ -186,6 +189,8 @@
|
|||
stdenv
|
||||
versionSuffix
|
||||
;
|
||||
tracy = final.callPackage (nixpkgs-tracy.legacyPackages.${final.hostPlatform.system}.path + "/pkgs/development/tools/tracy") {};
|
||||
enableTracy = true;
|
||||
officialRelease = false;
|
||||
boehmgc = final.boehmgc-nix;
|
||||
libgit2 = final.libgit2-nix;
|
||||
|
@ -223,6 +228,10 @@
|
|||
self.packages.${system}.nix.override { enableGC = false; }
|
||||
);
|
||||
|
||||
buildWithTracy = forAllSystems (system:
|
||||
self.packages.${system}.nix.override { enableTracy = true; }
|
||||
);
|
||||
|
||||
buildNoTests = forAllSystems (system:
|
||||
self.packages.${system}.nix.override {
|
||||
doCheck = false;
|
||||
|
@ -394,7 +403,7 @@
|
|||
stdenvs)));
|
||||
|
||||
devShells = let
|
||||
makeShell = pkgs: stdenv: (pkgs.nix.override { inherit stdenv; forDevShell = true; }).overrideAttrs (attrs: {
|
||||
makeShell = pkgs: stdenv: (pkgs.nix.override { inherit stdenv; forDevShell = true; enableTracy = true; }).overrideAttrs (attrs: {
|
||||
installFlags = "sysconfdir=$(out)/etc";
|
||||
shellHook = ''
|
||||
PATH=$prefix/bin:$PATH
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
, rapidcheck
|
||||
, sqlite
|
||||
, util-linux
|
||||
, tracy
|
||||
, xz
|
||||
|
||||
, busybox-sandbox-shell ? null
|
||||
|
@ -76,6 +77,9 @@
|
|||
# only leaked *within* the process.)
|
||||
, enableGC ? true
|
||||
|
||||
# TODO
|
||||
, enableTracy ? false
|
||||
|
||||
# Whether to enable Markdown rendering in the Nix binary.
|
||||
, enableMarkdown ? !stdenv.hostPlatform.isWindows
|
||||
|
||||
|
@ -234,6 +238,7 @@ in {
|
|||
rapidcheck
|
||||
] ++ lib.optional stdenv.isLinux libseccomp
|
||||
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid
|
||||
++ lib.optional enableTracy tracy
|
||||
# There have been issues building these dependencies
|
||||
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform && (stdenv.isLinux || stdenv.isDarwin))
|
||||
(aws-sdk-cpp.override {
|
||||
|
@ -287,6 +292,8 @@ in {
|
|||
(lib.enableFeature enableMarkdown "markdown")
|
||||
(lib.enableFeature installUnitTests "install-unit-tests")
|
||||
(lib.withFeatureAs true "readline-flavor" readlineFlavor)
|
||||
] ++ lib.optionals (enableTracy) [
|
||||
"--enable-tracy-profiler=${tracy}"
|
||||
] ++ lib.optionals (!forDevShell) [
|
||||
"--sysconfdir=/etc"
|
||||
] ++ lib.optionals installUnitTests [
|
||||
|
|
|
@ -10,10 +10,9 @@ libexpr_SOURCES := \
|
|||
$(wildcard $(d)/primops/*.cc) \
|
||||
$(wildcard $(d)/flake/*.cc) \
|
||||
$(d)/lexer-tab.cc \
|
||||
$(d)/parser-tab.cc \
|
||||
$(d)/tracy/public/TracyClient.cpp
|
||||
$(d)/parser-tab.cc
|
||||
|
||||
libexpr_CXXFLAGS += -I src/libutil -I src/libstore -I src/libfetchers -I src/libmain -I src/libexpr -I src/libexpr/tracy/public -DTRACY_ENABLE=1
|
||||
libexpr_CXXFLAGS += -I src/libutil -I src/libstore -I src/libfetchers -I src/libmain -I src/libexpr
|
||||
|
||||
libexpr_LIBS = libutil libstore libfetchers
|
||||
|
||||
|
@ -21,6 +20,10 @@ libexpr_LDFLAGS += -lboost_context $(THREAD_LDFLAGS)
|
|||
ifdef HOST_LINUX
|
||||
libexpr_LDFLAGS += -ldl
|
||||
endif
|
||||
ifneq ($(TRACY_PROFILER), no)
|
||||
libexpr_LDFLAGS += -ltracy
|
||||
libexpr_CXXFLAGS += -DTRACY_ENABLE=1
|
||||
endif
|
||||
|
||||
# The dependency on libgc must be propagated (i.e. meaning that
|
||||
# programs/libraries that use libexpr must explicitly pass -lgc),
|
||||
|
|
Loading…
Reference in a new issue