Skip to content

Commit

Permalink
refactor: separate observability module
Browse files Browse the repository at this point in the history
  • Loading branch information
DavSanchez committed Oct 4, 2023
1 parent c18d7ca commit 42e78d1
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 6 deletions.
12 changes: 12 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
// {
x86_64-linux.linuxVM = self.nixosConfigurations.linuxVM.config.system.build.vm;
aarch64-darwin.darwinVM = self.nixosConfigurations.darwinVM.config.system.build.vm;
aarch64-darwin.darwinVM-NR = self.nixosConfigurations.darwinVM-NR.config.system.build.vm;
};

# Formatter for the nix files, available through 'nix fmt'
Expand Down Expand Up @@ -96,6 +97,17 @@
}
];
};
darwinVM-NR = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/vm/configuration-nr.nix
# TODO: Put NR O11y utils in a separate module to be included here
{
virtualisation.vmVariant.virtualisation.host.pkgs = nixpkgs.legacyPackages.aarch64-darwin;
}
];
};
};
# macOS systems using nix-darwin
darwinConfigurations = {
Expand Down
16 changes: 11 additions & 5 deletions hosts/nr/darwin-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@
# ./users.nix

inputs.nix-relic.darwinModules.newrelic-infra
inputs.nix-relic.darwinModules.nr-otel-collector
];

# services.newrelic-infra = {
# enable = true;
# config = ../../../secrets/newrelic-infra-config.yml;
# };
services.newrelic-infra = {
enable = true;
configFile = ../../secrets/newrelic-infra-config.yml;
};

services.nr-otel-collector = {
enable = true;
configFile = ../../secrets/nr-otel-collector-config.yml;
};

nixpkgs = {
# You can add overlays here
Expand All @@ -37,7 +43,7 @@

# Or overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
inputs.nix-relic.overlays.default
inputs.nix-relic.overlays.additions

# Or define it inline, for example:
# (final: prev: {
Expand Down
47 changes: 47 additions & 0 deletions hosts/vm/configuration-nr.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
pkgs,
inputs,
outputs,
...
}: {
imports = [
inputs.nix-relic.nixosModules.newrelic-infra
];

nixpkgs = {
overlays = [
outputs.overlays.modifications
outputs.overlays.additions

inputs.nix-relic.overlays.additions # new packages such as the infra agent and nrdot
];
};

services.newrelic-infra = {
enable = true;
configFile = ../../secrets/newrelic-infra-config.yml;
};

services.opentelemetry-collector = {
enable = true;
package = pkgs.nr-otel-collector;
configFile = ../../secrets/nr-otel-collector-config.yml;
};

system.stateVersion = "23.05";

# Configure networking
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true;

# Create user "test"
services.getty.autologinUser = "test";
users.users.test.isNormalUser = true;

# Enable passwordless ‘sudo’ for the "test" user
users.users.test.extraGroups = ["wheel"];
security.sudo.wheelNeedsPassword = false;

# Make VM output to the terminal instead of a separate window
virtualisation.vmVariant.virtualisation.graphics = false;
}
31 changes: 30 additions & 1 deletion hosts/vm/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
{pkgs, ...}: {
{
pkgs,
inputs,
outputs,
...
}: {
# imports = [
# inputs.nix-relic.nixosModules.newrelic-infra
# ];

nixpkgs = {
overlays = [
outputs.overlays.modifications
outputs.overlays.additions

# inputs.nix-relic.overlays.additions # new packages such as the infra agent and nrdot
];
};

# services.newrelic-infra = {
# enable = true;
# configFile = ../../secrets/newrelic-infra-config.yml;
# };

# services.opentelemetry-collector = {
# enable = true;
# package = pkgs.nr-otel-collector;
# configFile = ../../secrets/nr-otel-collector-config.yml;
# };

system.stateVersion = "23.05";

# Configure networking
Expand Down

0 comments on commit 42e78d1

Please sign in to comment.