Created
June 30, 2018 08:52
-
-
Save chrisvest/473e8b97932ae51e0f8e9f8754ba83e3 to your computer and use it in GitHub Desktop.
NixOS configuration for Lenovo P52s laptop
This file contains 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, pkgs, ... }: | |
{ | |
imports = | |
[ # Include the results of the hardware scan. | |
./hardware-configuration.nix | |
./lenovo-p52s.nix | |
]; | |
# Use the systemd-boot EFI boot loader. | |
boot.loader.systemd-boot.enable = true; | |
boot.loader.efi.canTouchEfiVariables = true; | |
# Network configuration. | |
networking.hostName = "nixos"; # Define your hostname. | |
# Select internationalisation properties. | |
i18n = { | |
consoleKeyMap = "us"; | |
defaultLocale = "en_US.UTF-8"; | |
}; | |
# Set your time zone. | |
time.timeZone = "Europe/Copenhagen"; | |
# List packages installed in system profile. To search, run: | |
# $ nix search wget | |
environment.systemPackages = with pkgs; [ | |
wget vim sudo curl glxinfo exfat dbus | |
git rustup chromium maven visualvm | |
(jetbrains.idea-community.override { jdk = pkgs.jetbrains.jdk; }) | |
firefox vlc | |
]; | |
# Some programs need SUID wrappers, can be configured further or are | |
# started in user sessions. | |
programs.bash.enableCompletion = true; | |
programs.mtr.enable = true; | |
programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; | |
#programs.java.enable = true; | |
#programs.java.package = pkgs.openjdk8; | |
programs.vim.defaultEditor = true; | |
# List services that you want to enable: | |
# Enable the OpenSSH daemon. | |
# services.openssh.enable = true; | |
# Open ports in the firewall. | |
# networking.firewall.allowedTCPPorts = [ ... ]; | |
# networking.firewall.allowedUDPPorts = [ ... ]; | |
# Or disable the firewall altogether. | |
networking.firewall.enable = false; | |
# Modifications to the user shell. | |
programs.bash.promptInit = '' | |
__git_ps1() { | |
# Define prototype for git prompt function. It's redefined later. | |
false | |
} | |
# Provide a nice prompt if the terminal supports it. | |
if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then | |
PROMPT_COLOR="1;31m" | |
let $UID && PROMPT_COLOR="1;32m" | |
PS1="\[\033[$PROMPT_COLOR\][\u@\h:\w\$(__git_ps1)]\\$\[\033[0m\] " | |
if test "$TERM" = "xterm"; then | |
PS1="\[\033]2;\h:\u:\w\007\]$PS1" | |
fi | |
fi | |
''; | |
# Enable the X11 windowing system. | |
services.xserver = { | |
displayManager.slim = { | |
enable = true; | |
defaultUser = "chris"; | |
autoLogin = true; | |
}; | |
}; | |
nixpkgs.config.allowUnfree = true; # The nvidia drivers are not free software. | |
# Define a user account. Don't forget to set a password with ‘passwd’. | |
users.extraUsers.chris = { | |
isNormalUser = true; | |
uid = 1000; | |
extraGroups = [ "wheel" "networkmanager" "audio" ]; | |
}; | |
# This value determines the NixOS release with which your system is to be | |
# compatible, in order to avoid breaking some software such as database | |
# servers. You should change this only after NixOS release notes say you | |
# should. | |
system.stateVersion = "18.03"; # Did you read the comment? | |
} |
This file contains 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
# This file contains generic configurations suitable for a Gnome3 environment | |
# on a Lenovo P52s laptop. | |
{ config, pkgs, ... }: | |
{ | |
# Upgrade to the most recent libinput, for the improved hysteresis code. | |
# Check the Releases list on | |
# https://www.freedesktop.org/wiki/Software/libinput/ | |
# to ensure that you have the latest version. | |
nixpkgs.config.packageOverrides = pkgs: { | |
libinput = pkgs.libinput.overrideAttrs (oldAttrs: rec { | |
name = "libinput-${version}"; | |
version = "1.11.1"; | |
src = pkgs.fetchurl { | |
url = "https://www.freedesktop.org/software/libinput/${name}.tar.xz"; | |
sha256 = "1z7i8vk0i61npkdqwsk85wp9v4yjlvylqnyydikjqnbsrjp9abk4"; | |
}; | |
}); | |
}; | |
i18n = { | |
# The P52s comes with either a 1080p screen (standard) or a 4K screen. | |
# On the 4K screen, the default console font is too small, so we add the | |
# `terminus_font` package to the available console fonts, and set the | |
# large "ter-132b" (the `b` means bold) font as the default. | |
# This overrides the default "Lat2-Terminus16" console font. | |
consolePackages = [ pkgs.kbdKeymaps.dvp pkgs.kbdKeymaps.neo pkgs.terminus_font ]; | |
consoleFont = "ter-132b"; | |
}; | |
# Enable the large console font as early as possible. | |
boot.earlyVconsoleSetup = true; | |
# These packages pull in a basic Gnome3 desktop environment. | |
environment.systemPackages = with pkgs.gnome3; [ | |
gnome-session gnome-shell nautilus gnome-disk-utility gnome-power-manager | |
]; | |
# Enable sound. | |
sound.enable = true; | |
hardware.pulseaudio = { | |
enable = true; | |
systemWide = true; | |
package = pkgs.pulseaudioFull; | |
}; | |
# Enable OpenGL | |
hardware.opengl.enable = true; | |
services = { | |
# Enable the thermal management daemon to keep the laptop cool. | |
thermald.enable = true; | |
# On a single user system like a laptop, there is no reason to restrict | |
# the per-user-session resource usage. | |
logind.extraConfig = '' | |
UserTasksMax=infinity | |
''; | |
# Enable CUPS to print documents. | |
printing.enable = true; | |
xserver = { | |
# Enable the X.org window system, and basic configurations. | |
enable = true; | |
layout = "us"; | |
xkbOptions = "eurosign:e"; | |
# The nVidia driver currently segfaults X.org. | |
videoDrivers = [ "intel" ]; | |
# This reduces image tearing on the Intel embedded graphics. | |
deviceSection = '' | |
Option "AccelMethod" "uxa" | |
''; | |
# Enable Gnome3. | |
desktopManager.gnome3 = { | |
enable = true; | |
extraGSettingsOverrides = ""; | |
}; | |
# Configure the multi-touch touchpad. | |
libinput = { | |
enable = true; | |
naturalScrolling = true; | |
tapping = false; | |
tappingDragLock = false; | |
scrollMethod = "twofinger"; | |
middleEmulation = false; | |
# Remap middle and right button touchpad areas to be left clicks. | |
# Instead rely on the physical mouse buttons for right and middle clicks. | |
buttonMapping = "1 1 1 4 5 6"; | |
}; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment