nix-dotfiles/nixos/thor.nix

337 lines
8.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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, lib, ... }:
let sparkConfDir = pkgs.stdenv.mkDerivation {
name = "spark-config";
dontUnpack = true;
installPhase = ''
# source standard environment
. $stdenv/setup
# shorthands
base_conf=${pkgs.spark}/lib/${pkgs.spark.untarDir}/conf/
# create output dirs for new derivation
mkdir -p $out/
# link unchanged files from the original gnome-session
for f in $base_conf/*.template ; do
ln -sf $f $out/
done
# change selected files
cp $out/log4j.properties{.template,}
cat > $out/spark-env.sh <<- STOP
export JAVA_HOME="${pkgs.jdk8}"
export SPARK_HOME="${pkgs.spark}/lib/${pkgs.spark.untarDir}"
export SPARK_DIST_CLASSPATH=$(${pkgs.hadoop}/bin/hadoop classpath)
export PYSPARK_PYTHON="${pkgs.python3Packages.python}/bin/${pkgs.python3Packages.python.executable}"
export PYTHONPATH="\$PYTHONPATH:$PYTHONPATH"
export SPARKR_R_SHELL="${pkgs.R}/bin/R"
export PATH="\$PATH:${pkgs.R}/bin"
STOP
cat > $out/spark-defaults.conf <<- STOP
spark.eventLog.enabled true
spark.eventLog.dir hdfs://localhost:/logs/spark
spark.history.fs.logDirectory hdfs://localhost:/logs/spark
STOP
'';
};
in
{
imports = [
<nixos-hardware/common/cpu/amd>
<nixos-hardware/common/pc/ssd>
/etc/nixos/hardware-configuration.nix
./pro_audio.nix
];
boot = {
binfmt.emulatedSystems = [ "armv7l-linux" "aarch64-linux" ];
extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
checkJournalingFS = true;
luks.devices = {
root = {
device = "/dev/nvme0n1p2";
preLVM = true;
allowDiscards = true;
};
};
};
};
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
environment = {
pathsToLink = [ "/share/zsh" ];
systemPackages = with pkgs; [
kakoune
tmux
vim
];
};
hardware = {
bluetooth.enable = true;
enableRedistributableFirmware = true;
pulseaudio.enable = false;
# nvidia.modesetting.enable = true;
};
i18n.defaultLocale = "it_IT.UTF-8";
programs = {
dconf.enable = true;
flashrom.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
steam = {
enable = true;
};
zsh = {
enable = true;
syntaxHighlighting.enable = true;
};
};
networking = {
hostName = "thor"; # Define your hostname.
interfaces = {
eno1.useDHCP = true;
wlp5s0.useDHCP = true;
};
networkmanager.enable = true;
useDHCP = false;
hosts = {
"*.engine.sesar.int" = [ "172.20.28.210" ];
"vcenter.sesar.int" = [ "172.20.28.20" ];
};
};
time.timeZone = "Europe/Rome";
services = {
avahi = {
enable = true;
openFirewall = true;
nssmdns = true;
publish = {
enable = true;
addresses = true;
domain = true;
userServices = true;
workstation = true;
};
extraServiceFiles = {
ssh = "${pkgs.avahi}/etc/avahi/services/ssh.service";
};
};
clamav = { daemon.enable = true; updater.enable = true; };
dbus.packages = with pkgs; [ pkgs.dconf ];
gnome.gnome-keyring.enable = true;
gvfs = { enable = true; package = pkgs.gnome3.gvfs; };
fwupd.enable = true;
openssh = { enable = true; openFirewall = true; permitRootLogin = "no"; passwordAuthentication = false; forwardX11 = true; };
pipewire = {
enable = true;
pulse.enable = true;
jack.enable = true;
alsa = {
enable = true;
support32Bit = true;
};
media-session.enable = true;
};
power-profiles-daemon.enable = true;
smartd = { enable = true; notifications.x11.enable = true; };
snapper = {
configs =
let
common = {
extraConfig = ''
ALLOW_USERS="bertof"
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
'';
};
in
{
bertof_home = common // { subvolume = "/home/bertof"; };
};
};
thermald.enable = true;
xserver = {
enable = true;
desktopManager = {
# gnome.enable = true;
# cinnamon.enable = true;
plasma5 = {
enable = true;
runUsingSystemd = true;
useQtScaling = true;
};
};
# displayManager.gdm = { enable = true; nvidiaWayland = true; };
displayManager.sddm.enable = true;
layout = "us";
videoDrivers = [ "nvidia" ];
xkbOptions = "eurosign:e";
};
# gnome.gnome-remote-desktop.enable = true;
zerotierone = { enable = true; joinNetworks = [ "8056c2e21cf9c753" ]; };
spark = {
master = {
enable = true;
restartIfChanged = true;
};
worker = {
enable = true;
restartIfChanged = true;
};
confDir = sparkConfDir;
};
hadoop = {
coreSite = {
"fs.defaultFS" = "hdfs://localhost:8020";
};
hdfsSite = {
"dfs.namenode.rpc-bind-host" = "0.0.0.0";
"dfs.permissions" = "false";
};
hdfs = {
namenode = {
enable = true;
formatOnInit = true;
restartIfChanged = true;
};
datanode = {
enable = true;
restartIfChanged = true;
};
journalnode = {
enable = true;
restartIfChanged = true;
};
zkfc = {
enable = true;
restartIfChanged = true;
};
httpfs = {
enable = true;
restartIfChanged = true;
};
};
yarn = {
resourcemanager.enable = true;
nodemanager.enable = true;
};
};
ethminer = {
enable = false;
wallet = "0x73b788882e1C182123333f42FFf275B7dd7f51bb";
toolkit = "opencl";
rig = "thor";
pool = "eth-eu1.nanopool.org";
stratumPort = 9999;
registerMail = "";
};
# teamviewer.enable = true;
};
systemd.services.spark-history = {
path = with pkgs; [ procps openssh nettools ];
description = "spark history service.";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
environment = {
SPARK_CONF_DIR = sparkConfDir;
SPARK_LOG_DIR = "/var/log/spark";
};
serviceConfig = {
Type = "forking";
User = "spark";
Group = "spark";
WorkingDirectory = "${pkgs.spark}/lib/${pkgs.spark.untarDir}";
ExecStart = "${pkgs.spark}/lib/${pkgs.spark.untarDir}/sbin/start-history-server.sh";
ExecStop = "${pkgs.spark}/lib/${pkgs.spark.untarDir}/sbin/stop-history-server.sh";
TimeoutSec = 300;
StartLimitBurst = 10;
Restart = "always";
};
};
services.teamviewer.enable = true;
security = {
pam.services."kde" = {
enableKwallet = true;
};
rtkit.enable = true;
sudo.extraConfig = ''
Defaults pwfeedback
'';
};
sound.enable = false;
users.users.bertof = {
isNormalUser = true;
extraGroups = [ "audio" "input" "docker" "flashrom" "libvirtd" "network" "networkmanager" "usb" "video" "wheel" ];
openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN+zsSWZFFzQKnATCAvtG+iuSm4qkZHjCtHzGa9B/71W" ];
shell = pkgs.zsh;
useDefaultShell = false;
};
virtualisation = {
docker.enable = true;
kvmgt.enable = true;
libvirtd.enable = true;
podman.enable = true;
virtualbox.host.enable = true;
};
nixpkgs.config = {
allowUnfree = true;
packageOverrides = pkgs: {
steam = pkgs.steam.override {
extraPkgs = pkgs: with pkgs; [ ];
extraLibraries = pkgs: with pkgs; [ fontconfig.lib icu freetype ];
};
};
# cudaSupport = true;
};
nix = {
package = pkgs.nixFlakes;
extraOptions = lib.optionalString (config.nix.package == pkgs.nixFlakes)
"experimental-features = nix-command flakes";
gc.automatic = true;
};
system.stateVersion = "21.05"; # Did you read the comment?
}