Skip to content

Commit 57e6fe0

Browse files
mbssrcbrianmcgillion
authored andcommitted
refactor(about): remove server and add autostart
Move ghaf-intro into a self-contained file. Serve the webpage statically, no server needed. Also, add one-time autostart after cosmic setup. Signed-off-by: Manuel Bluhm <manuel@ssrc.tii.ae>
1 parent 110f22f commit 57e6fe0

File tree

6 files changed

+79
-75
lines changed

6 files changed

+79
-75
lines changed

modules/reference/appvms/google-chrome.nix

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,6 @@
8484
};
8585
storagevm.maximumSize = 100 * 1024; # 100 GB space for google-chrome-vm
8686
};
87-
88-
}
89-
];
90-
}
91-
]
92-
++ [
93-
{
94-
name = "Getting Started";
95-
description = "Introduction to your Ghaf secure system";
96-
packages = [
97-
pkgs.google-chrome
98-
chromeWrapper
99-
];
100-
icon = "security-high";
101-
command = "chrome-wrapper --incognito --start-maximized --app=http://127.0.0.1:8080";
102-
extraModules = [
103-
{
104-
imports = [ ../services/ghaf-intro/ghaf-intro.nix ];
105-
ghaf.reference.services.ghaf-intro.enable = true;
10687
}
10788
];
10889
}

modules/reference/desktop/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
{
44
imports = [
55
./applications.nix
6+
./ghaf-intro.nix
67
];
78
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# SPDX-FileCopyrightText: 2022-2026 TII (SSRC) and the Ghaf contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Ghaf Introduction - Getting Started guide
5+
#
6+
{
7+
config,
8+
lib,
9+
pkgs,
10+
...
11+
}:
12+
let
13+
cfg = config.ghaf.reference.desktop.ghaf-intro;
14+
15+
introWrapper = pkgs.writeShellApplication {
16+
name = "ghaf-intro-wrapper";
17+
runtimeInputs = [
18+
pkgs.google-chrome
19+
pkgs.ghaf-intro
20+
];
21+
text = ''
22+
${lib.getExe pkgs.google-chrome} \
23+
--disable-gpu --enable-features=UseOzonePlatform --ozone-platform=wayland \
24+
--incognito --start-maximized \
25+
--app=file://${pkgs.ghaf-intro}/index.html
26+
'';
27+
};
28+
29+
introCommand = "${pkgs.givc-cli}/bin/givc-cli ${config.ghaf.givc.cliArgs} start app --vm chrome-vm ghaf-intro";
30+
in
31+
{
32+
options.ghaf.reference.desktop.ghaf-intro = {
33+
enable = lib.mkEnableOption "Ghaf introduction guide";
34+
};
35+
36+
config = lib.mkIf cfg.enable {
37+
38+
assertions = [
39+
{
40+
assertion =
41+
(lib.hasAttr "chrome" config.ghaf.virtualization.microvm.appvm.vms)
42+
&& config.ghaf.virtualization.microvm.appvm.vms.chrome.enable;
43+
message = "Ghaf Introduction requires the Chrome AppVM to be enabled.";
44+
}
45+
];
46+
47+
ghaf.virtualization.microvm.appvm.vms.chrome.applications = [
48+
{
49+
name = "Getting Started";
50+
description = "Introduction to your Ghaf secure system";
51+
icon = "security-high";
52+
packages = [ introWrapper ];
53+
command = "ghaf-intro-wrapper";
54+
givcName = "ghaf-intro";
55+
}
56+
];
57+
58+
ghaf.virtualization.microvm.guivm.extraModules = [
59+
{
60+
# First-boot autostart trigger after COSMIC initial setup
61+
systemd.user.paths.ghaf-intro-autostart = {
62+
description = "Watch for COSMIC initial setup completion";
63+
wantedBy = [ "ghaf-session.target" ];
64+
pathConfig.PathModified = "%h/.config/cosmic-initial-setup-done";
65+
};
66+
systemd.user.services.ghaf-intro-autostart = {
67+
description = "Ghaf Introduction first-boot launcher";
68+
serviceConfig = {
69+
Type = "oneshot";
70+
ExecStart = introCommand;
71+
};
72+
};
73+
}
74+
];
75+
76+
};
77+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ in
8787
};
8888

8989
desktop.applications.enable = true;
90+
desktop.ghaf-intro.enable = true;
9091
};
9192

9293
profiles = {

modules/reference/services/default.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ in
2424
./chromecast/chromecast-config.nix
2525
./nw-packet-forwarder/nw-packet-forwarder.nix
2626
./wireguard-gui/wireguard-gui-config.nix
27-
./ghaf-intro/ghaf-intro.nix
2827
];
2928
options.ghaf.reference.services = {
3029
enable = mkEnableOption "Ghaf reference services";

modules/reference/services/ghaf-intro/ghaf-intro.nix

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)