Skip to content

Instantly share code, notes, and snippets.

@lpaulmp
Last active July 12, 2017 15:22
Show Gist options
  • Save lpaulmp/2d6601bd30be9c52f8bd7cc9ce2ec890 to your computer and use it in GitHub Desktop.
Save lpaulmp/2d6601bd30be9c52f8bd7cc9ce2ec890 to your computer and use it in GitHub Desktop.
Nixos configuration Mackbook pro 2015
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
#-----
# BOOT
# Use the systemd-boot EFI boot loader.
# Mac book pro details about hardware https://wiki.archlinux.org/index.php/Mac#MacBook_Pro
boot = {
loader ={
grub.enable = false;
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
cleanTmpDir = true;
extraModprobeConfig = ''
options resume=/dev/sda3
# Sound drivers model
options snd_hda_intel index=0 model=intel-mac-auto id=PCH
options snd_hda_intel index=1 model=intel-mac-auto id=HDMI
options snd_hda-intel model=mbp101 #set sound model
# set macos keyboard - fix back quotes
options hid_apple fnmode=1
options hid_apple iso_layout=0
options hid_apple swap_opt_cmd=1
'';
};
#-------------------
# USER CONFIGURATIONS
security.sudo = {
enable = true;
wheelNeedsPassword = true;
};
users.mutableUsers = true;
users.extraUsers.paul = {
#isNormalUser = true;
uid = 1000;
description = "Paul Montero";
extraGroups = [
"wheel"
"networkmanager"
"messagebus"
"systemd-journal"
"disk"
"audio"
"video"
"docker"
];
createHome = true;
home = "/home/paul";
useDefaultShell = true;
};
nixpkgs.config.allowUnfree = true;
nixpkgs.config.packageOverrides = pkgs: {
linux = pkgs.linuxPackages.override {
extraConfig = ''
THUNDERBOLT m
'';
};
};
# FONTS
fonts.enableFontDir = true;
fonts.enableCoreFonts = true;
fonts.enableGhostscriptFonts = true;
fonts.fonts = with pkgs; [
corefonts
dejavu_fonts
ubuntu_font_family
terminus_font
];
i18n = {
consoleKeyMap = "us";
defaultLocale = "en_US.UTF-8";
};
#---------------------
# SYSTEM CONFIGURATIONS
powerManagement.enable = true;
environment.systemPackages = with pkgs; [
# CLI tools
tcpdump
coreutils
file
inetutils
silver-searcher
nmap
acpi
vim
git
tmux
htop
atop
wget
curl
mtr
ghc
firefox
pciutils
tor
google-chrome
];
time.timeZone = "America/Guayaquil";
virtualisation.docker.enable = false;
programs.light.enable = true;
programs.bash = {
#promptInit ="PS1=\"# \"";
enableCompletion = true;
promptInit = ''
if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then
let $UID
PS1="\[\033[00;31m\]\u@\[\033[01;35m\]\h\[\033[01;35m\]:\[\033[00;34m\][\W\[\033[00;32m\]$(__git_ps1 "(%s)")\[\033[00;34m\]]\[\033[00;32m\]§\[\033[00m\] ";
if test "$TERM" = "xterm"; then
PS1="\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "
fi
fi
'';
};
#---------
#NETWORKING
networking.hostName = "nixos.pulm.xyz"; # Define your hostname.
networking.firewall.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
#--------------
#SYSTEM SERVICES
services.locate.enable = true;
services.tlp.enable = true;
services.xserver = {
enable = true;
enableTCP = false;
layout = "us";
videoDrivers = [ "intel" ];
xkbVariant = "mac";
xkbOptions = "ctrl:nocaps";
xrandrHeads = [ "HDMI-0" "eDP" ];
resolutions = [
{ x = "3840"; y = "2160"; }
{ x = "2880"; y = "1800"; }
{ x = "1920"; y = "1080"; }
];
multitouch.enable = true;
multitouch.invertScroll = true;
displayManager.gdm.enable = true;
desktopManager = {
gnome3.enable = true;
#default = "gnome3";
};
};
services.openssh.enable = true;
services.printing.enable = true;
# The NixOS release to be compatible with for stateful data such as databases.
nix.useSandbox = true;
system.autoUpgrade.enable = true;
system.autoUpgrade.channel = https://nixos.org/channels/nixos-17.03;
nix.binaryCaches =
[
https://cache.nixos.org
];
system.stateVersion = "17.03";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment