/ src / examples / zlib-test / BUCK.analyze
BUCK.analyze
 1  # Example using nix_analyze rules
 2  #
 3  # This approach:
 4  # 1. nix_library resolves nixpkgs#zlib to store paths
 5  # 2. nix_cxx_binary compiles with those paths
 6  #
 7  # Buck2 builds the analysis graph, nix-analyze provides information.
 8  
 9  load("@toolchains//:nix_analyze.bzl", "nix_library", "nix_cxx_binary")
10  
11  # Expose zlib from nixpkgs as a library
12  nix_library(
13      name = "zlib",
14      flake_ref = "nixpkgs#zlib",
15  )
16  
17  # Build our test program
18  nix_cxx_binary(
19      name = "zlib-test",
20      srcs = ["main.cpp"],
21      deps = [":zlib"],
22      cflags = ["-O2", "-Wall"],
23  )