Skip to content

Commit edc9caf

Browse files
committed
Require two target inputs as nixosModules:
- a hardware profile - a platform profile The latter is implemented in our reference profile, but can be constructed downstream in the same way using the ghaf profiles. Both modules must not have an enable option, these modules are enabled by default if imported. All other modules should generally be guarded and enabled where needed. This only affects the import spaces, all nixosModules and respective options are available. This import logic should enable easy down- stream project creation: create a nixosConfiguration, and import hardware and platform definition modules either from within the project or inherit from ghaf. Signed-off-by: Manuel Bluhm <manuel@ssrc.tii.ae>
1 parent 52bc012 commit edc9caf

File tree

15 files changed

+51
-69
lines changed

15 files changed

+51
-69
lines changed

modules/flake-module.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
./hardware/flake-module.nix
1111
./microvm/flake-module.nix
1212
./reference/hardware/flake-module.nix
13+
./reference/profiles/flake-module.nix
1314
./profiles/flake-module.nix
1415
./common/flake-module.nix
1516
./development/flake-module.nix
@@ -21,7 +22,6 @@
2122
reference-appvms.imports = [ ./reference/appvms ];
2223
reference-host-demo-apps.imports = [ ./reference/host-demo-apps ];
2324
reference-personalize.imports = [ ./reference/personalize ];
24-
reference-profiles.imports = [ ./reference/profiles ];
2525
reference-programs.imports = [ ./reference/programs ];
2626
reference-services.imports = [ ./reference/services ];
2727
};

modules/hardware/flake-module.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44

55
flake.nixosModules = {
6-
hw-laptop.imports = [
6+
x86_64-hw-laptop.imports = [
77
./definition.nix
88
./x86_64-generic
99
./common/usb/internal.nix
@@ -15,7 +15,7 @@
1515
./common/qemu.nix
1616
./common/shared-mem.nix
1717
];
18-
hw-x86_64-generic.imports = [
18+
x86_64-hw-generic.imports = [
1919
./definition.nix
2020
./x86_64-generic
2121
];

modules/microvm/flake-module.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
];
1919

2020
mem-manager.imports = [
21-
./mem-manager.nix
21+
./host/mem-manager.nix
2222
];
23+
2324
vm-modules.imports = [
2425
./common/ghaf-audio.nix
2526
./common/shared-directory.nix

modules/microvm/host/microvm-host.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ in
2323
{
2424
imports = [
2525
inputs.impermanence.nixosModules.impermanence
26+
inputs.self.nixosModules.mem-manager
2627
inputs.self.nixosModules.givc
2728
./networking.nix
2829
];

modules/profiles/flake-module.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# Only entries that can be included in those targets without causing conflicts should be included here
99
profiles.imports = [
1010
inputs.self.nixosModules.common
11-
inputs.self.nixosModules.graphics
1211
inputs.self.nixosModules.development
12+
inputs.self.nixosModules.graphics
1313
./graphics.nix
1414
./debug.nix
1515
./release.nix
@@ -18,8 +18,10 @@
1818
# speciic profiles that are needed for certain classes of devices should be included below.
1919
# This can be on a category basis or integrated into an existing category if it has a common base
2020
profiles-laptop.imports = [
21+
inputs.self.nixosModules.microvm
22+
inputs.self.nixosModules.x86_64-hw-laptop
23+
inputs.self.nixosModules.disko-debug-partition
2124
./laptop-x86.nix
22-
inputs.self.nixosModules.hw-laptop
2325
];
2426
};
2527
}

modules/reference/profiles/default.nix

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2022-2025 TII (SSRC) and the Ghaf contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Ghaf Reference Profiles
5+
#
6+
{ inputs, ... }:
7+
{
8+
flake.nixosModules = {
9+
# Top level profiles
10+
reference-profile-mvp-user-trials.imports = [
11+
inputs.self.nixosModules.profiles
12+
inputs.self.nixosModules.profiles-laptop
13+
./mvp-user-trial.nix
14+
];
15+
reference-profile-mvp-user-trials-extras.imports = [
16+
inputs.self.nixosModules.reference-profile-mvp-user-trials
17+
./mvp-user-trial-extras.nix
18+
];
19+
};
20+
}

modules/reference/profiles/mvp-user-trial-extras.nix

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
22
# SPDX-License-Identifier: Apache-2.0
33
{ config, lib, ... }:
4-
let
5-
cfg = config.ghaf.reference.profiles.mvp-user-trial-extras;
6-
in
74
{
8-
imports = [ ./mvp-user-trial.nix ];
9-
10-
options.ghaf.reference.profiles.mvp-user-trial-extras = {
11-
enable = lib.mkEnableOption "Enable the mvp configuration for apps and services";
12-
};
13-
14-
config = lib.mkIf cfg.enable {
5+
config = {
156
ghaf = {
167
reference = {
17-
profiles = {
18-
mvp-user-trial.enable = true;
19-
};
20-
218
programs = {
229
windows-launcher = {
2310
enable = true;

modules/reference/profiles/mvp-user-trial.nix

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
22
# SPDX-License-Identifier: Apache-2.0
33
{ config, lib, ... }:
4-
let
5-
cfg = config.ghaf.reference.profiles.mvp-user-trial;
6-
in
74
{
85
imports = [
96
../appvms
@@ -13,11 +10,7 @@ in
1310
../desktop
1411
];
1512

16-
options.ghaf.reference.profiles.mvp-user-trial = {
17-
enable = lib.mkEnableOption "Enable the mvp configuration for apps and services";
18-
};
19-
20-
config = lib.mkIf cfg.enable {
13+
config = {
2114
ghaf = {
2215
# Enable below option for session lock feature
2316
graphics = {

0 commit comments

Comments
 (0)