diff --git a/flake.nix b/flake.nix index acff34db..6dd08a67 100644 --- a/flake.nix +++ b/flake.nix @@ -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' @@ -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 = { diff --git a/hosts/nr/darwin-configuration.nix b/hosts/nr/darwin-configuration.nix index 0db1064e..ba983edc 100644 --- a/hosts/nr/darwin-configuration.nix +++ b/hosts/nr/darwin-configuration.nix @@ -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 @@ -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: { diff --git a/hosts/vm/configuration-nr.nix b/hosts/vm/configuration-nr.nix new file mode 100644 index 00000000..1c2caedf --- /dev/null +++ b/hosts/vm/configuration-nr.nix @@ -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; +} diff --git a/hosts/vm/configuration.nix b/hosts/vm/configuration.nix index a3fe3d80..e667f076 100644 --- a/hosts/vm/configuration.nix +++ b/hosts/vm/configuration.nix @@ -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