Skip to content

Instantly share code, notes, and snippets.

@telent
Created June 23, 2021 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save telent/9a07d02a6cd061196d94aa0692745fc6 to your computer and use it in GitHub Desktop.
Save telent/9a07d02a6cd061196d94aa0692745fc6 to your computer and use it in GitHub Desktop.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
nixpkgs.overlays = [
(self: super: {
# make-tarball is hardcoded to use pixz, but wants a host
# version not a build version
pixz = super.buildPackages.pixz;
linuxPackages = super.linuxPackages_latest.extend (lpself: lpsuper: {
kernel = super.linuxPackages_latest.kernel.override {
extraConfig = ''
STAGING y
STAGING_MEDIA y
VIDEO_MESON_VDEC m
'';
};
});
tdb = super.tdb.overrideAttrs(o: {
nativeBuildInputs = o.nativeBuildInputs ++ [ self.python3 ];
});
atk = super.atk.overrideAttrs(o: {
nativeBuildInputs = o.nativeBuildInputs ++
[ self.pkg-config self.buildPackages.stdenv.cc ];
});
gobject-introspection =
let moreCross = builtins.toFile "cross-exe-wrapper.conf" ''
[binaries]
exe_wrapper = '/nix/store/4s5s0bgp6708nnyl9zbc7fa6s8c5xh59-qemu-6.0.0/bin/qemu-aarch64'
'';
d = super.gobject-introspection.overrideAttrs(o: {
mesonFlags = [ "-Dcairo=disabled"
"-Ddoctool=disabled"
"--cross-file=${moreCross}" ];
nativeBuildInputs = o.nativeBuildInputs ++
[ self.buildPackages.stdenv.cc ];
});
in d.override {
x11Support = false;
# python38 fails on aarch64, "No module named 'giscanner._giscanner'"
python3 = self.python37;
};
harfbuzz = (super.harfbuzz.overrideAttrs(o: {
doCheck = false;
mesonFlags = ["-Dgobject=disabled"
"-Dicu=disabled"
"-Dintrospection=disabled"
];
})).override({gobject-introspection = null;});
mesa =
(super.mesa.overrideAttrs (o:{
mesonFlags =
let moreCross = self.writeText "cross-exe-wrapper.conf" ''
[binaries]
llvm-config = '${self.llvmPackages_11.llvm.dev}/bin/llvm-config'
cmake = '${self.buildPackages.cmake}/bin/cmake'
exe_wrapper = '/nix/store/4s5s0bgp6708nnyl9zbc7fa6s8c5xh59-qemu-6.0.0/bin/qemu-aarch64'
''; in
["-Dgallium-drivers=[lima,panfrost]"
"--cross-file=${moreCross}"
] ++ o.mesonFlags;
}));
gdk-pixbuf= (super.gdk-pixbuf.overrideAttrs(o:{
preInstall = "mkdir -p $out/share/doc $installedTests/foo";
mesonFlags = o.mesonFlags ++ [
"-Dgtk_doc=false"
];
})).override { doCheck = false; gobject-introspection = null;};
pango = super.hello;
kodi = super.kodi.override {
x11Support = false;
dbusSupport = false;
joystickSupport = false;
nfsSupport = false;
pulseSupport = false;
sambaSupport = false;
udevSupport = false;
usbSupport = false;
vdpauSupport = false;
gbmSupport = true;
jre_headless = self.buildPackages.adoptopenjdk-openj9-bin-11 ;
lirc = null;
};
rtmpdump = super.rtmpdump.overrideAttrs(o:{
makeFlags = o.makeFlags ++ [
"CC=${self.stdenv.cc.targetPrefix}cc"
"AR=${self.stdenv.cc.targetPrefix}ar"
];
});
})
];
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# need this for deploying to the odroid
<nixpkgs/nixos/modules/installer/cd-dvd/system-tarball.nix>
];
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
boot.loader.grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible = {
enable = true;
configurationLimit = 0;
};
boot.blacklistedKernelModules = [ "meson_gxbb_wdt" ] ;
# override systemd core file processing, which grinds the box to a
# halt (load av > 11)
boot.kernel.sysctl."kernel.core_pattern" = "/dev/null";
networking.hostName = "odroid"; # Define your hostname.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true;
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
systemd.services.kodi = {
# enable = false;
wantedBy = [ "multi-user.target"];
serviceConfig = {
WorkingDirectory = "/home/kodi";
User = "kodi";
ExecStart = ''
${pkgs.kodi}/bin/kodi --windowing=gbm
'';
};
};
# Enable sound.
sound.enable = true;
# hardware.pulseaudio.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.dan = {
isNormalUser = true;
extraGroups = [ "weston-launch" "wheel" "video" "audio"]; # Enable ‘sudo’ for the user.
};
users.users.kodi = {
isNormalUser = true;
extraGroups = [ "input" "video" "audio"];
};
# for i in `find /run/current-system/kernel-modules/lib/modules/5.12.10/kernel/ -name video\* -type f ` ;do sudo modprobe `basename $i .ko.xz`;done
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
# hardware.opengl = { enable = true; driSupport = true; };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment