Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,45 @@ jobs:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7

- name: Install Nix
uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Enable binary cache with Cachix
uses: cachix/cachix-action@v16
uses: cachix/cachix-action@v17
with:
name: nix-relic
# If you chose API tokens for write access OR if you have a private cache
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Run Nix checks
run: nix flake check

build:
needs: [checks]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
pkg: [infrastructure-agent, ocb, nr-otel-collector]

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7

- name: Install Nix
uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Enable binary cache with Cachix
uses: cachix/cachix-action@v16
uses: cachix/cachix-action@v17
with:
name: nix-relic
# If you chose API tokens for write access OR if you have a private cache
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Build ${{ matrix.pkg }} with Nix
run: nix build --print-out-paths ".#${{ matrix.pkg }}"
run: nix build --print-out-paths ".#${{ matrix.pkg }}"
2 changes: 1 addition & 1 deletion .github/workflows/flakehub-publish-rolling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
id-token: "write"
contents: "read"
steps:
- uses: "actions/checkout@v5"
- uses: "actions/checkout@v7"
- uses: "DeterminateSystems/nix-installer-action@main"
- uses: "DeterminateSystems/flakehub-push@main"
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
result
6 changes: 3 additions & 3 deletions flake.lock

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

25 changes: 23 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
{ nixpkgs, ... }@inputs:
let
# Supported systems for flake packages, shell, etc.
# x86_64-darwin was dropped from nixpkgs in 26.11
systems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
Expand All @@ -26,5 +26,26 @@
darwinModules = import ./modules/darwin;

overlays = import ./overlays { inherit inputs; };

formatter = forAllSystems (
system:
nixpkgs.legacyPackages.${system}.nixfmt
);

devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
packages = with pkgs; [
nixfmt
statix
deadnix
];
};
}
);
};
}
}
4 changes: 2 additions & 2 deletions overlays/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file defines overlays
{inputs, ...}: {
{ inputs, ... }: {
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs {pkgs = final;};
additions = final: _prev: import ../pkgs { pkgs = final; };

# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
Expand Down
3 changes: 1 addition & 2 deletions pkgs/infrastructure-agent.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
}:
Expand All @@ -24,7 +23,7 @@ buildGoModule rec {
"-X main.gitCommit=${src.rev}"
];

env.CGO_ENABLED = if stdenv.hostPlatform.isDarwin then "1" else "0";
# CGO is enabled by default on Darwin and disabled elsewhere by buildGoModule

subPackages = [
"cmd/newrelic-infra"
Expand Down
2 changes: 0 additions & 2 deletions pkgs/nr-otel-collector/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ buildGoModule {
# The TestGenerateAndCompile tests download new dependencies for a modified go.mod. Nix doesn't allow network access so skipping.
checkFlags = [ "-skip TestValidateConfigs" ];

env.CGO_ENABLED = "0";

meta = with lib; {
description = "The New Relic distribution of the OpenTelemetry Collector";
homepage = "https://github.com/newrelic/opentelemetry-collector-releases.git";
Expand Down
2 changes: 0 additions & 2 deletions pkgs/ocb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ buildGoModule rec {
sourceRoot = "${src.name}/cmd/builder";
vendorHash = "sha256-MTwD9xkrq3EudppLSoONgcPCBWlbSmaODLH9NtYgVOk=";

GOFLAGS = [ "-trimpath" ];
env.CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
Expand Down
Loading