nix-config/hosts/rpi-netboot/default.nix

158 lines
3.7 KiB
Nix
Raw Normal View History

2022-03-13 23:49:12 +01:00
{ nixpkgs, config, lib, pkgs, modulesPath, ... }:
{
system.build.tarball = pkgs.callPackage (nixpkgs + "/nixos/lib/make-system-tarball.nix") {
extraArgs = "--owner=0";
compressCommand = "cat";
compressionExtension = "";
storeContents = [
{
object = config.system.build.toplevel;
symlink = "none";
}
];
contents = [
{
source = config.system.build.toplevel + "/init";
target = "/sbin/init";
}
];
extraCommands = "mkdir -p proc sys dev";
};
boot.initrd.kernelModules = [ ];
boot.initrd.includeDefaultModules = false;
boot.initrd.availableKernelModules = lib.mkForce [ "usbhid" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
swapDevices = [ ];
hardware.enableRedistributableFirmware = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
nixpkgs.config.packageOverrides = pkgs: {
makeModulesClosure = x:
# prevent kernel install fail due to missing modules
pkgs.makeModulesClosure (x // { allowMissing = true; });
};
hardware.raspberry-pi."4" = {
# fkms-3d.enable = true;
};
c3d2 = {
isInHq = true;
mergeHostsFile = true;
hq.interface = "eth0";
hq.statistics.enable = false;
audioServer.enable = true;
k-ot.enable = true;
autoUpdate = false;
};
nix = {
buildCores = 4;
maxJobs = 1;
2022-03-13 23:49:12 +01:00
};
networking = {
hostName = "rpi-netboot"; # Define your hostname.
2022-03-13 23:49:12 +01:00
useDHCP = false;
interfaces.eth0.useDHCP = true;
firewall.enable = false;
};
# volatile system: everything is tmpfs
fileSystems."/" = {
fsType = "tmpfs";
options = [ "mode=0755" ];
};
fileSystems."/etc" = {
fsType = "tmpfs";
options = [ "mode=0755" ];
};
fileSystems."/var" = {
fsType = "tmpfs";
options = [ "mode=0755" ];
};
2022-03-13 23:49:12 +01:00
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
vim
wget
mpv
youtube-dl
ncpamixer
pulseaudio # required for pactl
chromium
firefox
pavucontrol
glxinfo
minetest
2022-03-13 23:49:12 +01:00
];
programs.tmux.enable = true;
2022-03-13 23:49:12 +01:00
# Do not log to flash:
services.journald.extraConfig = ''
Storage=volatile
'';
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
};
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
# Select internationalisation properties.
console = {
font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
keyMap = "de";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.layout = "de";
services.xserver.xkbOptions = "eurosign:e";
services.xserver.displayManager = {
lightdm = { enable = true; };
autoLogin = {
enable = true;
user = "k-ot";
};
defaultSession = "gnome-xorg";
};
services.xserver.desktopManager = {
gnome.enable = true;
# kodi.enable = true;
};
systemd.user.services.x11vnc = {
description = "X11 VNC server";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
serviceConfig = {
ExecStart = ''
${pkgs.x11vnc}/bin/x11vnc -shared -forever -passwd k-ot
'';
RestartSec = 3;
Restart = "always";
};
};
2022-03-13 23:49:12 +01:00
# 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. Its 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.11"; # Did you read the comment?
}