dotfiles/nixos/systems/liveusb/default.nix
magic_rb 88722d14eb
Update non-core inputs
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-06-02 21:29:31 +02:00

95 lines
2.4 KiB
Nix

# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
inputs,
lib',
config,
...
}: let
inherit
(lib')
flip
mapAttrs
singleton
;
config' = config;
in {
flake.nixosConfigurations.liveusb = inputs.nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
lib = lib';
specialArgs = {
config' = config';
inputs' = inputs;
secret = lib'.loadSecrets inputs.secrets;
};
modules =
singleton
({
pkgs,
config,
...
}: {
imports = [
"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix"
./nixpkgs.nix
];
environment.systemPackages = [
(pkgs.writeShellScriptBin "test-s0ix" ''
_cpu_residency="/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us"
_system_residency="/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us"
echo '> '"$_system_residency before"
_residency_before=$(cat "$_system_residency")
echo "$_residency_before"
echo "Suspending to RAM and resuming in 30 seconds..."
rtcwake -u -s 30 -m mem -n && systemctl suspend
echo '> '"$_system_residency after"
_residency_after=$(cat "$_system_residency")
echo "$_residency_after"
if [ $_residency_before -lt $_residency_after ] ; then
echo "Suspend successful"
elso
echo "Suspend unsuccessful"
fi
${lib'.getExe pkgs.smartmontools} -a $(echo /dev/nvme?n? | tr ' ' '\n' | head -n 1)
'')
];
isoImage.edition = "xfce";
services.xserver.videoDrivers = ["nvidia"];
boot.supportedFilesystems = singleton "zfs";
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_1;
boot.kernelParams = [
"nvidia.NVreg_EnableS0ixPowerManagement=1"
"nvidia.NVreg_S0ixPowerManagementVideoMemoryThreshold=2048"
];
hardware.nvidia = {
powerManagement.enable = true;
package = config.boot.kernelPackages.nvidia_x11_beta;
};
services.displayManager.defaultSession = "xfce";
services.xserver = {
desktopManager = {
xterm.enable = false;
xfce.enable = true;
};
};
});
};
}