treewide: only ever set unmergable options via lib.mkDefault

Also extract documentation from raspberry-pi/2/ profile.
This commit is contained in:
Yegor Timoshenko 2017-12-24 15:13:25 +00:00
parent a74c9bdaf8
commit 3743ae21f5
No known key found for this signature in database
GPG key ID: C34BF9DCC9DF8210
6 changed files with 58 additions and 72 deletions

View file

@ -1,3 +1,5 @@
{ lib, ... }:
{ {
boot = { boot = {
initrd.kernelModules = [ "ata_piix" ]; initrd.kernelModules = [ "ata_piix" ];
@ -15,12 +17,12 @@
hardware.opengl.driSupport = false; hardware.opengl.driSupport = false;
services.xserver = { services.xserver = {
enable = true; enable = lib.mkDefault true;
defaultDepth = 24; defaultDepth = lib.mkDefault 24;
videoDriver = "intel"; videoDrivers = [ "intel" ];
autorun = true; autorun = lib.mkDefault true;
synaptics = { synaptics = {
enable = true; enable = lib.mkDefault true;
dev = "/dev/input/event8"; dev = "/dev/input/event8";
}; };
}; };

View file

@ -1,9 +1,8 @@
{ config, pkgs, ... }: { lib, ... }:
{ {
hardware.cpu.intel.updateMicrocode = true; hardware.cpu.intel.updateMicrocode = lib.mkDefault true;
# see https://github.com/NixOS/nixpkgs/issues/18356 # https://github.com/NixOS/nixpkgs/issues/18356
# found buggy driver with method https://wiki.ubuntu.com/DebuggingKernelSuspend
boot.blacklistedKernelModules = [ "nouveau" ]; boot.blacklistedKernelModules = [ "nouveau" ];
} }

View file

@ -1,8 +1,8 @@
{ ... }: { lib, ... }:
{ {
# to use the type cover in the initrd # to use the type cover in the initrd
boot.kernelModules = [ "hid-microsoft" ]; boot.kernelModules = [ "hid-microsoft" ];
networking.wireless.enable = true; networking.wireless.enable = lib.mkDefault true;
} }

19
raspberry-pi/2/README.txt Normal file
View file

@ -0,0 +1,19 @@
imported from https://nixos.org/wiki/Raspberry_Pi_2 **
# Status
The code in master as of June 2015 should be able to prepare a bootable NixOS for Raspberry PI 2.
There are still some drawbacks:
NixOS does not provide a /boot/config.txt (the FAT32 partition).
Making NixOS work in the Raspberry PI 2 is mainly the result of the recent work of ambro718, Dezgeg and viric (#nixos@irc.freenode.net).
# Download
If you want to test, you can flash this 4GB SD image (DOS partition table + fat32 + ext4 rootfs):
magnet:?xt=urn:btih:0def3f6acb3bceddb22cb24098f58e40e2853ec2&dn=rpi2-nixos-4b09501f2-img.xz&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80
Then you should be able to nixos-rebuild any configuration.nix changes.
The image is the result of a "nixos-install" alone. No root password has been set, and it does not include a nixpkgs checkout or channel.
In fact I (viric) created the FS into a NBD, not a real SD, to create this image.

View file

@ -1,64 +1,32 @@
/** imported from https://nixos.org/wiki/Raspberry_Pi_2 ** { lib, pkgs, ...}:
# Status
The code in master as of June 2015 should be able to prepare a bootable NixOS for Raspberry PI 2.
There are still some drawbacks:
NixOS does not provide a /boot/config.txt (the FAT32 partition).
Making NixOS work in the Raspberry PI 2 is mainly the result of the recent work of ambro718, Dezgeg and viric (#nixos@irc.freenode.net).
# Download
If you want to test, you can flash this 4GB SD image (DOS partition table + fat32 + ext4 rootfs):
magnet:?xt=urn:btih:0def3f6acb3bceddb22cb24098f58e40e2853ec2&dn=rpi2-nixos-4b09501f2-img.xz&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80
Then you should be able to nixos-rebuild any configuration.nix changes.
The image is the result of a "nixos-install" alone. No root password has been set, and it does not include a nixpkgs checkout or channel.
In fact I (viric) created the FS into a NBD, not a real SD, to create this image.
*/
{ pkgs, config, lib, ...}:
{ {
boot.consoleLogLevel = 7; boot = {
boot.loader.grub.enable = false; consoleLogLevel = lib.mkDefault 7;
boot.loader.generationsDir.enable = false; extraTTYs = [ "ttyAMA0" ];
boot.loader.raspberryPi.enable = true; kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi;
boot.loader.raspberryPi.version = 2; kernelParams = [
boot.extraTTYs = [ "ttyAMA0" ];
boot.kernelPackages = pkgs.linuxPackages_rpi;
boot.kernelParams = [
#"coherent_pool=6M"
#"smsc95xx.turbo_mode=N"
"dwc_otg.lpm_enable=0" "dwc_otg.lpm_enable=0"
"console=ttyAMA0,115200" "console=ttyAMA0,115200"
"rootwait" "rootwait"
#"console=tty1"
"elevator=deadline" "elevator=deadline"
]; ];
loader = {
# cpufrequtils doesn't build on ARM grub.enable = lib.mkDefault false;
powerManagement.enable = false; generationsDir.enable = lib.mkDefault false;
raspberryPi = {
services.xserver.enable = false; enable = lib.mkDefault true;
services.openssh.enable = true; version = lib.mkDefault 2;
};
services.nixosManual.enable = false; };
nixpkgs.config = {
# Since https://github.com/NixOS/nixpkgs/commit/f0b634c7e838cdd65ac6f73933c99af3f38d0fa8
nixpkgs.config.platform = lib.systems.platforms.raspberrypi2;
# Earlier than that, use this:
# platform = pkgs.platforms.raspberrypi2;
# Also be aware of this issue if you're encountering infinite recursion:
# https://github.com/NixOS/nixpkgs/issues/24170
allowUnfree = true;
}; };
nix.buildCores = 4; nix.buildCores = 4;
nix.binaryCaches = [ ];
nixpkgs.config.platform = lib.systems.platforms.raspberrypi2;
# cpufrequtils doesn't build on ARM
powerManagement.enable = lib.mkDefault false;
services.openssh.enable = lib.mkDefault true;
} }

View file

@ -1,9 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ ipmitool ];
ipmitool
];
boot.kernelModules = [ "jc42" "ipmi_devintf" "ipmi_si" "tpm_rng" ]; boot.kernelModules = [ "jc42" "ipmi_devintf" "ipmi_si" "tpm_rng" ];