Make pianonix work

This commit is contained in:
2024-11-26 14:03:41 +01:00
parent b0a22014c3
commit 6bfa5e0b73
9 changed files with 616 additions and 284 deletions

View File

@ -0,0 +1,172 @@
# 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).
{
lib,
inputs,
config,
pkgs,
...
}:
{
imports = [ ./hardware-configuration.nix ];
# disko.devices.disk.main.device = "/dev/mmcblk1";
networking.networkmanager.enable = true;
# networking.wireless.enable = true;
# networking.wireless.environmentFile = config.sops.secrets."wifi/pianonix".path;
# networking.wireless.networks = {
# "@SSID@".psk = "@PSK@";
# };
networking.hostName = "pianonix"; # Define your hostname.
# Set your time zone.
time.timeZone = "Europe/Berlin";
modules = {
nix-settings.enable = true;
xserver-defaults.enable = true;
keymap.enable = true;
builder.enable = false;
# system.boot-efi.enable = true;
sound.enable = true;
locales.enable = true;
pcmanfm.enable = true;
# i3.enable = true;
# gdm.enable = true;
redshift.enable = true;
# wayland.enable = true;
# hyprland.enable = true;
# tuigreet.enable = true;
# virtualbox.enable = true;
users-julian.enable = true;
syncthing = {
enable = true;
overrideSettings = true;
};
# xdg-portal.enable = true;
polkit.enable = true;
keyring.enable = true;
};
users.mutableUsers = false;
users.users.julian.hashedPasswordFile = config.sops.secrets."password/pianonix".path;
# Enable the Desktop Environment.
# services.xserver.displayManager.lightdm.enable = true;
services.displayManager.autoLogin = {
enable = true;
user = "julian";
};
boot.loader.timeout = 1; # Set boot loader timeout to 1s
programs.dconf.enable = true;
# De-facto disable network manager, which is enabled by gnome
# networking.networkmanager.unmanaged = [ "*" ];
services.xserver.desktopManager = {
xfce = {
enable = true;
};
};
services.xserver.xautolock.enable = false;
services.xserver.desktopManager.xfce.enableScreensaver = false;
# xdg.portal.lxqt.enable = true;
services.openssh = {
enable = true;
# require public key authentication for better security
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "yes";
};
users.users."root".openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDVk/m4ydcYXzHxTWeNw2MlwxKU+JirTVOeHsYR4wdTokwYyNWZ3/zPcU4+XekSRatwJW1LJYrZ1Y5IJkobzgnOvYVI7SXZ1Tbzb1kAcnChSt+Dp/pKdMPZ8yY3PTFZh+R5F3rWFA/YZqTRhh0vuxPIVbLl7zOPExWwYGn9crkZaYZvKHVvgE5660hXo9pxbUKsSs+DIy/AE7gfKiZLusY95nk9T/jZ7Vmhl0UsF0RiDsfxgE664/vEKe8b+82kKCDt5nJVe8THSrjaw4+NUhef6R8UoUO1/Pn4TKq3Gil3Z36wPEPdkw2lYzX+d1EFyaC3hZJedSUfdFliPOejIbNvvhPBBD1wAGxxyuJZB5KLwWN7/efwCgw45buLbVfUuwwug7K7GK84A3yzqClbZKKv8rYdO04UG64A+Taq2LeyxQIDjygTgGk/1j/0Neb1RO0FbjlbTeNMZ54P+u7BTEcikJCsbFeseWDtYzupQtLt96KMbcdRgHy0CTGqFHE+my8= julian@julian-aspi"
];
# Do not alway generate man-cache, making builds much faster
documentation.man.generateCaches = false;
# MDNS on local network
services.avahi = {
enable = true;
nssmdns4 = true;
publish.enable = true;
publish.addresses = true;
};
services.syncthing.key = config.sops.secrets."syncthing/pianonix/key".path;
services.syncthing.cert = config.sops.secrets."syncthing/pianonix/cert".path;
services.syncthing.settings = {
devices = {
"aspi-nix" = {
id = "DM5QRYU-ILJ4XYB-4V6NZDG-RAMVOND-3RSDSYR-52TW6RW-3XIU333-T7FNAA3";
};
"pianonix" = {
id = "FD3XSFW-7LQSCIQ-KHZPLNQ-7VZYGKH-RJ2ZKTJ-BG67NRH-36TQIZM-CXDYWAH";
};
};
folders = {
"Klavier" = {
path = "/home/julian/Klavier";
id = "flc3m-q4gp2";
devices = [
"aspi-nix"
"pianonix"
];
};
};
};
# Packages needed as root
environment.systemPackages = with pkgs; [
vim
htop
mc
];
# VNC server
# services.x2goserver.enable = true;
# networking.firewall.enable = false;
# networking.firewall.allowedTCPPorts = [
# 8000
# 5901
# ];
# Disable the GNOME3/GDM auto-suspend feature that cannot be disabled in GUI!
# If no user is logged in, the machine will power down after 20 minutes.
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
systemd.targets.hybrid-sleep.enable = false;
## Raspberry pi specific config
hardware.raspberry-pi."4" = {
fkms-3d.enable = true;
touch-ft5406.enable = true;
};
# Prevent host becoming unreachable on wifi after some time (for raspberry pi)
networking.networkmanager.wifi.powersave = false;
# Enable audio devices on raspberry pi
# boot.kernelParams = [
# "snd_bcm2835.enable_hdmi=1"
# "snd_bcm2835.enable_headphones=1"
# ];
# boot.loader.raspberryPi.firmwareConfig = ''
# dtparam=audio=on
# '';
# ======================== DO NOT CHANGE THIS ========================
system.stateVersion = "22.11";
# ======================== DO NOT CHANGE THIS ========================
}

View File

@ -0,0 +1,36 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
fsType = "ext4";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.end0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}

View File

@ -1,103 +0,0 @@
# 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).
{
lib,
inputs,
config,
pkgs,
...
}:
{
imports = [ ./disko-config.nix ];
disko.devices.disk.main.device = "/dev/sda";
networking.networkmanager.enable = true;
networking.hostName = "pianonix"; # Define your hostname.
# Set your time zone.
time.timeZone = "Europe/Berlin";
modules = {
nix-settings.enable = true;
xserver-defaults.enable = true;
keymap.enable = true;
builder.enable = false;
system.boot-efi.enable = true;
sound.enable = true;
locales.enable = true;
pcmanfm.enable = true;
# i3.enable = true;
# gdm.enable = true;
redshift.enable = true;
wayland.enable = true;
# hyprland.enable = true;
# tuigreet.enable = true;
# virtualbox.enable = true;
users-julian.enable = true;
# syncthing.enable = true;
xdg-portal.enable = true;
polkit.enable = true;
keyring.enable = true;
};
users.mutableUsers = false;
users.users.root.hashedPassword = "$y$j9T$mDQgl0GARH9fKg01akW1V0$2E5Z4TVra0RbY.tO2B6rW2YnVtJ6tbzZkJRvGWciSkB";
# no password
users.users.julian.hashedPassword = "$y$j9T$khuv2ubKt48fkWS754jkL1$/YSqi4mWV9ccfnMAWCF0yumnwZrJ/ddg2TZTuZaDsi8";
# Enable the Desktop Environment.
# services.xserver.displayManager.lightdm.enable = true;
services.displayManager.autoLogin = {
enable = true;
user = "julian";
};
services.xserver.desktopManager = {
# xterm.enable = false;
lxqt = {
enable = true;
};
};
xdg.portal.lxqt.enable = true;
services.openssh = {
enable = true;
# require public key authentication for better security
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "yes";
};
users.users."root".openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDVk/m4ydcYXzHxTWeNw2MlwxKU+JirTVOeHsYR4wdTokwYyNWZ3/zPcU4+XekSRatwJW1LJYrZ1Y5IJkobzgnOvYVI7SXZ1Tbzb1kAcnChSt+Dp/pKdMPZ8yY3PTFZh+R5F3rWFA/YZqTRhh0vuxPIVbLl7zOPExWwYGn9crkZaYZvKHVvgE5660hXo9pxbUKsSs+DIy/AE7gfKiZLusY95nk9T/jZ7Vmhl0UsF0RiDsfxgE664/vEKe8b+82kKCDt5nJVe8THSrjaw4+NUhef6R8UoUO1/Pn4TKq3Gil3Z36wPEPdkw2lYzX+d1EFyaC3hZJedSUfdFliPOejIbNvvhPBBD1wAGxxyuJZB5KLwWN7/efwCgw45buLbVfUuwwug7K7GK84A3yzqClbZKKv8rYdO04UG64A+Taq2LeyxQIDjygTgGk/1j/0Neb1RO0FbjlbTeNMZ54P+u7BTEcikJCsbFeseWDtYzupQtLt96KMbcdRgHy0CTGqFHE+my8= julian@julian-aspi"
];
# Packages needed as root
environment.systemPackages = with pkgs; [
vim
htop
mc
];
## Raspberry pi specific config
# Prevent host becoming unreachable on wifi after some time (for raspberry pi)
networking.networkmanager.wifi.powersave = false;
# Enable audio devices on raspberry pi
boot.kernelParams = [
"snd_bcm2835.enable_hdmi=1"
"snd_bcm2835.enable_headphones=1"
];
boot.loader.raspberryPi.firmwareConfig = ''
dtparam=audio=on
'';
# ======================== DO NOT CHANGE THIS ========================
system.stateVersion = "22.11";
# ======================== DO NOT CHANGE THIS ========================
}

View File

@ -1,41 +0,0 @@
# USAGE in your configuration.nix.
# Update devices to match your hardware.
# {
# imports = [ ./disko-config.nix ];
# disko.devices.disk.main.device = "/dev/sda";
# }
{
disko.devices = {
disk = {
main = {
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
};
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@ -1,80 +0,0 @@
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
# TODO: This has to adapted yet !!!
boot.initrd.availableKernelModules = [
"vmd"
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"usbhid"
"sd_mod"
];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.initrd.luks.devices = {
root = {
device = "/dev/disk/by-uuid/a4dc9a2c-725b-4252-8fbb-093a271c31ba";
preLVM = true;
allowDiscards = true;
};
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/bbc45be3-75f5-40c5-8427-2a425de8422c";
fsType = "btrfs";
options = [
"subvol=root"
"compress=zstd"
];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/bbc45be3-75f5-40c5-8427-2a425de8422c";
fsType = "btrfs";
options = [
"subvol=home"
"compress=zstd"
];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/bbc45be3-75f5-40c5-8427-2a425de8422c";
fsType = "btrfs";
options = [
"subvol=nix"
"compress=zstd"
"noatime"
];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/7040-F37C";
fsType = "vfat";
};
swapDevices = [ { device = "/dev/disk/by-uuid/26140b4a-0579-406d-a484-35aa31b32e80"; } ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}