Browse Source

chore: organize configuration by machines

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
master
Chinmay D. Pai 4 months ago
parent
commit
6ec6d3f298
Signed by: thunderbottom GPG Key ID: 75507BE256F40CED
7 changed files with 181 additions and 9 deletions
  1. +0
    -6
      desktop/boot.nix
  2. +1
    -1
      home/chnmy/default.nix
  3. +137
    -0
      machines/bastion-zfs/configuration.nix
  4. +39
    -0
      machines/bastion-zfs/hardware-configuration.nix
  5. +0
    -0
      machines/bastion/configuration.nix
  6. +0
    -0
      machines/bastion/hardware-configuration.nix
  7. +4
    -2
      system/fonts.nix

+ 0
- 6
desktop/boot.nix View File

@ -8,10 +8,4 @@
boot.kernelParams = [ "i915.enable_fbc=1" "i915.enable_psr=2" "i915.fastboot=1" "intel_pstate=passive" "drm.vblankoffdelay=1" "msr.allow_writes=on" ];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.luks.devices.root = {
allowDiscards = true;
device = "/dev/nvme0n1p2";
preLVM = true;
};
}

+ 1
- 1
home/chnmy/default.nix View File

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
let
unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
unstable = import <nixpkgs-unstable> { config = { allowUnfree = true; }; };
in {
imports = [
./git.nix


+ 137
- 0
machines/bastion-zfs/configuration.nix View File

@ -0,0 +1,137 @@
{ config, pkgs, ... }:
{
imports = [
<nixos-hardware/lenovo/thinkpad/x1/6th-gen>
<home-manager/nixos>
./hardware-configuration.nix
./desktop/boot.nix
./desktop/gnome.nix
./hardware/sound
./hardware/video
./system
./system/fonts.nix
./virtualization/docker.nix
];
hardware.cpu.intel.updateMicrocode = true;
hardware.trackpoint.enable = true;
hardware.trackpoint.sensitivity = 180;
hardware.trackpoint.speed = 180;
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.users.chnmy = (import ./home/chnmy);
networking.hostId = "4fa14e2f";
networking.hostName = "bastion";
networking.useDHCP = false;
networking.interfaces.wlp2s0.useDHCP = true;
networking.networkmanager.wifi.backend = "iwd";
networking.wireless.iwd.enable = true;
nixpkgs.config.allowUnfree = true;
programs.adb.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
programs.less.enable = true;
services.acpid.enable = true;
services.fstrim.enable = true;
services.fwupd.enable = true;
services.logind.lidSwitch = "hybrid-sleep";
services.logind.lidSwitchDocked = "suspend";
services.openssh.enable = true;
services.openssh.passwordAuthentication = false;
services.smartd.enable = true;
services.smartd.notifications.x11.enable = true;
services.tailscale.enable = true;
services.tlp.enable = true;
services.throttled.enable = true;
services.upower.enable = true;
services.tlp.settings = {
START_CHARGE_THRESH_BAT0 = 40;
STOP_CHARGE_THRESH_BAT0 = 90;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "schedutil";
SOUND_POWER_SAVE_ON_AC = 0;
SOUND_POWER_SAVE_ON_BAT = 1;
RUNTIME_PM_ON_AC = "on";
RUNTIME_PM_ON_BAT = "auto";
NATACPI_ENABLE = 1;
TPACPI_ENABLE = 1;
TPSMAPI_ENABLE = 1;
};
services.throttled.extraConfig = ''
[GENERAL]
Enabled: True
Sysfs_Power_Path: /sys/class/power_supply/AC*/online
[BATTERY]
# Update the registers every this many seconds
Update_Rate_s: 30
# Max package power for time window #1
PL1_Tdp_W: 29
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 85
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 1
[AC]
# Update the registers every this many seconds
Update_Rate_s: 5
# Max package power for time window #1
PL1_Tdp_W: 44
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 95
# Set HWP energy performance hints to 'performance' on high load (EXPERIMENTAL)
HWP_Mode: False
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 2
[UNDERVOLT]
# CPU core voltage offset (mV)
CORE: -105
# Integrated GPU voltage offset (mV)
GPU: -85
# CPU cache voltage offset (mV)
CACHE: -105
# System Agent voltage offset (mV)
UNCORE: -85
# Analog I/O voltage offset (mV)
ANALOGIO: 0
'';
services.zfs.autoSnapshot.enable = true;
services.zfs.autoScrub.enable = true;
services.zfs.trim.enable = true;
system.autoUpgrade.enable = true;
system.copySystemConfiguration = true;
system.stateVersion = "20.09";
time.timeZone = "Asia/Kolkata";
users.mutableUsers = true;
users.users.chnmy = {
isNormalUser = true;
extraGroups = [ "audio" "docker" "disk" "input" "networkmanager" "video" "wheel" ];
shell = pkgs.bash;
};
}

+ 39
- 0
machines/bastion-zfs/hardware-configuration.nix View File

@ -0,0 +1,39 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.requestEncryptionCredentials = true;
boot.zfs.enableUnstable = true;
fileSystems."/" =
{ device = "rpool/root/nixos";
fsType = "zfs";
};
fileSystems."/home" =
{ device = "rpool/home";
fsType = "zfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/2E7D-9100";
fsType = "vfat";
};
swapDevices = [ { device = "/dev/disk/by-uuid/b4948726-d6ec-4cc8-a952-58c5090ca164"; } ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
# high-resolution display
hardware.video.hidpi.enable = lib.mkDefault true;
}

bastion.nix → machines/bastion/configuration.nix View File


hardware-configuration.nix → machines/bastion/hardware-configuration.nix View File


+ 4
- 2
system/fonts.nix View File

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
let
unstable = import <nixpkgs-unstable> { config = { allowUnfree = true; }; };
in {
fonts.enableFontDir = true;
fonts.fonts = with pkgs; [
aileron
@ -18,7 +20,7 @@
noto-fonts-cjk
noto-fonts-emoji
powerline-fonts
vistafonts
unstable.vistafonts
];
fonts.fontconfig.localConf = ''
<fontconfig>


Loading…
Cancel
Save