add thinkrac
Some checks failed
Hydra nixosConfigurations.container-default-x86_64-linux Hydra build #24167 of nixos-config:pr618:nixosConfigurations.container-default-x86_64-linux
Hydra nixosConfigurations.not522 Hydra build #24168 of nixos-config:pr618:nixosConfigurations.not522
Hydra nixosConfigurations.thinkrac Hydra build #24170 of nixos-config:pr618:nixosConfigurations.thinkrac
Hydra nixosConfigurations.container-default-riscv64-linux Hydra build #24166 of nixos-config:pr618:nixosConfigurations.container-default-riscv64-linux
Hydra nixosConfigurations.container-default-aarch64-linux Hydra build #24165 of nixos-config:pr618:nixosConfigurations.container-default-aarch64-linux
Hydra checks.x86_64-linux.containers-default Hydra build #24164 of nixos-config:pr618:checks.x86_64-linux.containers-default
Hydra nixosConfigurations.not522-installer Hydra build #24169 of nixos-config:pr618:nixosConfigurations.not522-installer
Some checks failed
Hydra nixosConfigurations.container-default-x86_64-linux Hydra build #24167 of nixos-config:pr618:nixosConfigurations.container-default-x86_64-linux
Hydra nixosConfigurations.not522 Hydra build #24168 of nixos-config:pr618:nixosConfigurations.not522
Hydra nixosConfigurations.thinkrac Hydra build #24170 of nixos-config:pr618:nixosConfigurations.thinkrac
Hydra nixosConfigurations.container-default-riscv64-linux Hydra build #24166 of nixos-config:pr618:nixosConfigurations.container-default-riscv64-linux
Hydra nixosConfigurations.container-default-aarch64-linux Hydra build #24165 of nixos-config:pr618:nixosConfigurations.container-default-aarch64-linux
Hydra checks.x86_64-linux.containers-default Hydra build #24164 of nixos-config:pr618:checks.x86_64-linux.containers-default
Hydra nixosConfigurations.not522-installer Hydra build #24169 of nixos-config:pr618:nixosConfigurations.not522-installer
This commit is contained in:
parent
7acf08d013
commit
36c1bb934d
6 changed files with 169 additions and 2 deletions
|
@ -161,6 +161,10 @@
|
|||
config = ./machine/pc-installer;
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
thinkrac = {
|
||||
config = ./machine/thinkrac;
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
};
|
||||
containers = mapAttrs (_: container:
|
||||
mkSystem {
|
||||
|
|
|
@ -3,7 +3,19 @@
|
|||
nixos-config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
dependencies =
|
||||
[
|
||||
nixos-config.nixosConfigurations.thinkrac.config.system.build.toplevel
|
||||
nixos-config.nixosConfigurations.thinkrac.config.system.build.diskoScript
|
||||
nixos-config.nixosConfigurations.thinkrac.config.system.build.diskoScript.drvPath
|
||||
nixos-config.nixosConfigurations.thinkrac.pkgs.stdenv.drvPath
|
||||
(nixos-config.nixosConfigurations.thinkrac.pkgs.closureInfo {rootPaths = [];}).drvPath
|
||||
]
|
||||
++ map (i: i.outPath) (builtins.filter builtins.isAttrs (builtins.attrValues pureInputs));
|
||||
|
||||
closureInfo = pkgs.closureInfo {rootPaths = dependencies;};
|
||||
in {
|
||||
networking.hostName = "pc-installer";
|
||||
imports = [
|
||||
"${nixos-config}/config"
|
||||
|
@ -17,12 +29,24 @@
|
|||
configuration.imports = [
|
||||
./graphical.nix
|
||||
"${nixos-config}/config/graphical/plymouth.nix"
|
||||
{
|
||||
nix.auto-update.specialisation = "graphical";
|
||||
}
|
||||
];
|
||||
};
|
||||
specialisation.graphical-verbose = {
|
||||
configuration.imports = [
|
||||
./graphical.nix
|
||||
{
|
||||
nix.auto-update.specialisation = "graphical-verbose";
|
||||
}
|
||||
];
|
||||
};
|
||||
isInstaller = true;
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellScriptBin "install-thinkrac-unattended" ''
|
||||
set -eux
|
||||
exec ${pkgs.disko}/bin/disko-install --flake "${nixos-config}#thinkrac" --disk main "${nixos-config.nixosConfigurations.thinkrac.config.disko.devices.disk.main.device}"
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
nixos-config,
|
||||
...
|
||||
}: {
|
||||
nix.auto-update.specialisation = "graphical";
|
||||
imports = [
|
||||
"${nixos-config}/config/graphical.nix"
|
||||
];
|
||||
|
|
24
machine/thinkrac/default.nix
Normal file
24
machine/thinkrac/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
config,
|
||||
nixos-config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
networking.hostName = "thinkrac";
|
||||
imports = [
|
||||
"${nixos-config}/config"
|
||||
./disko.nix
|
||||
./hardware.nix
|
||||
"${nixos-config}/config/networkmanager.nix"
|
||||
"${nixos-config}/config/graphical.nix"
|
||||
];
|
||||
system.stateVersion = "24.11";
|
||||
specialisation.quiet = {
|
||||
configuration.imports = [
|
||||
"${nixos-config}/config/graphical/plymouth.nix"
|
||||
{
|
||||
nix.auto-update.specialisation = "quiet";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
63
machine/thinkrac/disko.nix
Normal file
63
machine/thinkrac/disko.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-id/nvme-eui.002538b931b01f46";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
priority = 1;
|
||||
name = "ESP";
|
||||
start = "1M";
|
||||
end = "1024M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = ["umask=0077"];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
end = "-24G";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = ["-f"]; # Override existing partition
|
||||
# Subvolumes must set a mountpoint in order to be mounted,
|
||||
# unless their parent is mounted
|
||||
subvolumes = {
|
||||
# Subvolume name is different from mountpoint
|
||||
"/root" = {
|
||||
mountOptions = ["compress=zstd"];
|
||||
mountpoint = "/";
|
||||
};
|
||||
# Subvolume name is the same as the mountpoint
|
||||
"/persistent" = {
|
||||
mountOptions = ["compress=zstd"];
|
||||
mountpoint = "/persistent";
|
||||
};
|
||||
# Parent is not mounted so the mountpoint must be set
|
||||
"/nix" = {
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
};
|
||||
mountpoint = "/partition-root";
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "swap";
|
||||
discardPolicy = "both";
|
||||
resumeDevice = true; # resume from hiberation from this device
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
53
machine/thinkrac/hardware.nix
Normal file
53
machine/thinkrac/hardware.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
modulesPath,
|
||||
nixos-hardware,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
nixos-hardware.nixosModules.lenovo-thinkpad-t470s
|
||||
nixos-hardware.nixosModules.common-cpu-intel
|
||||
nixos-hardware.nixosModules.common-gpu-intel
|
||||
nixos-hardware.nixosModules.common-pc-laptop-ssd
|
||||
];
|
||||
hardware.cpu.intel.updateMicrocode = true;
|
||||
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-intel"];
|
||||
boot.extraModulePackages = [];
|
||||
nix.settings.cores = 4;
|
||||
# use the lowest frequency possible, to save power
|
||||
powerManagement.cpuFreqGovernor = "powersave";
|
||||
# lm_sensors who cares
|
||||
environment.etc."sysconfig/lm_sensors".text = ''
|
||||
# Generated by sensors-detect on Tue Aug 7 10:54:09 2018
|
||||
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to
|
||||
# be loaded/unloaded.
|
||||
#
|
||||
# The format of this file is a shell script that simply defines variables:
|
||||
# HWMON_MODULES for hardware monitoring driver modules, and optionally
|
||||
# BUS_MODULES for any required bus driver module (for example for I2C or SPI).
|
||||
|
||||
HWMON_MODULES="coretemp"
|
||||
'';
|
||||
services.thermald.enable = true;
|
||||
boot.extraModprobeConfig = ''
|
||||
# enable power savings mode of snd_hda_intel
|
||||
options snd-hda-intel power_save=1 power_save_controller=y
|
||||
# enable power savings mode of igpu, enable framebuffer compression, downclock the LVDS connection
|
||||
options i915 i915_enable_rc6=7 i915_enable_fbc=1 lvds_downclock=1
|
||||
# automatically suspend USB devices
|
||||
options usbcore autosuspend=2
|
||||
# Fan control for thinkpads
|
||||
options thinkpad_acpi fan_control=1
|
||||
options zfs zfs_arc_max=4294967296
|
||||
'';
|
||||
boot.kernel.sysctl = {
|
||||
# Probably unnecessary
|
||||
"kernel.nmi_watchdog" = "0";
|
||||
"vm.laptop_mode" = "5";
|
||||
# The kernel flusher threads will periodically wake up and write `old' data out to disk. This
|
||||
# tunable expresses the interval between those wakeups, in 100'ths of a second (Default is 500).
|
||||
"vm.dirty_writeback_centisecs" = "1500";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue