Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
configuration.nix file for NixOS on my macbook pro
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
time.timeZone = "America/Chicago";
boot = {
cleanTmpDir = true;
kernelPackages = pkgs.linuxPackages_4_3;
kernelParams = [
# https://help.ubuntu.com/community/AppleKeyboard
# https://wiki.archlinux.org/index.php/Apple_Keyboard
"hid_apple.fnmode=1"
"hid_apple.iso_layout=0"
"hid_apple.swap_opt_cmd=1"
];
loader = {
# I'm on an EFI-only system (mac book pro 9.2)
gummiboot.enable = true;
gummiboot.timeout = 4;
efi.canTouchEfiVariables = true;
};
};
system.stateVersion = "16.03";
networking.hostName = "nixos";
# I use a desktop manager with NetworkManager
# networking.wireless.enable = true;
networking.networkmanager.enable = true;
i18n = {
defaultLocale = "en_US.UTF-8";
};
environment.systemPackages = with pkgs; [
ack
chromium
coreutils
cryptsetup
docker
dropbox
emacs # see below for my own definition of Emacs
ffmpeg
file
filezilla
firefoxWrapper
steam
ghostscript # to manipulate pdf files
gimp
gitAndTools.gitFull
glib # for gsettings
gnumake
gnupg
gparted
haskellPackages.pandoc
htop
inetutils
inkscape
silver-searcher
nmap
skype
vlc
subversion
wget
which
zip
];
services = {
openssh.enable = true;
#postgresql
postgresql.enable = true;
postgresql.package = pkgs.postgresql94;
# Locate will update its database everyday at lunch time
locate.enable = true;
locate.period = "00 12 * * *";
xserver = {
enable = true;
autorun = false;
synaptics = {
enable = true;
twoFingerScroll = true;
buttonsMap = [ 1 3 2 ];
tapButtons = false;
accelFactor = "0.0055";
minSpeed = "0.95";
maxSpeed = "1.15";
palmDetect = true;
};
# https://github.com/NixOS/nixpkgs/issues/4416
displayManager.desktopManagerHandlesLidAndPower = false;
# This is the way to activate some Gnome 3 modules
xkbOptions = "ctrl:nocaps"; # overriden by gnome (must be set using gnome tweak tool)
};
};
powerManagement.enable = true;
nixpkgs.config = {
allowUnfree = true;
firefox = {
enableGoogleTalkPlugin = true;
enableAdobeFlash = true;
};
};
# The wifi broadcom driver
networking.enableB43Firmware = true;
# Make sure the only way to add users/groups is to change this file
users.mutableUsers = false;
# Add myself as a super user
users.extraUsers.dmj = {
createHome = true;
home = "/home/dmj";
description = "David Johnson";
extraGroups = [ "wheel" "networkmanager" "docker" ];
useDefaultShell = true;
uid = 1000;
};
# Add fonts
fonts = {
enableFontDir = true;
enableGhostscriptFonts = true;
fonts = with pkgs; [
corefonts # Microsoft free fonts
inconsolata # monospaced
ubuntu_font_family
dejavu_fonts
];
};
# Fix problem with Emacs tramp (https://github.com/NixOS/nixpkgs/issues/3368)
programs.bash = {
promptInit = "PS1=\"# \"";
enableCompletion = true;
};
# Create a systemd user service for emacs daemon. This is useful because
# systemd will take care of launching emacs in the background and I
# will just have to connect to it through emacs-client. This is a
# user service. This means I have to pass the "--user" option to
# systemd when I want to control the service.
systemd.user.services.emacs = {
description = "Emacs: the extensible, self-documenting text editor";
serviceConfig = {
Type = "forking";
ExecStart = "${pkgs.emacs}/bin/emacs --daemon";
ExecStop = "${pkgs.emacs}/bin/emacsclient --eval (kill-emacs)";
Restart = "always";
};
# I want the emacs service to be started with the rest of the user services
wantedBy = [ "default.target" ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment