Skip to content

Instantly share code, notes, and snippets.

@aaronlevin
Created February 8, 2016 10:46
Show Gist options
  • Save aaronlevin/07069e0e140af8706a18 to your computer and use it in GitHub Desktop.
Save aaronlevin/07069e0e140af8706a18 to your computer and use it in GitHub Desktop.
My Nix configuration for my Lenovo X250
# 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, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
#allowDiscards = true;
boot.initrd.luks.devices = [
{
name = "root";
device = "/dev/sda3";
preLVM = true;
}
];
# Use the gummiboot efi boot loader.
# boot.loader.gummiboot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.memtest86.enable = true;
boot.kernelParams = [ "libata.force=noncqtrim,noncq" ];
# options snd_hda_intel enable=0,1
# options libata.force=noncq
boot.extraModprobeConfig = ''
options snd_hda_intel index=1,0
'';
boot.kernelPackages = pkgs.linuxPackages_4_3;
networking.hostName = "nixos"; # Define your hostname.
networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.extraHosts = ''
127.0.0.1 nixos
::1 nixos
'';
# this is key for Lenovo x250
powerManagement.scsiLinkPolicy = "max_performance";
# Select internationalisation properties.
# i18n = {
# consoleFont = "Lat2-Terminus16";
# consoleKeyMap = "us";
# defaultLocale = "en_US.UTF-8";
# };
# Set your time zone.
time.timeZone = "Europe/Berlin";
nixpkgs.config = {
allowUnfree = true;
firefox = {
enableGoogleTalkPlugin = true;
# enableAdobeFlash = true;
};
};
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = with pkgs; [
bind
wget
vimHugeX
rxvt_unicode
binutils
inetutils
irssi
ack
jq
sudo
gitAndTools.gitFull
firefoxWrapper
chromium
htop
gnumake
xpdf
gcc
zip
unzip
feh
emacs
pciutils
xorg.xev
update-resolv-conf
haskellPackages.xmonad
haskellPackages.xmobar
dmenu
xclip
slock
# fonts
xfontsel
xlsfonts
dejavu_fonts
];
# List services that you want to enable:
# acpid
services.acpid.enable = true;
# Fingerprint reader
# services.fprintd.enable = true;
# MySQL
services.mysql = {
enable = true;
package = pkgs.mysql;
user = "aaronlevin";
dataDir = "/home/aaronlevin/mysql/data";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
extraConfig = ''
'';
};
# Enable the X11 windowing system.
services.xserver = {
enable = true;
windowManager.xmonad.enable = true;
windowManager.xmonad.enableContribAndExtras = true;
windowManager.default = "xmonad";
desktopManager.xterm.enable = false;
desktopManager.default = "none";
synaptics = {
enable = true;
twoFingerScroll = true;
palmDetect = true; horizontalScroll = true;
};
displayManager.sessionCommands = ''
${pkgs.xlibs.xset}/bin/xset r rate 200 60
[[ -f ~/.Xresources ]] && ${pkgs.xlibs.xrdb}/bin/xrdb -merge ~/.Xresources
xrandr --output eDP1 --primary
xrandr --output DP1 --right-of eDP1
feh --bg-scale /etc/images/haskell.png
'';
exportConfiguration = true;
xkbOptions = "ctrl:swap_lalt_lctl, caps:super";
};
services.openvpn = {
enable = true;
servers = {
client = {
config = ''
REDACTED
'';
up = ''
echo nameserver $nameserver | ${pkgs.openresolv}/sbin/resolvconf -m 0 -a $dev
${pkgs.update-resolv-conf}/libexec/openvpn/update-resolv-conf
'';
down = ''
${pkgs.openresolv}/bin/resolvconf -d $dev
# REDACTED
${pkgs.update-resolv-conf}/libexec/openvpn/update-resolv-conf
'';
};
};
};
virtualisation.docker = {
enable = true;
};
security.sudo.wheelNeedsPassword = false;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.extraUsers.aaronlevin = {
isNormalUser = true;
uid = 1000;
extraGroups = ["wheel" "docker"];
};
fonts = {
enableFontDir = true;
enableGhostscriptFonts = true;
fonts = [
pkgs.corefonts
pkgs.clearlyU
pkgs.cm_unicode
pkgs.dejavu_fonts
pkgs.freefont_ttf
pkgs.terminus_font
pkgs.ttf_bitstream_vera
];
};
# The NixOS release to be compatible with for stateful data such as databases.
system.stateVersion = "15.09";
}
# 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, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "fbcon"];
# try forcing the loading of libata module.
boot.initrd.kernelModules = [ "fbcon" "libata" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/bb6a6acb-055e-4d1f-9812-13c9d183bb6c";
fsType = "ext4";
options = "rw,relatime,nobarrier,data=ordered";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/9cbf3855-bb29-4123-abd1-e08de2e39a36";
fsType = "ext2";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/73bfe4e8-b4a6-433b-b152-73fd5702fcd8"; }
];
nix.maxJobs = 4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment