profile/core: migrate to nixosModule

This commit is contained in:
Felix Buehler 2026-01-24 22:40:40 +01:00
parent a4d422e059
commit a16d497ebb
10 changed files with 208 additions and 157 deletions

View file

@ -50,10 +50,8 @@
};
};
imports = [
../profiles/core/core.nix
../profiles/core/nix.nix
];
my.profiles.core.nix.enable = true;
my.profiles.core.packages.enable = true;
documentation = {
enable = lib.mkDefault false;

View file

@ -1,10 +1,16 @@
{ self, ... }:
let
inherit (self.inputs) nixos-generators;
defaultModule = {
imports = [ ./base-config.nix ];
inherit (self.inputs) nixos-generators sops-nix;
defaultModules = [
{
imports = [
./base-config.nix
sops-nix.nixosModules.sops
];
_module.args.inputs = self.inputs;
};
}
../profiles
];
in
{
perSystem =
@ -14,16 +20,14 @@ in
install-iso = nixos-generators.nixosGenerate {
system = "x86_64-linux";
inherit pkgs;
modules = [ defaultModule ];
modules = defaultModules;
format = "install-iso";
};
# install-sd-aarch64 = nixos-generators.nixosGenerate {
# system = "aarch64-linux";
# inherit pkgs;
# modules = [
# defaultModule
# ];
# modules = defaultModules;
# format = "sd-aarch64-installer";
# };
};
@ -35,8 +39,7 @@ in
# {
# nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# }
# defaultModule
# ];
# ] ++ defaultModules;
# };
#};
}

View file

@ -1,46 +0,0 @@
{ pkgs, ... }:
{
# Packages
environment.systemPackages = with pkgs; [
bandwhich # bandwidth monitor
bind # dns tools (dig, etc)
borgbackup # backup tool
cryptsetup # luks volume management
delta # git diff viewer
fd # find replacement in rust
file # show file type
fzf # fuzzy finder
gettext # localization tools
git # version control
gptfdisk # disk partitioning tools
htop # process monitor
jq # json processor
killall # kill processes by name
lsof # list open files
mosh # mobile shell
mtr # network diagnostic tool
multipath-tools # disk multipathing tools (kpartx)
neovim # text editor
nmap # network scanner
nmon # performance monitor
ouch # de-/compression tool
pciutils # lspci
progress # show progress of coreutils commands
pv # pipe viewer
reptyr # reparent process to new terminal
rsync # remote file sync
screen # terminal multiplexer
sd # sed replacement
stress-ng # stress testing
tmux # terminal multiplexer
unzip # unzip tools
usbutils # lsusb
vim # text editor
wget # file downloader
whois # domain lookup
xcp # rust cp replacement
zip # zip tools
];
time.timeZone = "Europe/Berlin";
}

View file

@ -1,23 +1,30 @@
{
config,
lib,
pkgs,
inputs,
...
}@args:
}:
let
cfg = config.my.profiles.core;
in
{
imports = [
./kernel-modules.nix
./network.nix
./nix.nix
./packages.nix
./users.nix
];
options.my.profiles.core.enable = lib.mkEnableOption "core profile";
config = lib.mkIf cfg.enable (
lib.mkMerge [
(import ./core.nix args)
(import ./modules.nix args)
(import ./network.nix args)
(import ./nix.nix args)
(import ./users.nix args)
]
);
config = lib.mkIf cfg.enable {
my.profiles.core = {
packages.enable = lib.mkDefault true;
kernel-modules.enable = lib.mkDefault true;
network.enable = lib.mkDefault true;
nix.enable = lib.mkDefault true;
users.enable = lib.mkDefault true;
};
time.timeZone = "Europe/Berlin";
};
}

View file

@ -0,0 +1,21 @@
{ config, lib, ... }:
let
cfg = config.my.profiles.core.kernel-modules;
in
{
options.my.profiles.core.kernel-modules.enable = lib.mkEnableOption "kernel module profile";
config = lib.mkIf cfg.enable {
boot.initrd.availableKernelModules = [
"ahci"
"e1000e"
"ehci_pci"
"nvme"
"sd_mod"
"uas"
"usbhid"
"usb_storage"
"xhci_pci"
];
};
}

View file

@ -1,15 +0,0 @@
_: {
boot.initrd = {
availableKernelModules = [
"ahci"
"e1000e"
"ehci_pci"
"nvme"
"sd_mod"
"uas"
"usbhid"
"usb_storage"
"xhci_pci"
];
};
}

View file

@ -1,4 +1,11 @@
_: {
{ config, lib, ... }:
let
cfg = config.my.profiles.core.network;
in
{
options.my.profiles.core.network.enable = lib.mkEnableOption "core network profile";
config = lib.mkIf cfg.enable {
networking.networkmanager = {
enable = true;
@ -9,4 +16,5 @@ _: {
"interface-name:virbr?" # libvirt default bridge
];
};
};
}

View file

@ -1,5 +1,17 @@
{ inputs, ... }:
{
config,
lib,
inputs,
...
}:
let
cfg = config.my.profiles.core.nix;
in
{
options.my.profiles.core.nix.enable = lib.mkEnableOption "core nix profile";
config = lib.mkIf cfg.enable {
nix = {
daemonCPUSchedPolicy = "idle";
daemonIOSchedClass = "idle";
@ -33,4 +45,5 @@
enable = true;
flake = "github:Stunkymonkey/nixos";
};
};
}

View file

@ -0,0 +1,55 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.profiles.core.packages;
in
{
options.my.profiles.core.packages.enable = lib.mkEnableOption "core packages profile";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
bandwhich # bandwidth monitor
bind # dns tools (dig, etc)
borgbackup # backup tool
cryptsetup # luks volume management
delta # git diff viewer
fd # find replacement in rust
file # show file type
fzf # fuzzy finder
gettext # localization tools
git # version control
gptfdisk # disk partitioning tools
htop # process monitor
jq # json processor
killall # kill processes by name
lsof # list open files
mosh # mobile shell
mtr # network diagnostic tool
multipath-tools # disk multipathing tools (kpartx)
neovim # text editor
nmap # network scanner
nmon # performance monitor
ouch # de-/compression tool
pciutils # lspci
progress # show progress of coreutils commands
pv # pipe viewer
reptyr # reparent process to new terminal
rsync # remote file sync
screen # terminal multiplexer
sd # sed replacement
stress-ng # stress testing
tmux # terminal multiplexer
unzip # unzip tools
usbutils # lsusb
vim # text editor
wget # file downloader
whois # domain lookup
xcp # rust cp replacement
zip # zip tools
];
};
}

View file

@ -1,5 +1,11 @@
{ config, ... }:
{ config, lib, ... }:
let
cfg = config.my.profiles.core.users;
in
{
options.my.profiles.core.users.enable = lib.mkEnableOption "core users profile";
config = lib.mkIf cfg.enable {
sops.secrets."users/felix/password".neededForUsers = true;
sops.secrets."users/felix/password" = { };
@ -32,4 +38,5 @@
users.groups.felix = {
gid = 1000;
};
};
}