Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network update and GIVC TLS #915

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
22 changes: 11 additions & 11 deletions flake.lock

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

65 changes: 36 additions & 29 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
};

givc = {
url = "github:tiiuae/ghaf-givc/63e19e1b61a669a21c1bdd0ae5a8e169b2f2d2f6";
url = "github:tiiuae/ghaf-givc/be9c368d935bd1b2bc61b89df8dbf62c3b5d8395";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
Expand All @@ -156,7 +156,7 @@
};

ctrl-panel = {
url = "github:tiiuae/ghaf-ctrl-panel/5ca381ba51c05cf370299056f6e377cd6003283f";
url = "github:tiiuae/ghaf-ctrl-panel/ef4b843c975030a8156390e3aa6f5536da0ad5c9";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
Expand All @@ -170,31 +170,38 @@
let
lib = import ./lib.nix { inherit inputs; };
in
flake-parts.lib.mkFlake { inherit inputs; } {
# Toggle this to allow debugging in the repl
# see:https://flake.parts/debug
debug = false;

systems = [
"x86_64-linux"
"aarch64-linux"
# RISC-V is a target built from cross compilation and is not
# included as a host build possibility at this point
# Future HW permitting this can be re-evaluated
#"riscv64-linux"
];

imports = [
./overlays/flake-module.nix
./modules/flake-module.nix
./nix/flake-module.nix
./packages/flake-module.nix
./targets/flake-module.nix
./hydrajobs/flake-module.nix
./templates/flake-module.nix
./tests/flake-module.nix
];

flake.lib = lib;
};
flake-parts.lib.mkFlake
{
inherit inputs;
specialArgs = {
inherit lib;
};
}
{
# Toggle this to allow debugging in the repl
# see:https://flake.parts/debug
debug = false;

systems = [
"x86_64-linux"
"aarch64-linux"
# RISC-V is a target built from cross compilation and is not
# included as a host build possibility at this point
# Future HW permitting this can be re-evaluated
#"riscv64-linux"
];

imports = [
./overlays/flake-module.nix
./modules/flake-module.nix
./nix/flake-module.nix
./packages/flake-module.nix
./targets/flake-module.nix
./hydrajobs/flake-module.nix
./templates/flake-module.nix
./tests/flake-module.nix
];

flake.lib = lib;
};
}
57 changes: 56 additions & 1 deletion modules/common/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@
#
# TODO: Refactor even more.
# This is the old "host/default.nix" file.
{ lib, ... }:
#
# ghaf.common: Interface to share ghaf configs from host to VMs
#
{ config, lib, ... }:
let
inherit (builtins) attrNames hasAttr;
inherit (lib)
mkOption
types
optionalAttrs
optionalString
attrsets
;
in
{
imports = [
# TODO remove this when the minimal config is defined
Expand All @@ -14,7 +27,49 @@
#(modulesPath + "/profiles/minimal.nix")
];

options.ghaf = {
common = {
vms = mkOption {
type = types.listOf types.str;
default = [ ];
description = "List of VMs currently enabled.";
};
systemHosts = mkOption {
type = types.listOf types.str;
default = [ ];
description = "List of system hosts currently enabled.";
};
appHosts = mkOption {
type = types.listOf types.str;
default = [ ];
description = "List of app hosts currently enabled.";
};
};
type = mkOption {
description = "Type of the ghaf component. One of 'host', 'system-vm', or 'app-vm'.";
type = types.str;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to use lib.types.enum here.

};
};

config = {

# Populate the shared namespace
ghaf = optionalAttrs (hasAttr "microvm" config) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would hasAttrByPath ["microvm" "vms"] config make this more readable? Instead of the two checks.

common = optionalAttrs (hasAttr "vms" config.microvm) {
vms = attrNames config.microvm.vms;
systemHosts = lib.lists.remove "" (
lib.attrsets.mapAttrsToList (
n: v: lib.optionalString (v.config.config.ghaf.type == "system-vm") n
) config.microvm.vms
);
appHosts = lib.lists.remove "" (
lib.attrsets.mapAttrsToList (
n: v: lib.optionalString (v.config.config.ghaf.type == "app-vm") n
) config.microvm.vms
);
};
};

system.stateVersion = lib.trivial.release;

####
Expand Down
6 changes: 5 additions & 1 deletion modules/common/networking/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{ imports = [ ./hosts.nix ]; }
{
imports = [
./hosts.nix
];
}
Loading
Loading