Skip to content

Commit 65af7bf

Browse files
minimal profile: start defining a minimal profile
Signed-off-by: Brian McGillion <bmg.avoin@gmail.com>
1 parent 9997d21 commit 65af7bf

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

modules/profiles/debug.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ in
1717
};
1818

1919
config = lib.mkIf cfg.enable {
20+
# Enable minimal profile as base
21+
ghaf.profiles.minimal.enable = true;
22+
2023
# Enable default accounts and passwords
2124
ghaf = {
2225
# Enable development on target

modules/profiles/flake-module.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
./graphics.nix
1414
./debug.nix
1515
./release.nix
16+
./minimal.nix
1617
./host-hardening.nix
1718
# NOTE: kernel-hardening is NOT included here because it requires specific kernel
1819
# hardening options that don't exist in all configurations. Import it explicitly

modules/profiles/minimal.nix

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# SPDX-FileCopyrightText: 2022-2026 TII (SSRC) and the Ghaf contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
{
5+
config,
6+
lib,
7+
pkgs,
8+
...
9+
}:
10+
let
11+
cfg = config.ghaf.profiles.minimal;
12+
inherit (lib)
13+
mkEnableOption
14+
mkIf
15+
mkDefault
16+
;
17+
in
18+
{
19+
options.ghaf.profiles.minimal = {
20+
enable = (mkEnableOption "minimal profile") // {
21+
default = false;
22+
};
23+
};
24+
25+
config = mkIf cfg.enable {
26+
# Minimal profile provides the base configuration that all other profiles build upon
27+
# This profile should contain only the essential settings needed for a basic Ghaf system
28+
# As the upstream changes such as bashless, minimal and other optimizations are too drastic
29+
# we will manually add the ones here that are deemed safe and useful for all profiles.
30+
31+
documentation = {
32+
enable = mkDefault false;
33+
doc.enable = mkDefault false;
34+
info.enable = mkDefault false;
35+
man.enable = mkDefault false;
36+
man.man-db.enable = mkDefault false;
37+
nixos.enable = mkDefault false;
38+
};
39+
40+
environment = {
41+
# Perl is a default package.
42+
# TODO: reenable the below, once we sync with the test teams-for-linux
43+
#defaultPackages = mkForce [ ];
44+
#corePackages = mkForce [ ];
45+
#stub-ld.enable = mkDefault false;
46+
};
47+
48+
programs = {
49+
command-not-found.enable = mkDefault false;
50+
fish.generateCompletions = mkDefault false;
51+
# The lessopen package pulls in Perl.
52+
less.lessopen = mkDefault null;
53+
};
54+
55+
# Disable automatic config generation
56+
system.tools.nixos-generate-config.enable = mkDefault false;
57+
58+
boot = {
59+
loader.grub.enable = mkDefault false;
60+
# This pulls in nixos-containers which depends on Perl.
61+
enableContainers = mkDefault false;
62+
};
63+
64+
# Provide a minimal set of system packages
65+
environment.systemPackages = [
66+
# TODO: will need to define the base set of packages
67+
#pkgs.busybox
68+
pkgs.openssh
69+
];
70+
71+
# The system cannot be rebuilt, these should be enabled
72+
# especially when making the storeDiskImages
73+
# TODO: enable this for storeDiskImages only
74+
#nix.enable = mkDefault false;
75+
#system.switch.enable = mkDefault false;
76+
77+
ghaf = {
78+
# Add minimal base configuration here
79+
# Currently empty - will be populated as we move common settings from debug/release
80+
};
81+
};
82+
}

modules/profiles/release.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ in
1414
};
1515

1616
config = mkIf cfg.enable {
17+
# Enable minimal profile as base
18+
ghaf.profiles.minimal.enable = true;
19+
1720
# Enable default accounts and passwords
1821
# TODO this needs to be refined when we define a policy for the
1922
# processes and the UID/groups that should be enabled by default

0 commit comments

Comments
 (0)