Rework of x-os module / core profile

* move core settings to x-os
* add option to only install a lite core
* rename x-os module to core
* remove core profile from flake.nix
This commit is contained in:
Hendrik Sokolowski 2022-08-13 22:59:05 +02:00
parent 18e9b4a009
commit 4190818304
13 changed files with 125 additions and 94 deletions

View file

@ -118,9 +118,9 @@
users = digga.lib.rakeLeaves ./users; users = digga.lib.rakeLeaves ./users;
}; };
suites = with profiles; rec { suites = with profiles; rec {
base = [ core users.pub-solar users.root ]; base = [ users.pub-solar users.root ];
iso = base ++ [ base-user graphical pub-solar-iso ]; iso = base ++ [ base-user graphical pub-solar-iso ];
pubsolaros = [ core dram full-install base-user users.root ]; pubsolaros = [ dram full-install base-user users.root ];
anonymous = [ pubsolaros users.pub-solar ]; anonymous = [ pubsolaros users.pub-solar ];
}; };
}; };

View file

@ -1,15 +1,15 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib; with lib;
let let
cfg = config.pub-solar.x-os; cfg = config.pub-solar.core;
in in
{ {
options.pub-solar.x-os.iso-options.enable = mkOption { options.pub-solar.core.iso-options.enable = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Feature flag for iso builds"; description = "Feature flag for iso builds";
}; };
options.pub-solar.x-os.disk-encryption-active = mkOption { options.pub-solar.core.disk-encryption-active = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Whether it should be assumed that there is a cryptroot device"; description = "Whether it should be assumed that there is a cryptroot device";

30
modules/core/default.nix Normal file
View file

@ -0,0 +1,30 @@
{ lib, ... }:
with lib;
let
psCfg = config.pub-solar;
cfg = config.pub-solar.core;
in
{
imports = [
./boot.nix
./fonts.nix
./i18n.nix
./modules.nix
./networking.nix
./nix.nix
./packages.nix
./services.nix
];
options.pub-solar.core = {
lite-core-active = mkOption {
description = ''
Whether the node should run as a server or agent.
Note that the server, by default, also runs as an agent.
'';
default = false;
type = types.bool;
};
};
}

11
modules/core/modules.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.pub-solar.core;
in
{
pub-solar.terminal-life.enable = lib.mkIf (!cfg.lite-core-active) true;
pub-solar.audio.enable = lib.mkIf (!cfg.lite-core-active) true;
pub-solar.crypto.enable = lib.mkIf (!cfg.lite-core-active) true;
pub-solar.devops.enable = lib.mkIf (!cfg.lite-core-active) true;
}

View file

@ -2,10 +2,10 @@
with lib; with lib;
let cfg = config.pub-solar.x-os; let cfg = config.pub-solar.core;
in in
{ {
options.pub-solar.x-os = { options.pub-solar.core = {
binaryCaches = mkOption { binaryCaches = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];

76
modules/core/packages.nix Normal file
View file

@ -0,0 +1,76 @@
{ config, pkgs, lib, ... }:
with lib;
let
psCfg = config.pub-solar;
cfg = config.pub-solar.core;
in
{
environment = {
systemPackages = with pkgs; [
# Core unix utility packages
coreutils-full
dnsutils
inetutils
progress
pciutils
usbutils
wget
openssl
openssh
curl
htop
lsof
psmisc
file
]
++ lib.optionals (!cfg.lite-core-active) [
mtr
gitFull
git-lfs
git-bug
xdg-utils
sysfsutils
renameutils
nfs-utils
moreutils
mailutils
keyutils
input-utils
elfutils
binutils
dateutils
diffutils
findutils
exfat
# zippit
zip
unzip
# Modern modern utilities
p7zip
croc
jq
# Nix specific utilities
niv
manix
nix-index
nix-tree
nixpkgs-review
# Build broken, python2.7-PyJWT-2.0.1.drv' failed
#nixops
psos
nvd
# Fun
neofetch
];
};
}

View file

@ -1,7 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
# For rage encryption, all hosts need a ssh key pair # For rage encryption, all hosts need a ssh key pair
services.openssh = { services.openssh = {
enable = true; enable = true;

View file

@ -1,10 +0,0 @@
{ ... }: {
imports = [
./boot.nix
./fonts.nix
./i18n.nix
./networking.nix
./nix.nix
./services.nix
];
}

View file

@ -1,75 +0,0 @@
{ self, config, lib, pkgs, inputs, ... }:
let inherit (lib) fileContents;
in
{
# Sets nrdxp.cachix.org binary cache which just speeds up some builds
imports = [ ../cachix ];
config = {
pub-solar.terminal-life.enable = true;
pub-solar.audio.enable = true;
pub-solar.crypto.enable = true;
pub-solar.devops.enable = true;
environment = {
systemPackages = with pkgs; [
# Core unix utility packages
coreutils-full
progress
dnsutils
inetutils
mtr
pciutils
usbutils
gitFull
git-lfs
git-bug
wget
openssl
openssh
curl
htop
lsof
psmisc
xdg-utils
sysfsutils
renameutils
nfs-utils
moreutils
mailutils
keyutils
input-utils
elfutils
binutils
dateutils
diffutils
findutils
exfat
file
# zippit
zip
unzip
# Modern modern utilities
p7zip
croc
jq
# Nix specific utilities
niv
manix
nix-index
nix-tree
nixpkgs-review
# Build broken, python2.7-PyJWT-2.0.1.drv' failed
#nixops
psos
nvd
# Fun
neofetch
];
};
};
}

View file

@ -6,6 +6,6 @@ in
config = { config = {
pub-solar.graphical.wayland.software-renderer.enable = true; pub-solar.graphical.wayland.software-renderer.enable = true;
pub-solar.sway.terminal = "foot"; pub-solar.sway.terminal = "foot";
pub-solar.x-os.iso-options.enable = true; pub-solar.core.iso-options.enable = true;
}; };
} }