Modularized boot process
This commit is contained in:
1 parent
f40ae42933
commit
d8cf72a4c3
8 files changed
+208
-71
No files matched your search
@@ -0,0 +1,48 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.base;
|
||||
in {
|
||||
options.modules.base = {
|
||||
enable = mkEnableOption "base";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Add base linux utilities
|
||||
git
|
||||
wget
|
||||
curl
|
||||
dig
|
||||
nix-tree
|
||||
];
|
||||
|
||||
modules = {
|
||||
# Enable base modules
|
||||
clean-tmp.enable = true;
|
||||
fontconfig.enable = true;
|
||||
neovim.enable = true;
|
||||
systemd-boot.enable = true;
|
||||
tuigreet.enable = true;
|
||||
tailscale.enable = true;
|
||||
};
|
||||
|
||||
# TODO: Remove everything below, it is here out of convenience and should be elsewhere
|
||||
programs.dconf.enable = true;
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
|
||||
extraPortals = with pkgs; [
|
||||
xdg-desktop-portal-gtk
|
||||
xdg-desktop-portal-wlr
|
||||
];
|
||||
};
|
||||
services.libinput.enable = true;
|
||||
modules.unfree.enable = true;
|
||||
modules.unfree.allowedPackages = [
|
||||
"nvidia-x11"
|
||||
"nvidia-settings"
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.clean-tmp;
|
||||
in {
|
||||
options.modules.clean-tmp = {
|
||||
enable = mkEnableOption "clean-tmp";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.silent-boot;
|
||||
in {
|
||||
options.modules.silent-boot = {
|
||||
enable = mkEnableOption "silent-boot";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
boot = {
|
||||
loader.timeout = 0;
|
||||
};
|
||||
|
||||
consoleLogLevel = 0;
|
||||
initrd.verbose = false;
|
||||
initrd.checkJournalingFS = false;
|
||||
|
||||
kernelParams = [
|
||||
"quiet"
|
||||
"boot.shell_on_fail"
|
||||
"loglevel=3"
|
||||
"rd.systemd.show_status=false"
|
||||
"rd.udev.log_level=3"
|
||||
"udev.log_priority=3"
|
||||
"video=efifb:nobgrt"
|
||||
"bgrt_disable"
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.systemd-boot;
|
||||
in {
|
||||
options.modules.systemd-boot = {
|
||||
enable = mkEnableOption "systemd-boot";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
boot.loader = {
|
||||
systemd-boot.enable = true;
|
||||
systemd-boot.editor = false;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
+6
-8
@@ -3,7 +3,13 @@
|
||||
with lib; {
|
||||
imports = [
|
||||
# Import modules
|
||||
./base/default.nix
|
||||
./boot/clean-tmp.nix
|
||||
./boot/silent-boot.nix
|
||||
./boot/systemd-boot.nix
|
||||
./brightnessctl/default.nix
|
||||
./fontconfig/default.nix
|
||||
./graphics/default.nix
|
||||
./greeter/greetd/default.nix
|
||||
./greeter/greetd/tuigreet.nix
|
||||
./locale/default.nix
|
||||
@@ -14,12 +20,4 @@ with lib; {
|
||||
./vpn/tailscale.nix
|
||||
./wifi/wpa_supplicant.nix
|
||||
];
|
||||
|
||||
config.modules = {
|
||||
# Enable default modules
|
||||
fontconfig.enable = mkDefault true;
|
||||
neovim.enable = mkDefault true;
|
||||
tuigreet.enable = mkDefault true;
|
||||
tailscale.enable = mkDefault true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
# TODO: Modularize further, especially modesetting should be its own module.
|
||||
# Set up graphics
|
||||
hardware.graphics.enable32Bit = true;
|
||||
hardware.graphics.enable = true;
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = false;
|
||||
powerManagement.finegrained = false;
|
||||
open = false;
|
||||
nvidiaSettings = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
prime = {
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
offload = {
|
||||
enable = true;
|
||||
enableOffloadCmd = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user