From 1052f859425a7ab9b751efaee5638ebd3799b481 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Fri, 6 Sep 2024 11:38:43 +0200 Subject: [PATCH] thor: Update to use UEFI, update Klipper for Sovol SV06 --- machines/default.nix | 16 ++-- machines/thor/configuration.nix | 93 ++++++++++++++++----- machines/thor/home.nix | 138 +++++++++++++++----------------- modules/klipper/firmware-config | 118 ++++++++++++++++++++------- 4 files changed, 233 insertions(+), 132 deletions(-) diff --git a/machines/default.nix b/machines/default.nix index c30e0a9..b04903f 100644 --- a/machines/default.nix +++ b/machines/default.nix @@ -135,14 +135,14 @@ inputs: { tags = [ "container" ]; }; }; - # thor = { - # system = "aarch64-linux"; - # config = import ./thor/configuration.nix inputs; - # # deploy = { - # # host = "10.0.0.198"; - # # targetUser = "erwin"; - # # }; - # }; + thor = { + system = "aarch64-linux"; + config = import ./thor/configuration.nix inputs; + # deploy = { + # host = "10.0.0.198"; + # targetUser = "erwin"; + # }; + }; unifi = { config = import ./unifi/configuration.nix inputs; deploy = { diff --git a/machines/thor/configuration.nix b/machines/thor/configuration.nix index 337276b..54cdf48 100644 --- a/machines/thor/configuration.nix +++ b/machines/thor/configuration.nix @@ -1,9 +1,9 @@ -{ nixpkgs, nixos-hardware, ... }: +{ ... }: { pkgs, config, ... }: { imports = [ - "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" - nixos-hardware.nixosModules.raspberry-pi-4 + # "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" + # nixos-hardware.nixosModules.raspberry-pi-4 ../../users/root ../../users/erwin @@ -16,14 +16,15 @@ enable = true; }; desktop = { - enable = true; + enable = false; }; fonts = { - enable = true; + enable = false; iosevka-aile = false; }; - gnome.enable = true; - lightdm.enable = true; + gnome.enable = false; + klipper.enable = true; + lightdm.enable = false; networking.enable = true; nix-common = { enable = true; @@ -37,19 +38,69 @@ hardware = { # deviceTree.filter = "bcm2711-rpi-4-b.dtb"; enableAllFirmware = true; - raspberry-pi."4".fkms-3d = { - enable = false; - cma = 512; - }; + # raspberry-pi."4".fkms-3d = { + # enable = false; + # cma = 512; + # }; }; boot = { bootspec.enable = true; growPartition = true; + loader = { + efi.canTouchEfiVariables = true; + systemd-boot = { + enable = true; + configurationLimit = 10; + }; + grub.enable = false; + }; + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = [ + "console=ttyS0,115200n8" + "console=ttyAMA0,115200n8" + "console=tty0" + "cma=512M" + ]; + initrd.availableKernelModules = [ + # Allows early (earlier) modesetting for the Raspberry Pi + "vc4" + "bcm2835_dma" + "i2c_bcm2835" + + # Maybe needed for SSD boot? + "usb_storage" + "xhci_pci" + "usbhid" + "uas" + ]; + + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + "/boot" = { + device = "/dev/disk/by-label/EFI"; + fsType = "vfat"; + }; + }; + + swapDevices = [ + { + device = "/dev/disk/by-label/swap"; + } + ]; + + powerManagement = { + cpuFreqGovernor = "ondemand"; }; zramSwap.enable = true; - sdImage.compressImage = false; + # sdImage.compressImage = false; time.timeZone = "Europe/Amsterdam"; @@ -75,7 +126,7 @@ tailscale.enable = true; kanata = { - enable = true; + enable = false; keyboards = { code = { @@ -116,13 +167,13 @@ }; }; - xserver = { - enable = true; - windowManager.i3 = { - enable = true; - extraPackages = with pkgs; [ i3lock-color ]; - }; - }; + # xserver = { + # enable = true; + # windowManager.i3 = { + # enable = true; + # extraPackages = with pkgs; [ i3lock-color ]; + # }; + # }; }; security = { @@ -134,5 +185,5 @@ raspberrypi-eeprom ]; - system.stateVersion = "23.05"; + system.stateVersion = "24.11"; } diff --git a/machines/thor/home.nix b/machines/thor/home.nix index fa7ff21..1a9a94b 100644 --- a/machines/thor/home.nix +++ b/machines/thor/home.nix @@ -6,16 +6,16 @@ ... }: with lib; -let - cfg = config.eboskma.users.erwin; -in +# let +# cfg = config.eboskma.users.erwin; +# in { home-manager.users.erwin = { _module.args.flake-inputs = inputs; eboskma = { programs = { - alacritty.enable = true; + alacritty.enable = false; atuin.enable = true; bat.enable = true; fish.enable = true; @@ -25,18 +25,18 @@ in name = "Erwin Boskma"; email = "erwin@datarift.nl"; # signingKey = "EE7ADEFE1D943C7B"; - signingKey = "~/.ssh/id_ed25519"; + signingKey = "~/.ssh/id_ed25519_sk_personal.pub"; signingKeyFormat = "ssh"; }; gpg.enable = true; - i3.enable = true; + i3.enable = false; neovim.enable = true; - nushell.enable = true; + nushell.enable = false; polybar = { - enable = true; + enable = false; }; rofi = { - enable = true; + enable = false; terminal = config.home-manager.users.erwin.xsession.windowManager.i3.config.terminal; }; ssh.enable = true; @@ -51,21 +51,15 @@ in EDITOR = "${pkgs.neovim}/bin/neovim"; }; - stateVersion = "23.05"; + stateVersion = "24.11"; packages = with pkgs; [ atool bottom - falkon fd imagemagick imv iotop - libnotify - mpv - nautilus - nordzy-cursor-theme - quintom-cursor-theme procs ripgrep units @@ -78,72 +72,72 @@ in xdg = { enable = true; - mime.enable = true; - mimeApps = { - enable = true; - defaultApplications = { - "x-scheme-handler/http" = "firefox.desktop"; - "x-scheme-handler/https" = "firefox.desktop"; - "x-scheme-handler/chrome" = "firefox.desktop"; - "x-scheme-handler/terminal" = "${cfg.terminal}.desktop"; - "text/html" = "firefox.desktop"; - "application/x-extension-htm" = "firefox.desktop"; - "application/x-extension-html" = "firefox.desktop"; - "application/x-extension-shtml" = "firefox.desktop"; - "application/xhtml+xml" = "firefox.desktop"; - "application/x-extension-xhtml" = "firefox.desktop"; - "application/x-extension-xht" = "firefox.desktop"; - "application/pdf" = "org.pwmt.zathura-pdf-mupdf.desktop"; - }; - associations = { - added = { - "image/jpeg" = "imv.desktop"; - "image/png" = "imv.desktop"; - "image/gif" = "imv.desktop"; - "application/zip" = "org.gnome.FileRoller.desktop"; - }; - }; - }; + # mime.enable = true; + # mimeApps = { + # enable = true; + # defaultApplications = { + # "x-scheme-handler/http" = "firefox.desktop"; + # "x-scheme-handler/https" = "firefox.desktop"; + # "x-scheme-handler/chrome" = "firefox.desktop"; + # "x-scheme-handler/terminal" = "${cfg.terminal}.desktop"; + # "text/html" = "firefox.desktop"; + # "application/x-extension-htm" = "firefox.desktop"; + # "application/x-extension-html" = "firefox.desktop"; + # "application/x-extension-shtml" = "firefox.desktop"; + # "application/xhtml+xml" = "firefox.desktop"; + # "application/x-extension-xhtml" = "firefox.desktop"; + # "application/x-extension-xht" = "firefox.desktop"; + # "application/pdf" = "org.pwmt.zathura-pdf-mupdf.desktop"; + # }; + # associations = { + # added = { + # "image/jpeg" = "imv.desktop"; + # "image/png" = "imv.desktop"; + # "image/gif" = "imv.desktop"; + # "application/zip" = "org.gnome.FileRoller.desktop"; + # }; + # }; + # }; userDirs = { enable = true; createDirectories = true; }; }; - i18n.inputMethod = { - enabled = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-m17n - fcitx5-gtk - fcitx5-configtool - ]; - }; + # i18n.inputMethod = { + # enabled = "fcitx5"; + # fcitx5.addons = with pkgs; [ + # fcitx5-m17n + # fcitx5-gtk + # fcitx5-configtool + # ]; + # }; - gtk = { - enable = true; - theme = { - name = "Arc-Dark"; - package = pkgs.arc-theme; - }; + # gtk = { + # enable = false; + # theme = { + # name = "Arc-Dark"; + # package = pkgs.arc-theme; + # }; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme; - }; + # iconTheme = { + # name = "Papirus-Dark"; + # package = pkgs.papirus-icon-theme; + # }; - gtk3 = { - bookmarks = [ "file:///home/erwin/workspace" ]; - extraConfig = { - gtk-application-prefer-dark-theme = 1; - gtk-cursor-theme-name = "Nordzy-cursors"; - }; - }; + # gtk3 = { + # bookmarks = [ "file:///home/erwin/workspace" ]; + # extraConfig = { + # gtk-application-prefer-dark-theme = 1; + # gtk-cursor-theme-name = "Nordzy-cursors"; + # }; + # }; - gtk4.extraConfig = { - gtk-application-prefer-dark-theme = 1; - gtk-cursor-theme-name = "Nordzy-cursors"; - }; - }; + # gtk4.extraConfig = { + # gtk-application-prefer-dark-theme = 1; + # gtk-cursor-theme-name = "Nordzy-cursors"; + # }; + # }; programs = { home-manager.enable = true; diff --git a/modules/klipper/firmware-config b/modules/klipper/firmware-config index 8e59b72..03610d0 100644 --- a/modules/klipper/firmware-config +++ b/modules/klipper/firmware-config @@ -1,51 +1,107 @@ CONFIG_LOW_LEVEL_OPTIONS=y -CONFIG_MACH_AVR=y +# CONFIG_MACH_AVR is not set # CONFIG_MACH_ATSAM is not set # CONFIG_MACH_ATSAMD is not set # CONFIG_MACH_LPC176X is not set -# CONFIG_MACH_STM32 is not set +CONFIG_MACH_STM32=y +# CONFIG_MACH_HC32F460 is not set # CONFIG_MACH_RP2040 is not set # CONFIG_MACH_PRU is not set +# CONFIG_MACH_AR100 is not set # CONFIG_MACH_LINUX is not set # CONFIG_MACH_SIMU is not set -CONFIG_AVR_SELECT=y -CONFIG_BOARD_DIRECTORY="avr" -CONFIG_MACH_atmega2560=y -# CONFIG_MACH_atmega1280 is not set -# CONFIG_MACH_at90usb1286 is not set -# CONFIG_MACH_at90usb646 is not set -# CONFIG_MACH_atmega32u4 is not set -# CONFIG_MACH_atmega1284p is not set -# CONFIG_MACH_atmega644p is not set -# CONFIG_MACH_atmega328p is not set -# CONFIG_MACH_atmega328 is not set -# CONFIG_MACH_atmega168 is not set -CONFIG_MCU="atmega2560" -CONFIG_AVRDUDE_PROTOCOL="wiring" -CONFIG_AVR_FREQ_16000000=y -# CONFIG_AVR_FREQ_8000000 is not set -CONFIG_CLOCK_FREQ=16000000 -CONFIG_AVR_CLKPR=-1 -CONFIG_AVR_STACK_SIZE=256 -CONFIG_AVR_WATCHDOG=y +CONFIG_BOARD_DIRECTORY="stm32" +CONFIG_MCU="stm32f103xe" +CONFIG_CLOCK_FREQ=72000000 CONFIG_SERIAL=y -CONFIG_AVR_SERIAL_UART0=y -# CONFIG_AVR_SERIAL_UART1 is not set -# CONFIG_AVR_SERIAL_UART2 is not set -# CONFIG_AVR_SERIAL_UART3 is not set -CONFIG_SERIAL_BAUD_U2X=y -CONFIG_SERIAL_PORT=0 +CONFIG_FLASH_SIZE=0x10000 +CONFIG_FLASH_BOOT_ADDRESS=0x8000000 +CONFIG_RAM_START=0x20000000 +CONFIG_RAM_SIZE=0x5000 +CONFIG_STACK_SIZE=512 +CONFIG_FLASH_APPLICATION_ADDRESS=0x8007000 +CONFIG_STM32_SELECT=y +CONFIG_MACH_STM32F103=y +# CONFIG_MACH_STM32F207 is not set +# CONFIG_MACH_STM32F401 is not set +# CONFIG_MACH_STM32F405 is not set +# CONFIG_MACH_STM32F407 is not set +# CONFIG_MACH_STM32F429 is not set +# CONFIG_MACH_STM32F446 is not set +# CONFIG_MACH_STM32F765 is not set +# CONFIG_MACH_STM32F031 is not set +# CONFIG_MACH_STM32F042 is not set +# CONFIG_MACH_STM32F070 is not set +# CONFIG_MACH_STM32F072 is not set +# CONFIG_MACH_STM32G070 is not set +# CONFIG_MACH_STM32G071 is not set +# CONFIG_MACH_STM32G0B0 is not set +# CONFIG_MACH_STM32G0B1 is not set +# CONFIG_MACH_STM32G431 is not set +# CONFIG_MACH_STM32H723 is not set +# CONFIG_MACH_STM32H743 is not set +# CONFIG_MACH_STM32H750 is not set +# CONFIG_MACH_STM32L412 is not set +# CONFIG_MACH_N32G452 is not set +# CONFIG_MACH_N32G455 is not set +# CONFIG_MACH_STM32F103x6 is not set +CONFIG_MACH_STM32F1=y +CONFIG_HAVE_STM32_USBFS=y +CONFIG_HAVE_STM32_CANBUS=y +CONFIG_STM32F103GD_DISABLE_SWD=y +CONFIG_STM32_DFU_ROM_ADDRESS=0 +# CONFIG_STM32_FLASH_START_2000 is not set +# CONFIG_STM32_FLASH_START_5000 is not set +CONFIG_STM32_FLASH_START_7000=y +# CONFIG_STM32_FLASH_START_8000 is not set +# CONFIG_STM32_FLASH_START_8800 is not set +# CONFIG_STM32_FLASH_START_9000 is not set +# CONFIG_STM32_FLASH_START_10000 is not set +# CONFIG_STM32_FLASH_START_800 is not set +# CONFIG_STM32_FLASH_START_1000 is not set +# CONFIG_STM32_FLASH_START_4000 is not set +# CONFIG_STM32_FLASH_START_0000 is not set +CONFIG_STM32_CLOCK_REF_8M=y +# CONFIG_STM32_CLOCK_REF_12M is not set +# CONFIG_STM32_CLOCK_REF_16M is not set +# CONFIG_STM32_CLOCK_REF_20M is not set +# CONFIG_STM32_CLOCK_REF_24M is not set +# CONFIG_STM32_CLOCK_REF_25M is not set +# CONFIG_STM32_CLOCK_REF_INTERNAL is not set +CONFIG_CLOCK_REF_FREQ=8000000 +CONFIG_STM32F0_TRIM=16 +# CONFIG_STM32_USB_PA11_PA12 is not set +CONFIG_STM32_SERIAL_USART1=y +# CONFIG_STM32_SERIAL_USART1_ALT_PB7_PB6 is not set +# CONFIG_STM32_SERIAL_USART2 is not set +# CONFIG_STM32_SERIAL_USART2_ALT_PD6_PD5 is not set +# CONFIG_STM32_SERIAL_USART3 is not set +# CONFIG_STM32_SERIAL_USART3_ALT_PD9_PD8 is not set +# CONFIG_STM32_CANBUS_PA11_PA12 is not set +# CONFIG_STM32_CANBUS_PA11_PB9 is not set +# CONFIG_STM32_MMENU_CANBUS_PB8_PB9 is not set +# CONFIG_STM32_MMENU_CANBUS_PD0_PD1 is not set CONFIG_SERIAL_BAUD=250000 CONFIG_USB_VENDOR_ID=0x1d50 CONFIG_USB_DEVICE_ID=0x614e CONFIG_USB_SERIAL_NUMBER="12345" -CONFIG_CANBUS_FREQUENCY=500000 +CONFIG_WANT_GPIO_BITBANGING=y +CONFIG_WANT_DISPLAYS=y +CONFIG_WANT_SENSORS=y +CONFIG_WANT_LIS2DW=y +CONFIG_WANT_LDC1612=y +CONFIG_WANT_SOFTWARE_I2C=y +CONFIG_WANT_SOFTWARE_SPI=y +CONFIG_NEED_SENSOR_BULK=y +CONFIG_CANBUS_FREQUENCY=1000000 CONFIG_INITIAL_PINS="" CONFIG_HAVE_GPIO=y CONFIG_HAVE_GPIO_ADC=y CONFIG_HAVE_GPIO_SPI=y CONFIG_HAVE_GPIO_I2C=y CONFIG_HAVE_GPIO_HARD_PWM=y -CONFIG_HAVE_GPIO_BITBANGING=y CONFIG_HAVE_STRICT_TIMING=y -CONFIG_INLINE_STEPPER_HACK=y \ No newline at end of file +CONFIG_HAVE_CHIPID=y +CONFIG_HAVE_STEPPER_BOTH_EDGE=y +CONFIG_HAVE_BOOTLOADER_REQUEST=y +CONFIG_INLINE_STEPPER_HACK=y