All Projects → mbbx6spp → Mbp Nixos

mbbx6spp / Mbp Nixos

Instructions and scripts related to getting NixOS running on a newer generation MBP

Labels

Projects that are alternatives of or similar to Mbp Nixos

Hydra Tutorial
Sample configuration files for setting up your own Hydra continuous integration server.
Stars: ✭ 95 (-17.39%)
Mutual labels:  nix
Powerline Rs
GitLab: https://gitlab.com/jD91mZM2/powerline-rs
Stars: ✭ 108 (-6.09%)
Mutual labels:  nix
Nix Config
My NixOS configuration
Stars: ✭ 112 (-2.61%)
Mutual labels:  nix
Styx
Static site generator in Nix expression language.
Stars: ✭ 99 (-13.91%)
Mutual labels:  nix
Nix Tree
Interactively browse the dependency graph of your Nix derivations.
Stars: ✭ 104 (-9.57%)
Mutual labels:  nix
Yarn2nix
Generate nix expressions from a yarn.lock file [maintainer=???]
Stars: ✭ 110 (-4.35%)
Mutual labels:  nix
Stack2nix
Generate nix expressions for Haskell projects
Stars: ✭ 93 (-19.13%)
Mutual labels:  nix
Nix Emacs Ci
Emacs installations for continuous integration
Stars: ✭ 114 (-0.87%)
Mutual labels:  nix
Nix Home
Utilities for working with user configurations in Nix.
Stars: ✭ 107 (-6.96%)
Mutual labels:  nix
Nix Deploy
Deploy software or an entire NixOS system configuration to another NixOS system
Stars: ✭ 111 (-3.48%)
Mutual labels:  nix
Nix Linter
Linter for the Nix expression language
Stars: ✭ 100 (-13.04%)
Mutual labels:  nix
Cached Nix Shell
Instant startup time for nix-shell
Stars: ✭ 103 (-10.43%)
Mutual labels:  nix
Nixos Config
My NixOS configuration files. (This public mirror is not updated anymore.)
Stars: ✭ 110 (-4.35%)
Mutual labels:  nix
Nixcloud Webservices
This nixpkgs extension, called nixcloud-webservices, focuses on ease of deployment of web-related technologies.
Stars: ✭ 98 (-14.78%)
Mutual labels:  nix
Flake Utils
Pure Nix flake utility functions
Stars: ✭ 113 (-1.74%)
Mutual labels:  nix
System
My system configuration
Stars: ✭ 94 (-18.26%)
Mutual labels:  nix
Nix Haskell Monorepo
Pragmatic tutorial on how to use nix with a haskell monorepo
Stars: ✭ 111 (-3.48%)
Mutual labels:  nix
Docker
Dockerfiles to package Nix in a minimal docker container
Stars: ✭ 114 (-0.87%)
Mutual labels:  nix
Iohk Ops
NixOps deployment configuration for IOHK devops
Stars: ✭ 113 (-1.74%)
Mutual labels:  nix
Nixwrt
Build images for embedded MIPS SoCs using NixPkgs (experimental)
Stars: ✭ 111 (-3.48%)
Mutual labels:  nix

== NixOS on MBP

This is a repo that will house notes and scripts related to getting NixOS running on a newer generation (late 2013+) MacBook Pro laptop (Retina).

=== Preparing Installation Media

Contrary to other reports on the internet (in the wild) you do not need to prerpare your bootable USB installer on another Linux distro.

You should be using 16.03 or 16.09 images at this point!

As of 2016-10-15 here are the latest nixos image download locations:

Download the minimal ISO from the link above.

The command I used on my NixOS box was the following, though on OSX you should be able to use /dev/disk2 or similar after unmounting the USB drive in OSX.

When preparing your USB install drive on Linux run:

[source,bash]

sudo dd bs=4M if=path/to/nixos-minimal-16.09-x86_64-linux.iso of=/dev/sdc

When preparing your USB install drive on OS X or BSD-based distributions run:

[source,bash]

sudo dd bs=4m if=path/to/nixos-minimal-16.09-x86_64-linux.iso of=/dev/disk2

=== Before Installing

You will need to resize your OSX partition. I did this by booting into the OSX Recovery partition and using the Disk Utility from there.

To boot into the Recovery partition you hold down the Cmd+R keys on boot startup until you see it enter Recovery mode.

=== Boot USB Drive

Boot from the USB drive by holding down the Option key during the boot startup tone until you see options of devices to boot from.

You will likely need to choose the second option called 'EFI Boot'.

=== Preparing Partitions in Stage2

If you are unsure on how to configure your partitions consult the man gdisk. I suggest the following basic setup (this is what I did):

[source]

$ sudo gdisk -l /dev/sda

GPT fdisk (gdisk) version 0.8.8

Partition table scan: MBR: protective BSD: not present APM: not present GPT: present

Found valid GPT with protective MBR; using GPT. Disk /dev/sda: 490234752 sectors, 233.8 GiB Logical sector size: 512 bytes Disk identifier (GUID): XXXXXXXXXXXXXXXXXXXXXXXX Partition table holds up to 128 entries First usable sector is 34, last usable sector is 490234718 Partitions will be aligned on 8-sector boundaries Total free space is 6 sectors (3.0 KiB)

Number Start (sector) End (sector) Size Code Name 1 40 409639 200.0 MiB EF00 EFI System Partition 2 409640 98957655 47.0 GiB AF05 Customer 3 XXXXXXXX XXXXXXXXX 620.0 MiB AB00 Recovery HD 4 XXXXXXXXX XXXXXXXXX 170.0 GiB 8300 nixosroot 5 XXXXXXXXX XXXXXXXXX 16.0 GiB 8200 nixosswap

I did this with the following commands after stage2 loaded in the NixOS installer:

[source,shell]

cryptsetup luksFormat /dev/sda4

cryptsetup luksOpen /dev/sda4 nixosroot

mkfs.ext4 /dev/mapper/nixosroot

mkswap -L nixosswap /dev/sda5


If you do not already have a vfat filesystem for boot images you will need to run the following command (I didn't need to do this):

[source,shell]

mkfs.vfat /dev/sda1


Now we need to mount the new or existing filesystems:


mount /dev/mapper/nixosroot /mnt

mkdir /mnt/boot

mount /dev/sda1 /mnt/boot

swapon /dev/disk/by-label/nixosswap


Make sure you mount /dev/sda1 under /mnt/boot.

After that run: nixos-generate-config --root /mnt

After this you may want to modify the configuration.nix to include gummiboot.

Then run: nixos-install

=== Configuration Post-Install

My /etc/nixos/configuration.nix for the MBP can be found at link:etc/nixos/configuration.nix[].

Some parts of note that are required for the MBP are:

==== Boot Options

Use gummiboot. I got gummiboot working straight away.

[source,nix]

{

Other stuff up here....

boot.loader.grub.enable = false; boot.loader.systemd-boot.enable = true;

Whether or not the installation process should modify EFI boot variables

boot.loader.efi.canTouchEfiVariables = true;

If you rely on a dirty /tmp dir you are doing it wrong. Your laptop will

never be cattle.

boot.cleanTmpDir = true;

This gets your audio output and input (mic) working

boot.extraModprobeConfig = '' options libata.force=noncq options resume=/dev/sda5 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 options hid_apple fnmode=2 '';

some other stuff below here

}

See the full base configuration at link:etc/nixos/configuration.nix[configuration.nix].

==== Tidbit: Audio

If you use xmonad and you want to attach your Fn keys to the appropriate audio behaviors you are accustomed to on OSX/Darwin then you can link:https://github.com/mbbx6spp/.home/blob/lookie/dotfiles/xmonad/xmonad.hs#L110-131[take a look at my xmonad.hs file].

For those just interested in the raw commands here they are below:

[source,shell]

$ amixer -q set Master toggle # mute/unmute $ amixer -q set Master 5%- # decrease volume by 5% $ amixer -q set Master 5%+ # increase volume by 5%

==== Tidbit: Brightness / Visual Tempurature

Some of you may be familiar with OSX apps that changes your brightness and screen tone based on the time of day.

On Linux the best one I could find was redshift which is configurable in NixOS via the link:https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/x11/redshift.nix[builtin module].

Here is an excerpt from my latest /etc/nixos/configuration.nix file for redshift configs:

[source,javascript]

services.redshift.enable = true; services.redshift.brightness.day = "0.8"; services.redshift.brightness.night = "0.4"; services.redshift.latitude = "0.0000"; services.redshift.longitude = "0.0000";

For the raw commands to use to increase or decrease brightness see below:

[source,shell]

$ cat /sys/class/backlight/acpi_video0/brightness # echos current brightness level 10 $ cat /sys/class/backlight/acpi_video0/max_brightness # echos max brightness level 100 $ echo 25 | sudo tee /sys/class/backlight/acpi_video0/brightness # sets brightness to 25/100 $ cat /sys/class/backlight/acpi_video0/brightness 25

HTH!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].