Skip to content

Commit b46666c

Browse files
committed
Enable GIVC and logging for nvidia targets
Signed-off-by: vadik likholetov <vadikas@gmail.com>
1 parent 6e68cd6 commit b46666c

File tree

3 files changed

+43
-18
lines changed

3 files changed

+43
-18
lines changed

lib/builders/mkGhafConfiguration.nix

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
# extraModules - Additional NixOS modules for the host (default: [])
3535
# extraConfig - Additional ghaf.* configuration (default: {})
3636
# vmConfig - VM resource allocation and modules (default: {})
37+
# globalConfigOverrides - Overrides merged into variant global-config (default: {})
3738
# Maps to ghaf.virtualization.vmConfig
3839
#
3940
# Output:
@@ -64,6 +65,7 @@ let
6465
extraModules ? [ ],
6566
extraConfig ? { },
6667
vmConfig ? { },
68+
globalConfigOverrides ? { },
6769
}:
6870
let
6971
# Select the profile module based on target type
@@ -106,22 +108,21 @@ let
106108
# Variant configuration (debug/release profiles)
107109
# Sets both:
108110
# 1. ghaf.profiles.{debug,release}.enable for host-side module activation
109-
# 2. ghaf.global-config to the corresponding profile for VM-side config propagation
111+
# 2. ghaf.global-config to the corresponding profile for VM-side config propagation,
112+
# merged with per-target globalConfigOverrides
110113
#
111-
# Note: global-config uses mkDefault so that platform-specific profiles (like orin.nix)
112-
# can override specific values. For example, orin.nix sets ghaf.givc.enable = false
113-
# and this should propagate to VMs via ghaf.global-config.givc.enable.
114+
# Note: global-config uses mkDefault so target modules can still override specific
115+
# values when needed.
116+
baseGlobalConfig = lib.ghaf.profiles.${variant} or lib.ghaf.profiles.minimal;
117+
mergedGlobalConfig = lib.recursiveUpdate baseGlobalConfig globalConfigOverrides;
118+
114119
variantModule = {
115120
ghaf.profiles = {
116121
debug.enable = variant == "debug";
117122
release.enable = variant == "release";
118123
};
119-
# Set global-config to match the variant's profile using mkDefault
120-
# This allows profile modules to override specific global-config values
121-
# Example: orin.nix can set ghaf.global-config.givc.enable = false
122-
ghaf.global-config = lib.mapAttrsRecursive (_: v: lib.mkDefault v) (
123-
lib.ghaf.profiles.${variant} or lib.ghaf.profiles.minimal
124-
);
124+
# Set global-config to the selected variant profile merged with target overrides.
125+
ghaf.global-config = lib.mapAttrsRecursive (_: v: lib.mkDefault v) mergedGlobalConfig;
125126
};
126127

127128
# Build the host NixOS configuration
@@ -164,6 +165,7 @@ let
164165
variant
165166
extraConfig
166167
vmConfig
168+
globalConfigOverrides
167169
;
168170
extraModules = extraModules ++ modules;
169171
};
@@ -180,6 +182,7 @@ let
180182
variant
181183
extraModules
182184
extraConfig
185+
globalConfigOverrides
183186
;
184187
vmConfig = vmConfig // {
185188
${vmName} = (vmConfig.${vmName} or { }) // {

modules/profiles/orin.nix

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,6 @@ in
209209
nvidia-docker.daemon.enable = true;
210210
};
211211

212-
# Disable givc on Orin - GIVC requires TLS certificate infrastructure
213-
# that isn't set up for Orin devices. This must be set in both:
214-
# 1. ghaf.givc.enable (host-level option)
215-
# 2. ghaf.global-config.givc.enable (propagates to VMs via specialArgs)
216-
givc.enable = false;
217-
global-config.givc.enable = false;
218-
219212
host.networking = {
220213
enable = true;
221214
};

targets/nvidia-jetson-orin/flake-module.nix

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-FileCopyrightText: 2022-2026 TII (SSRC) and the Ghaf contributors
22
# SPDX-License-Identifier: Apache-2.0
33
#
4-
# Configuration for NVIDIA Jetson Orin AGX/NX
4+
# Configuration for NVIDIA Jetson Orin AGX/NX
55
#
66
{
77
lib,
@@ -42,8 +42,29 @@ let
4242
self.nixosModules.reference-host-demo-apps
4343
self.nixosModules.reference-profiles-orin
4444
self.nixosModules.profiles
45+
(
46+
{ config, ... }:
47+
{
48+
ghaf.givc.enable = true;
49+
ghaf.givc.debug = false;
50+
51+
ghaf.logging = {
52+
enable = true;
53+
server.endpoint = "https://loki.ghaflogs.vedenemo.dev/loki/api/v1/push";
54+
listener.address = config.ghaf.networking.hosts.admin-vm.ipv4;
55+
};
56+
}
57+
)
4558
];
4659

60+
orinGlobalConfigOverrides = {
61+
givc.enable = true;
62+
logging = {
63+
enable = true;
64+
server.endpoint = "https://loki.ghaflogs.vedenemo.dev/loki/api/v1/push";
65+
};
66+
};
67+
4768
# All Orin configurations using mkGhafConfiguration
4869
target-configs = [
4970
# ============================================================
@@ -56,6 +77,7 @@ let
5677
profile = "orin";
5778
hardwareModule = self.nixosModules.hardware-nvidia-jetson-orin-agx;
5879
variant = "debug";
80+
globalConfigOverrides = orinGlobalConfigOverrides;
5981
extraModules = commonModules;
6082
extraConfig = {
6183
reference.profiles.mvp-orinuser-trial.enable = true;
@@ -68,6 +90,7 @@ let
6890
profile = "orin";
6991
hardwareModule = self.nixosModules.hardware-nvidia-jetson-orin-agx64;
7092
variant = "debug";
93+
globalConfigOverrides = orinGlobalConfigOverrides;
7194
extraModules = commonModules;
7295
extraConfig = {
7396
reference.profiles.mvp-orinuser-trial.enable = true;
@@ -80,6 +103,7 @@ let
80103
profile = "orin";
81104
hardwareModule = self.nixosModules.hardware-nvidia-jetson-orin-agx-industrial;
82105
variant = "debug";
106+
globalConfigOverrides = orinGlobalConfigOverrides;
83107
extraModules = commonModules;
84108
extraConfig = {
85109
reference.profiles.mvp-orinuser-trial.enable = true;
@@ -92,6 +116,7 @@ let
92116
profile = "orin";
93117
hardwareModule = self.nixosModules.hardware-nvidia-jetson-orin-nx;
94118
variant = "debug";
119+
globalConfigOverrides = orinGlobalConfigOverrides;
95120
extraModules = commonModules;
96121
extraConfig = {
97122
reference.profiles.mvp-orinuser-trial.enable = true;
@@ -108,6 +133,7 @@ let
108133
profile = "orin";
109134
hardwareModule = self.nixosModules.hardware-nvidia-jetson-orin-agx;
110135
variant = "release";
136+
globalConfigOverrides = orinGlobalConfigOverrides;
111137
extraModules = commonModules;
112138
extraConfig = {
113139
reference.profiles.mvp-orinuser-trial.enable = true;
@@ -120,6 +146,7 @@ let
120146
profile = "orin";
121147
hardwareModule = self.nixosModules.hardware-nvidia-jetson-orin-agx64;
122148
variant = "release";
149+
globalConfigOverrides = orinGlobalConfigOverrides;
123150
extraModules = commonModules;
124151
extraConfig = {
125152
reference.profiles.mvp-orinuser-trial.enable = true;
@@ -132,6 +159,7 @@ let
132159
profile = "orin";
133160
hardwareModule = self.nixosModules.hardware-nvidia-jetson-orin-agx-industrial;
134161
variant = "release";
162+
globalConfigOverrides = orinGlobalConfigOverrides;
135163
extraModules = commonModules;
136164
extraConfig = {
137165
reference.profiles.mvp-orinuser-trial.enable = true;
@@ -144,6 +172,7 @@ let
144172
profile = "orin";
145173
hardwareModule = self.nixosModules.hardware-nvidia-jetson-orin-nx;
146174
variant = "release";
175+
globalConfigOverrides = orinGlobalConfigOverrides;
147176
extraModules = commonModules;
148177
extraConfig = {
149178
reference.profiles.mvp-orinuser-trial.enable = true;

0 commit comments

Comments
 (0)