Compare commits

...

5 Commits

Author SHA1 Message Date
Tom Alexander
308206d1cc
Launch a terminal at boot in the live ISO. 2025-01-18 11:55:12 -05:00
Tom Alexander
8ac235cb8c
Move disabling wifi power saving to a host-specific file. 2025-01-18 11:48:53 -05:00
Tom Alexander
5170678a25
Don't garbage collect in a built ISO.
The ISO is immutable so garbage collection does not make sense.
2025-01-18 11:33:39 -05:00
Tom Alexander
19cf31b094
Move a zfs setting into the zfs role. 2025-01-18 11:14:19 -05:00
Tom Alexander
4f0024c4f9
Move some graphics bits into the graphics role. 2025-01-18 11:00:30 -05:00
10 changed files with 87 additions and 31 deletions

View File

@ -103,7 +103,7 @@
}; };
# Automatic garbage collection # Automatic garbage collection
nix.gc = { nix.gc = lib.mkIf (!config.me.buildingIso) {
# Runs nix-collect-garbage --delete-older-than 5d # Runs nix-collect-garbage --delete-older-than 5d
automatic = true; automatic = true;
randomizedDelaySec = "14m"; randomizedDelaySec = "14m";
@ -136,9 +136,6 @@
file file
usbutils # for lsusb usbutils # for lsusb
pciutils # for lspci pciutils # for lspci
mesa-demos # for glxgears TODO move to better role
vulkan-tools # for vkcube TODO move to better role
xorg.xeyes # to test which windows are using x11 TODO move to better role
ripgrep ripgrep
strace strace
ltrace ltrace
@ -175,7 +172,6 @@
"/var/lib/nixos" # Contains user information (uids/gids) "/var/lib/nixos" # Contains user information (uids/gids)
"/var/lib/systemd" # Systemd state directory for random seed, persistent timers, core dumps, persist hardware state like backlight and rfkill "/var/lib/systemd" # Systemd state directory for random seed, persistent timers, core dumps, persist hardware state like backlight and rfkill
"/var/log/journal" # Logs, alternatively set `services.journald.storage = "volatile";` to write to /run/log/journal "/var/log/journal" # Logs, alternatively set `services.journald.storage = "volatile";` to write to /run/log/journal
"/etc/zfs/zpool.cache" # Which zpools to import, the root zpool is already imported and does not need this cache file but this captures additional pools. TODO consider setting cachefile=none on main pool.
]; ];
files = [ files = [
"/etc/machine-id" # Systemd unique machine id "otherwise, the system journal may fail to list earlier boots, etc" "/etc/machine-id" # Systemd unique machine id "otherwise, the system journal may fail to list earlier boots, etc"

View File

@ -87,7 +87,8 @@
// { // {
modules = base_x86_64_linux.modules ++ [ modules = base_x86_64_linux.modules ++ [
(nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix") (nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix")
# TODO: maybe? imports = [ "${modulesPath}/profiles/image-based-appliance.nix" ]; # TODO: Figure out how to do image based appliances
# (nixpkgs + "/nixos/modules/profiles/image-based-appliance.nix")
{ {
isoImage.makeEfiBootable = true; isoImage.makeEfiBootable = true;
isoImage.makeUsbBootable = true; isoImage.makeUsbBootable = true;

View File

@ -6,6 +6,7 @@
./optimized_build.nix ./optimized_build.nix
./power_management.nix ./power_management.nix
./screen_brightness.nix ./screen_brightness.nix
./wifi.nix
]; ];
# Generate with `head -c4 /dev/urandom | od -A none -t x4` # Generate with `head -c4 /dev/urandom | od -A none -t x4`

View File

@ -0,0 +1,16 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
config = {
environment.loginShellInit = lib.mkIf (!config.me.buildingIso) ''
doas iw dev wlan0 set power_save off
'';
};
}

View File

@ -8,5 +8,36 @@
{ {
imports = [ ]; imports = [ ];
hardware.graphics.enable = true; options.me.graphicsCardType = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"amd"
"intel"
"nvidia"
]
);
default = null;
example = "amd";
description = "What graphics card type is in the computer.";
};
options.me.graphical = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install graphical programs.";
};
config = (
lib.mkMerge [
(lib.mkIf config.me.graphical {
environment.systemPackages = with pkgs; [
mesa-demos # for glxgears
vulkan-tools # for vkcube
xorg.xeyes # to test which windows are using x11
];
hardware.graphics.enable = true;
})
]
);
} }

View File

@ -16,7 +16,6 @@
lxqt.lxqt-policykit # Need a polkit agent to launch the keyboard configurator lxqt.lxqt-policykit # Need a polkit agent to launch the keyboard configurator
]; ];
# TODO: Switch sway to using seatd instead of polkit
systemd = { systemd = {
user.services.lxqt-policykit-agent = { user.services.lxqt-policykit-agent = {
description = "lxqt-policykit-agent"; description = "lxqt-policykit-agent";

View File

@ -21,26 +21,6 @@ in
{ {
imports = [ ]; imports = [ ];
options.me.graphicsCardType = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"amd"
"intel"
"nvidia"
]
);
default = null;
example = "amd";
description = "What graphics card type is in the computer.";
};
options.me.graphical = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install graphical programs.";
};
config = ( config = (
lib.mkMerge [ lib.mkMerge [
{ {

View File

@ -258,6 +258,7 @@ in
{ {
imports = [ imports = [
./graphical_session_target.nix ./graphical_session_target.nix
./iso.nix
]; ];
options.me.swayIncludes = lib.mkOption { options.me.swayIncludes = lib.mkOption {
@ -383,9 +384,8 @@ in
services.gvfs.enable = true; services.gvfs.enable = true;
# Auto-launch sway # Auto-launch sway
environment.loginShellInit = '' # Run sway as the absolute last command in the login shell init. mkBefore = 500, plain = 1000, mkAfter = 1500
# TODO: This shouldn't be shoe-horned into the sway config environment.loginShellInit = lib.mkOrder 2000 ''
doas iw dev wlan0 set power_save off
[ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ] && [ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.systemd}/bin/systemd-cat --identifier=sway sway [ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ] && [ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.systemd}/bin/systemd-cat --identifier=sway sway
''; '';
}; };

View File

@ -0,0 +1,25 @@
{
config,
lib,
pkgs,
...
}:
let
launch_terminal = pkgs.writeTextFile {
name = "launch_terminal.conf";
text = ''
exec ${pkgs.alacritty}/bin/alacritty
'';
};
in
{
imports = [ ];
config = lib.mkIf (config.me.buildingIso) {
# Launch a terminal at boot in the live ISO for when hotkeys don't work.
me.swayIncludes = [
launch_terminal
];
};
}

View File

@ -44,4 +44,11 @@ in
zfs_clone_recv zfs_clone_recv
zfs_clone_resume zfs_clone_resume
]; ];
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
hideMounts = true;
directories = [
"/etc/zfs/zpool.cache" # Which zpools to import, the root zpool is already imported and does not need this cache file but this captures additional pools.
];
};
} }