Created
October 27, 2023 23:22
-
-
Save Frontear/50cba20722a27061a683059b0a1a7b6b to your computer and use it in GitHub Desktop.
My first attempt at running NixOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Edit this configuration file to define what should be installed on | |
# your system. Help is available in the configuration.nix(5) man page | |
# and in the NixOS manual (accessible by running `nixos-help`). | |
{ config, lib, pkgs, ... }: { | |
imports = [ | |
#<nixos-hardware/dell/inspiron/14-5420> | |
# Include the results of the hardware scan. | |
./hardware-configuration.nix | |
]; | |
boot = { | |
blacklistedKernelModules = [ | |
"snd_hda_codec_hdmi" | |
]; | |
consoleLogLevel = 3; | |
extraModprobeConfig = | |
'' | |
options i915 enable_fbc=1 enable_psr=2 fastboot=1 enable_guc=3 | |
options iwlwifi uapsd_disable=0 power_save=1 power_level=3 | |
options iwlmvm power_scheme=3 | |
options snd_hda_intel power_save=1 power_save_controller=1 | |
''; | |
initrd = { | |
compressor = "lz4"; | |
compressorArgs = [ "-l" "-9" ]; | |
services.udev.rules = | |
'' | |
SUBSYSTEM=="pci", ATTR{power/control}="auto" | |
SUBSYSTEM=="scsi", ATTR{power/control}="auto" | |
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto" | |
''; | |
verbose = false; | |
}; | |
kernel.sysctl = { | |
"kernel.printk" = "3 3 3 3"; | |
"vm.swappiness" = 180; | |
"vm.watermark_boost_factor" = 0; | |
"vm.watermark_scale_factor" = 125; | |
"vm.page-cluster" = 0; | |
"kernel.nmi_watchdog" = 0; | |
"vm.dirty_writeback_centisecs" = 6000; | |
"vm.dirty_ratio" = 3; | |
"vm.dirty_background_ratio" = 1; | |
"vm.laptop_mode" = 5; | |
"vm.vfs_cache_pressure" = 50; | |
}; | |
kernelPackages = pkgs.linuxKernel.packages.linux_lqx; | |
kernelParams = [ | |
"quiet" | |
"systemd.show_status=auto" | |
"rd.udev.log_level=3" | |
"vt.global_cursor_default=0" | |
]; | |
loader = { | |
efi.canTouchEfiVariables = true; | |
systemd-boot = { | |
enable = true; | |
configurationLimit = 3; | |
}; | |
timeout = 0; | |
}; | |
}; | |
console.keyMap = "us"; | |
documentation.dev.enable = true; | |
environment = { | |
localBinInPath = true; | |
loginShellInit = "setterm -cursor on"; | |
systemPackages = with pkgs; [ | |
neovim | |
]; | |
}; | |
fileSystems = { | |
"/" = { options = [ "defaults" "commit=60" ]; }; | |
"/home" = { options = [ "defaults" "commit=60" ]; }; | |
#"/home/frontear/Documents/archive" = { | |
# device = "/dev/disk/by-uuid/b518d260-c263-4a97-afbc-a616bd3f20c7"; | |
# fsType = "btrfs"; | |
# noCheck = true; # btrfs doesn't need check | |
# options = [ "defaults" "commit=120" "compress-force=zstd:15" "discard=async" ]; | |
#}; | |
}; | |
hardware = { | |
enableAllFirmware = true; | |
bluetooth.enable = false; | |
cpu = { | |
#amd.updateMicrocode = true; | |
intel.updateMicrocode = true; | |
}; | |
sensor = { | |
hddtemp = { | |
enable = true; | |
drives = [ | |
"/dev/nvme0n1" | |
]; | |
}; | |
}; | |
wirelessRegulatoryDatabase = true; | |
}; | |
i18n.defaultLocale = "en_US.UTF-8"; | |
location.provider = "geoclue2"; | |
networking = { | |
dhcpcd.enable = false; # NetworkManager uses internal dhcp resolution | |
hostName = "frontear-net"; | |
nameservers = [ | |
"1.1.1.1" | |
"1.0.0.1" | |
"2606:4700:4700::1111" | |
"2606:4700:4700::1001" | |
]; | |
networkmanager = { | |
enable = true; | |
dns = "none"; # Disable DNS management, so networking.nameservers overrides correctly | |
wifi.powersave = true; # TODO: options iwlwifi ... required? | |
}; | |
stevenblack = { | |
enable = true; | |
block = [ "fakenews" "gambling" "porn" "social" ]; | |
}; | |
}; | |
nixpkgs.config.allowUnfree = true; | |
powerManagement = { | |
enable = true; | |
cpuFreqGovernor = "powersave"; | |
cpufreq.max = 3000000; | |
}; | |
programs = { | |
zsh.enable = true; | |
}; | |
security = { | |
#polkit.enable = true; | |
#polkit.extraConfig = ''''; | |
sudo.execWheelOnly = true; | |
}; | |
services = { | |
#auto-cpufreq.enable = true; | |
btrfs.autoScrub = { | |
enable = true; | |
fileSystems = [ | |
"/home/frontear/Documents/archive" | |
]; | |
}; | |
fwupd.enable = true; | |
geoclue2.enable = true; | |
fstrim.enable = true; | |
locate = { | |
enable = true; | |
package = pkgs.mlocate; | |
localuser = null; # mlocate does not support this | |
}; | |
pipewire = { | |
enable = true; | |
alsa.enable = true; | |
audio.enable = true; | |
jack.enable = true; | |
pulse.enable = true; | |
wireplumber.enable = true; | |
}; | |
#power-profiles-daemon.enable = true; | |
printing = { | |
enable = true; | |
cups-pdf.enable = true; | |
drivers = [ pkgs.samsung-unified-linux-driver ]; | |
}; | |
}; | |
sound.enable = true; | |
system = { | |
# Copy the NixOS configuration file and link it from the resulting system | |
# (/run/current-system/configuration.nix). This is useful in case you | |
# accidentally delete configuration.nix. | |
copySystemConfiguration = true; | |
# This value determines the NixOS release from which the default | |
# settings for stateful data, like file locations and database versions | |
# on your system were taken. It's perfectly fine and recommended to leave | |
# this value at the release version of the first install of this system. | |
# Before changing this value read the documentation for this option | |
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). | |
stateVersion = "23.11"; | |
}; | |
systemd.services = { | |
"NetworkManager-wait-online".enable = false; # 3+ seconds of boot delay because of this | |
}; | |
time = { | |
hardwareClockInLocalTime = false; | |
timeZone = "America/Toronto"; | |
}; | |
# Enable the X11 windowing system. | |
# services.xserver.enable = true; | |
# Configure keymap in X11 | |
# services.xserver.layout = "us"; | |
# services.xserver.xkbOptions = "eurosign:e,caps:escape"; | |
# Enable touchpad support (enabled default in most desktopManager). | |
# services.xserver.libinput.enable = true; | |
users = { | |
extraUsers.frontear = { | |
extraGroups = [ "networkmanager" "wheel" ]; | |
isNormalUser = true; | |
shell = pkgs.zsh; | |
packages = with pkgs; [ | |
eza | |
fastfetch | |
ranger | |
tree | |
]; | |
}; | |
}; | |
zramSwap = { | |
enable = true; | |
algorithm = "zstd"; | |
memoryPercent = 70; | |
priority = 100; | |
swapDevices = 1; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm choosing to abandon this for now because the learning curve is a lot steeper than I expected and documentation is really poor, unlike Arch Wiki. I simply do not have the time at this stage of my life to learn so much, and although the concept is very appealing, I simply cannot do anything for it now. Perhaps in the future I will reconsider it, but for now it will not be done.