-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathiso.nix
More file actions
275 lines (229 loc) · 9.58 KB
/
iso.nix
File metadata and controls
275 lines (229 loc) · 9.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
{ config, pkgs, ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix>
# Provide an initial copy of the NixOS channel so that the user
# doesn't need to run "nix-channel --update" first.
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
];
# Set the boot label to "codeclub"
isoImage.isoName = "codeclub.iso";
isoImage.volumeID = "CODECLUB";
isoImage.appendToMenuLabel = " CodeClub";
# Make the ISO smaller (xz compresses better than zstd; slower build, smaller output)
isoImage.squashfsCompression = "xz";
zramSwap = {
enable = true;
memoryPercent = 50; # Uses 50% of RAM for compressed swap
};
services.desktopManager.gnome = {
# Add Firefox and other tools useful for installation to the launcher
favoriteAppsOverride = ''
[org.gnome.shell]
favorite-apps=[ 'google-chrome.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.SystemMonitor.desktop' ]
'';
enable = true;
extraGSettingsOverrides = ''
[org.gnome.desktop.wm.preferences]
button-layout=':minimize,maximize,close'
[org.gnome.shell]
enabled-extensions=['no-overview@fthx']
[org.gnome.settings-daemon.plugins.housekeeping]
donation-reminder-enabled=false
[org.gnome.desktop.interface]
clock-show-seconds=true
'';
};
services.gnome.gnome-remote-desktop.enable = false;
services.displayManager.gdm.autoSuspend = false;
time.timeZone = "Europe/London";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_GB.UTF-8";
LC_IDENTIFICATION = "en_GB.UTF-8";
LC_MEASUREMENT = "en_GB.UTF-8";
LC_MONETARY = "en_GB.UTF-8";
LC_NAME = "en_GB.UTF-8";
LC_NUMERIC = "en_GB.UTF-8";
LC_PAPER = "en_GB.UTF-8";
LC_TELEPHONE = "en_GB.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
# Configure keymap in X11
services.xserver = {
xkb.layout = "gb";
xkb.variant = "";
};
# Configure console keymap
console.keyMap = "uk";
services.locate.enable = true;
services.printing.enable = true;
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
gnome-terminal
terminator
ghostty
zsh
nettools
wmctrl
python3
temurin-bin
prismlauncher
google-chrome
chromium
vim
git
wget
nmap
pkgs.gnome-tweaks
findutils
gnomeExtensions.no-overview
gnome-mines
gnome-mahjongg
iagno
aisleriot
];
environment.variables = {
GSK_RENDERER = "ngl";
};
# Create Chrome/Chromium policy directory and files
environment.etc."opt/chrome/policies/managed/disable-password-manager.json".text = ''
{
"PasswordManagerEnabled": false
}
'';
environment.etc."chromium/policies/managed/disable-password-manager.json".text = ''
{
"PasswordManagerEnabled": false
}
'';
# Set Firefox as the default browser
xdg.mime.defaultApplications = {
"text/html" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/about" = "firefox.desktop";
"x-scheme-handler/unknown" = "firefox.desktop";
};
programs.firefox = {
enable = true;
policies = {
PasswordManagerEnabled = false;
DontCheckDefaultBrowser = true;
DisablePrivacySegmentation = true;
NewTabPage = false;
# Set homepage
Homepage = {
URL = "https://kimptoc.github.io/CodeClubNixLiveCD/";
Locked = true; # Set to false if you want users to be able to change it
StartPage = "homepage-locked"; # Options: "homepage", "previous-session", "homepage-locked"
};
# Optional: Also disable the password prompt
Preferences = {
"signon.rememberSignons" = false;
"signon.autofillForms" = false;
"signon.generation.enabled" = false;
# Disable privacy welcome screens and notifications
"datareporting.policy.dataSubmissionPolicyBypassNotification" = true;
"browser.aboutwelcome.enabled" = false;
"browser.startup.homepage_override.mstone" = "ignore";
"browser.startup.page" = 1;
"browser.startup.homepage" = "about:home"; # Or a custom URL like "nixos.org"
"browser.shell.checkDefaultBrowser" = false;
"browser.sessionstore.resume_session_once" = false; # Don't offer to restore session
"browser.sessionstore.resume_from_crash" = false; # Don't show crash restore dialog
"browser.sessionstore.max_resumed_crashes" = 0; # Disable crash recovery entirely
"browser.startup.couldRestoreSession.count" = -1; # Hide "Restore Previous Session" button on homepage
# Disable new tab activity stream (news, sponsored content, etc.)
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.feeds.topsites" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
};
};
};
environment.gnome.excludePackages = [ pkgs.gnome-tour pkgs.gnome-initial-setup pkgs.gnome-software ];
systemd.user.services.myautostart = {
description = "myautostart";
serviceConfig.PassEnvironment = "DISPLAY";
script = ''
export MYLOG=$HOME/myautostart.log
echo "MYAUTOSTART" > $MYLOG
date >> $MYLOG
# Set GNOME workspace settings via dconf
echo "Setting dconf workspace settings..." >> $MYLOG
${pkgs.dconf}/bin/dconf write /org/gnome/mutter/dynamic-workspaces false >> $MYLOG 2>&1
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/wm/preferences/num-workspaces 1 >> $MYLOG 2>&1
# Dismiss GNOME donation dialog by marking it as already shown
${pkgs.dconf}/bin/dconf write /org/gnome/shell/donation-dialog-last-shown "'2025-01-01T00:00:00Z'" >> $MYLOG 2>&1
mkdir -p $HOME/.config/autostart >> $MYLOG
mkdir -p $HOME/.local/share/applications/ >> $MYLOG
export CHRDESK=$HOME/.local/share/applications/google-chrome.desktop
echo "[Desktop Entry]" > $CHRDESK
echo "Name=Google Chrome" >> $CHRDESK
echo "Exec=${pkgs.google-chrome}/bin/google-chrome-stable --disable-fre --no-default-browser-check --no-first-run --hide-crash-restore-bubble --password-store=basic --start-maximized https://kimptoc.github.io/CodeClubNixLiveCD/" >> $CHRDESK
echo "StartupNotify=true" >> $CHRDESK
echo "Terminal=false" >> $CHRDESK
echo "Icon=google-chrome" >> $CHRDESK
echo "Type=Application" >> $CHRDESK
cat $CHRDESK >> $MYLOG
# Chromium desktop entry override (avoid duplicate icon by using the package's desktop file name)
export CHROMIUMDESK=$HOME/.local/share/applications/chromium-browser.desktop
echo "[Desktop Entry]" > $CHROMIUMDESK
echo "Name=Chromium" >> $CHROMIUMDESK
echo "Exec=${pkgs.chromium}/bin/chromium --no-default-browser-check --no-first-run --password-store=basic --start-maximized https://kimptoc.github.io/CodeClubNixLiveCD/" >> $CHROMIUMDESK
echo "StartupNotify=true" >> $CHROMIUMDESK
echo "Terminal=false" >> $CHROMIUMDESK
echo "Icon=${pkgs.chromium}/share/icons/hicolor/256x256/apps/chromium.png" >> $CHROMIUMDESK
echo "Type=Application" >> $CHROMIUMDESK
cat $CHROMIUMDESK >> $MYLOG
# Create Firefox desktop entry for applications menu (not autostart)
export FFXDESK=$HOME/.local/share/applications/firefox.desktop
echo "[Desktop Entry]" > $FFXDESK
echo "Name=Firefox" >> $FFXDESK
echo "Exec=${pkgs.firefox}/bin/firefox https://kimptoc.github.io/CodeClubNixLiveCD/" >> $FFXDESK
echo "StartupNotify=true" >> $FFXDESK
echo "Terminal=false" >> $FFXDESK
echo "Icon=firefox" >> $FFXDESK
echo "Type=Application" >> $FFXDESK
cat $FFXDESK >> $MYLOG
# Autostart Google Chrome from inside GNOME session so DISPLAY/Wayland env is correct.
export FFXAUTO=$HOME/.config/autostart/chrome-autostart.desktop
echo "[Desktop Entry]" > $FFXAUTO
echo "Name=Chrome Autostart" >> $FFXAUTO
echo "Exec=${pkgs.google-chrome}/bin/google-chrome-stable --disable-fre --no-default-browser-check --no-first-run --hide-crash-restore-bubble --password-store=basic --start-maximized https://kimptoc.github.io/CodeClubNixLiveCD/" >> $FFXAUTO
echo "StartupNotify=true" >> $FFXAUTO
echo "Terminal=false" >> $FFXAUTO
echo "Icon=google-chrome" >> $FFXAUTO
echo "Type=Application" >> $FFXAUTO
echo "X-GNOME-Autostart-enabled=true" >> $FFXAUTO
cat $FFXAUTO >> $MYLOG
# Best-effort maximize shortly after launch - simpler approach
# Write script to file first to avoid escaping issues
export FFXSCRIPT=$HOME/.local/bin/chrome-maximize.sh
mkdir -p $HOME/.local/bin
echo '#!/bin/bash' > $FFXSCRIPT
echo 'sleep 4' >> $FFXSCRIPT
echo 'wmctrl -r google-chrome -b add,maximized_vert,maximized_horz' >> $FFXSCRIPT
chmod +x $FFXSCRIPT
export FFXMAX=$HOME/.config/autostart/firefox-maximize.desktop
echo "[Desktop Entry]" > $FFXMAX
echo "Name=Firefox Maximize" >> $FFXMAX
echo "Exec=$FFXSCRIPT" >> $FFXMAX
echo "StartupNotify=false" >> $FFXMAX
echo "Terminal=false" >> $FFXMAX
echo "Type=Application" >> $FFXMAX
echo "X-GNOME-Autostart-enabled=true" >> $FFXMAX
cat $FFXMAX >> $MYLOG
echo "MYAUTOSTART end" >> $MYLOG
date >> $MYLOG
'';
wantedBy = [ "graphical-session.target" ]; # starts after login
partOf = [ "graphical-session.target" ];
serviceConfig = {
RemainAfterExit = true;
};
};
# Firefox launch is handled by GNOME autostart desktop files created in myautostart.
}