Skip to content

Instantly share code, notes, and snippets.

@CrystalGamma
Created January 11, 2020 01:19
Show Gist options
  • Save CrystalGamma/e938cca081bb685c50dbcb02717f7ce8 to your computer and use it in GitHub Desktop.
Save CrystalGamma/e938cca081bb685c50dbcb02717f7ce8 to your computer and use it in GitHub Desktop.
NixOS on PBP
{ config, lib, pkgs, ... }: let do_graphical = true; in {
imports = [./hardware-configuration.nix];
nix = {
maxJobs = 2;
buildCores = 6;
buildMachines = [{
hostName="rockpro64-nixos.local";
sshUser="nixdistbuild";
sshKey="/root/.ssh/id_buildmaster";
system="aarch64-linux";
maxJobs=2;
supportedFeatures=["big-parallel"];
}];
distributedBuilds = true;
};
nixpkgs.overlays = let
ksysguard-noweb = self: super: {
plasma5 = super.plasma5.overrideScope' (self: super: {
libksysguard = super.libksysguard.override {qtwebengine = null;};
});
};
es2 = self: super: {
qt5 = super.qt5.overrideScope' (self: super: {
qtbase = super.qtbase.overrideDerivation (x: {
configureFlags= builtins.map (x: if x == "-opengl desktop" then "-opengl es2" else x) x.configureFlags;
});
});
xorg = super.xorg.overrideScope' (self: super: {
xorgserver = super.xorgserver.overrideAttrs (x: {
configureFlags = x.configureFlags ++ ["--enable-glamor-gles2"];
});
});
};
jsoncpp = self: super: {jsoncpp=super.jsoncpp.overrideDerivation (x: {patches = [(pkgs.fetchpatch {
url = "https://github.com/open-source-parsers/jsoncpp/commit/9093358efae9e5981aa60013487fc7215f040a59.patch";
sha256 = "1wiqp70sck2md14sfc0zdkblqk9750cl55ykf9d6b9vs1ifzzzq5";
})];});};
mesa-deep = self: super: {
#mesa = mesa super;
#libGL = super.libGL.override {mesa=mesa super;};
};
ffmpeg = self: super: {
ffmpeg = super.ffmpeg.overrideDerivation (x: {src = /home/user/ffmpeg.tar.xz;});
};
in [];
zramSwap.enable = true;
boot = {
tmpOnTmpfs = true;
loader.grub = {enable = false; version = 2; device = "nodev";};
loader.generic-extlinux-compatible = {enable = true;};
kernelPackages = pkgs.linuxPackagesFor (pkgs.buildLinux (pkgs//{
/*src=/home/user/linux-test.tar.xz;
version="5.4-rc8test";
modDirVersion="5.4.0-rc8-MANJARO-ARM";*/
src=/home/user/linux-5.5-rc5.tar.xz;
version="5.5-rc5pbp";
modDirVersion="5.5.0-rc5-MANJARO-ARM";
/*src=/home/user/linux-5.4.6.tar.gz;
version="5.4.6pbp";
modDirVersion="5.4.6-MANJARO-ARM";*/
autoModules=false;
defconfig="pinebook_pro_defconfig";
kernelPatches=[
{extraConfig="CRYPTO_AEGIS128_SIMD n";patch=null;name="no_aegis128_simd";}
{patch=null;name="reduced";extraConfig = ''
ARM64_SVE n
PCI_XGENE n
PCI_HISI n
AHCI_XGENE n
DRM_RADEON n
DRM_AMDGPU n
DRM_NOUVEAU n
MFD_CROS_EC n
COMMON_CLK_XGENE n
PHY_QCOM_USB_HS n
PHY_QCOM_USB_HSIC n
HISI_PMU n
LIBNVDIMM n
BLK_DEV_PMEM n
ND_BLK n
MEDIA_SUPPORT n
STAGING n
MISC_FILESYSTEMS n
NETWORK_FILESYSTEMS n
'';}
{patch=null;name="psci-cpuidle";extraConfig="ARM_PSCI_CPUIDLE n";}
];
}));
supportedFilesystems = lib.mkForce [];
initrd.supportedFilesystems = lib.mkForce [];
};
networking = {
hostName = "pbp-nixos";
networkmanager.enable = do_graphical;
};
time.timeZone = "Europe/Berlin";
console.useXkbConfig = true;
i18n = {defaultLocale = "de_DE.UTF-8";};
fonts.fonts = with pkgs;[fira latinmodern-math cm_unicode];
environment.systemPackages = with pkgs; [
gitAndTools.gitFull
] ++ (if do_graphical then [
kate kmail akregator /*digikam*/ okular akonadi
#vlc
kdeFrameworks.kirigami2
] ++ (with kdeApplications;[spectacle korganizer kmail-account-wizard]) else []);
security = {
sudo.enable = true;
pam.services=[{name="sshd";}];
};
sound = {
enable = true;
extraConfig = builtins.readFile ./asound.state;
};
powerManagement.cpuFreqGovernor = "schedutil";
hardware = {
opengl = {enable = false;/*package=(pkgs.mesa.overrideDerivation (x: {
name="mesa-19.3.1";
src = pkgs.fetchurl {url = "https://mesa.freedesktop.org/archive/mesa-19.3.1.tar.xz";sha256="0ndfpqry08s74yw4x3ydyhim6v4ywg0b4yhaazq7zaankjv1v5fd";};
patches = [<nixos/pkgs/development/libraries/mesa/opencl-install-dir.patch> ./mesa-cache-key.diff];
})).drivers;*/};
pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
};
bluetooth.enable = true;
firmware = lib.mkForce [(let src = pkgs.fetchgit {
url="https://gitlab.manjaro.org/manjaro-arm/packages/community/ap6256-firmware";
rev="a30bf312b268eab42d38fab0cc3ed3177895ff5d";
sha256="14gyb99j85xw07wrr9lilb1jz68y6r0n0b6x4ldl7d6igs988qwb";
}; in pkgs.runCommandNoCC "brcm43456-firmware" {} ''
mkdir -p $out/lib/firmware/brcm
ln -s ${src}/BCM4345C5.hcd $out/lib/firmware/
ln -s ${src}/BCM4345C5.hcd $out/lib/firmware/brcm/BCM.hcd
ln -s ${src}/BCM4345C5.hcd $out/lib/firmware/brcm/
ln -s ${src}/nvram_ap6256.txt $out/lib/firmware/
ln -s ${src}/nvram_ap6256.txt $out/lib/firmware/brcm/brcmfmac43456-sdio.radxa,rockpi4.txt
ln -s ${src}/nvram_ap6256.txt $out/lib/firmware/brcm/brcmfmac43456-sdio.pine64,pinebook-pro.txt
ln -s ${src}/fw_bcm43456c5_ag.bin $out/lib/firmware/brcm/brcmfmac43456-sdio.bin
ln -s ${src}/brcmfmac43456-sdio.clm_blob $out/lib/firmware/brcm/brcmfmac43456-sdio.clm_blob
mkdir $out/lib/firmware/rockchip
ln -s ${./dptx.bin} $out/lib/firmware/rockchip/dptx.bin
'')];
deviceTree.base = pkgs.runCommandNoCC "dtbs" {} "mkdir -p $out/rockchip;cp ${config.boot.kernelPackages.kernel}/dtbs/rockchip/rk3399-pinebook-pro.dtb $out/rockchip/rk3399-rockpro64.dtb";
sane.enable = true;
};
services = {
udisks2.enable = do_graphical;
#mingetty.serialSpeed = [1500000 115200];
btrfs.autoScrub.enable = false;
xserver = {
enable = do_graphical;
layout = "de";
xkbVariant = "neo";
videoDrivers = ["rockchip" "modesetting"];
libinput.enable = do_graphical;
displayManager.sddm.enable = do_graphical;
desktopManager = {plasma5.enable = do_graphical; /*gnome3.enable = true;*/};
exportConfiguration = true;
};
openssh = {enable = true; passwordAuthentication = false;};
avahi = {
enable = true;
ipv6 = true;
nssmdns = true;
publish = {enable = true; domain = true; addresses = true;};
};
udev.extraHwdb = ''
evdev:input:b0003v258Ap001E*
KEYBOARD_KEY_700a5=brightnessdown
KEYBOARD_KEY_700a6=brightnessup
KEYBOARD_KEY_70066=sleep
'';
};
programs = {
fish.enable = true;
seahorse.enable = false;
sway = {enable = do_graphical; extraPackages = [];};
};
users.mutableUsers = false;
users.extraUsers.user = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" ];
shell = pkgs.fish;
};
system.stateVersion = "18.09"; # Did you read the comment?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment