diff --git a/nixos/lavender/configuration.nix b/nixos/lavender/configuration.nix deleted file mode 100644 index c8fbe3f..0000000 --- a/nixos/lavender/configuration.nix +++ /dev/null @@ -1,180 +0,0 @@ -# This is your system's configuration file. -# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) - -{ inputs, outputs, lib, config, pkgs, ... }: { - # You can import other NixOS modules here - imports = [ - # If you want to use modules your own flake exports (from modules/nixos): - # outputs.nixosModules.example - - # Or modules from other flakes (such as nixos-hardware): - # inputs.hardware.nixosModules.common-cpu-amd - # inputs.hardware.nixosModules.common-ssd - - # Import common configurations - ../common/system-tools.nix - - # Import your generated (nixos-generate-config) hardware configuration - ./hardware-configuration.nix - - # Setup our 3D printer - ./printer - - # Import our docker containers - ./containers - ]; - - nixpkgs = { - # You can add overlays here - overlays = [ - # Add overlays your own flake exports (from overlays and pkgs dir): - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages - - # You can also add overlays exported from other flakes: - # neovim-nightly-overlay.overlays.default - - # Or define it inline, for example: - # (final: prev: { - # hi = final.hello.overrideAttrs (oldAttrs: { - # patches = [ ./change-hello-to-hi.patch ]; - # }); - # }) - ]; - # Configure your nixpkgs instance - config = { - # Disable if you don't want unfree packages - allowUnfree = true; - }; - }; - - nix = { - gc = { - #Automatically run the garbage collector at a specific time. - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - - # This will add each flake input as a registry - # To make nix commands consistent with your flake - registry = lib.mapAttrs (_: value: { flake = value; }) inputs; - - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - - settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - }; - - # Free up to 1GiB whenever there is less than 100MiB left. - extraOptions = '' - min-free = ${toString (100 * 1024 * 1024)} - max-free = ${toString (1024 * 1024 * 1024)} - ''; - }; - - # Select internationalisation properties - i18n.defaultLocale = "en_AU.UTF-8"; - # Set timezone - time.timeZone = "Australia/Perth"; - - boot = { - # Kernel to install - kernelPackages = pkgs.linuxPackages_rpi4; - # ttyAMA0 is the serial console broken out to the GPIO - kernelParams = [ - "8250.nr_uarts=1" - "console=ttyAMA0,115200" - "console=tty1" - # A lot of GUI programs need this, nearly all wayland applications - "cma=128M" - ]; - loader = { - # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) - grub.enable = false; - # Enables the generation of /boot/extlinux/extlinux.conf - generic-extlinux-compatible.enable = true; - }; - }; - - hardware = { - # Required for the Wireless firmware - enableRedistributableFirmware = true; - }; - - networking = { - hostName = "lavender"; - domain = "kanto.dev"; - networkmanager.enable = true; - firewall = { - enable = true; - allowedTCPPorts = [ - 53 # pihole-FTL (DNS) - 80 # traefik (HTTP) - 443 # traefik (HTTPS) - 32400 # plex - 32372 # qbittorrent - ]; - allowedUDPPorts = [ - 53 # pihole-FTL (DNS) - 80 # traefik (HTTP) - 443 # traefik (HTTPS) - 32400 # plex - 32372 # qbittorrent - ]; - }; - }; - - environment = { - # Install packages, prefix with 'unstable' to use overlay. - systemPackages = with pkgs; [ - libraspberrypi - raspberrypi-eeprom - ]; - - # Completions for system packages - pathsToLink = [ "/share/zsh" ]; - }; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - programs = { - zsh.enable = true; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - }; - - # List services that you want to enable: - services = { - # Enable the OpenSSH daemon. - openssh = { - enable = true; - settings = { - # Disable root login. - PermitRootLogin = "no"; - # Disable password login (Require keys). - PasswordAuthentication = false; - }; - }; - }; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.admin = { - isNormalUser = true; - extraGroups = [ "networkmanager" "wheel" "docker" ]; - shell = pkgs.zsh; - openssh.authorizedKeys.keyFiles = [ ../fuchsia/id_ed25519_sk.pub ]; - }; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "22.11"; -} - diff --git a/nixos/lavender/hardware-configuration.nix b/nixos/lavender/hardware-configuration.nix deleted file mode 100644 index ce5397f..0000000 --- a/nixos/lavender/hardware-configuration.nix +++ /dev/null @@ -1,41 +0,0 @@ -# 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" "usbhid" "usb_storage" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; - fsType = "ext4"; - }; - - fileSystems."/srv/data" = - { device = "/dev/disk/by-uuid/3548fbc6-6efd-4ed1-acc1-bd3ffed9d7a7"; - fsType = "ext4"; - }; - - swapDevices = [{ - device = "/var/lib/swapfile"; - size = 2048; - }]; - - # 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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.eth0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; -} diff --git a/nixos/lavender/printer/default.nix b/nixos/lavender/printer/default.nix deleted file mode 100644 index c3cc210..0000000 --- a/nixos/lavender/printer/default.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ ... }: - -{ - # Klipper is a 3d-Printer firmware. - # It combines the power of a general purpose computer with one or more micro-controllers. - services.klipper = { - enable = true; - # Setup User:Group - user = "root"; - group = "root"; - # Klipper configuration - configFile = ./printer.cfg; - }; - - # Moonraker is a Python 3 based web server - # Exposes APIs with which client applications may use to interact with the 3D printing firmware Klipper. - services.moonraker = { - enable = true; - # Setup User:Group - user = "root"; - group = "root"; - # Listen address and port - address = "0.0.0.0"; - port = 7125; - # Moonraker configuration - settings.authorization = { - force_logins = false; - cors_domains = [ - "https://fluidd.kanto.dev" - ]; - trusted_clients = [ - "10.0.0.0/8" - "127.0.0.0/8" - "192.168.1.0/24" - ]; - }; - # Moonraker exposes APIs to perform system-level operations, such as reboot, shutdown, and management of systemd units. - allowSystemControl = true; - }; - - # Fluidd is a free and open-source Klipper web interface for managing your 3d printer. - services.fluidd = { - enable = true; - # Listen address and port - nginx.listen = [{ - addr = "192.168.1.100"; - port = 4624; - }]; - }; - - # Allow uploads > 1MB to fluidd - services.nginx.clientMaxBodySize = "1000m"; -} diff --git a/nixos/lavender/printer/printer.cfg b/nixos/lavender/printer/printer.cfg deleted file mode 100644 index 5be26b6..0000000 --- a/nixos/lavender/printer/printer.cfg +++ /dev/null @@ -1,279 +0,0 @@ -# This file contains pin mappings for the stock 2022 Creality Ender 3 -# V2 Neo. To use this config, during "make menuconfig" select the -# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9) -# communication. - -# If you prefer a direct serial connection, in "make menuconfig" -# select "Enable extra low-level configuration options" and select -# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC -# cable used for the LCD module as follows: -# 3: Tx, 4: Rx, 9: GND, 10: VCC - -# Flash this firmware by copying "out/klipper.bin" to a SD card and -# turning on the printer with the card inserted. The firmware -# filename must end in ".bin" and must not match the last filename -# that was flashed. - -# This also works for the GD32F303 based Creality 4.2.2 board. - -# See docs/Config_Reference.md for a description of parameters. - -[stepper_x] -step_pin: PC2 -dir_pin: PB9 -enable_pin: !PC3 -microsteps: 16 -rotation_distance: 40 -endstop_pin: ^PA5 -position_endstop: 0 -position_max: 235 -homing_speed: 80 - -[stepper_y] -step_pin: PB8 -dir_pin: PB7 -enable_pin: !PC3 -microsteps: 16 -rotation_distance: 40 -endstop_pin: ^PA6 -position_endstop: 0 -position_max: 235 -homing_speed: 80 - -[stepper_z] -step_pin: PB6 -dir_pin: !PB5 -enable_pin: !PC3 -microsteps: 16 -rotation_distance: 8 -endstop_pin: probe:z_virtual_endstop -position_max: 250 -homing_speed: 4 -second_homing_speed: 1 -homing_retract_dist: 2.0 - -[extruder] -max_extrude_only_distance: 100.0 -step_pin: PB4 -dir_pin: PB3 -enable_pin: !PC3 -microsteps: 16 -rotation_distance: 34.406 -nozzle_diameter: 0.400 -filament_diameter: 1.750 -heater_pin: PA1 -sensor_type: EPCOS 100K B57560G104F -sensor_pin: PC5 -control: pid -# tuned for stock hardware with 200 degree Celsius target -pid_Kp: 26.120 -pid_Ki: 1.741 -pid_Kd: 97.951 -min_temp: 0 -max_temp: 250 - -[heater_bed] -heater_pin: PA2 -sensor_type: EPCOS 100K B57560G104F -sensor_pin: PC4 -control: pid -# tuned for stock hardware with 70 degree Celsius target -pid_kp: 70.073 -pid_ki: 1.229 -pid_kd: 998.534 -min_temp: 0 -max_temp: 130 - -[fan] -pin: PA0 - -[mcu] -serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 -restart_method: command - -[printer] -kinematics: cartesian -max_velocity: 300 -max_accel: 5000 -max_z_velocity: 5 -square_corner_velocity: 5.0 -max_z_accel: 100 - -[bltouch] -sensor_pin: ^PB1 -control_pin: PB0 -x_offset: -40.0 -y_offset: -12.0 -z_offset: 1.72 -speed: 20 -samples: 1 -sample_retract_dist: 8.0 - -[safe_z_home] -home_xy_position: 160,120 -speed: 150 -z_hop: 10 -z_hop_speed: 10 - -[bed_mesh] -speed: 120 -mesh_min: 30,30 # Need to handle head distance with cr-touch (bl_touch) -mesh_max: 189,189 # Max probe range -probe_count: 5,5 -fade_start: 1 -fade_end: 10 -fade_target: 0 -algorithm: bicubic - -[bed_screws] -screw1:30,25 -screw1_name:1 -screw2:200,25 -screw2_name:2 -screw3:200,195 -screw3_name:3 -screw4:30,195 -screw4_name:4 - -[screws_tilt_adjust] -screw1: 80, 50 -screw1_name: front left screw -screw2: 235, 50 -screw2_name: front right screw -screw3: 235, 208 -screw3_name: rear right screw -screw4: 80, 208 -screw4_name: rear left screw -horizontal_move_z: 10 -speed: 200 -screw_thread: CW-M4 # Use CW for Clockwise and CCW for Counter Clockwise - -# [display] -# The Ender 3 v2 Neo's 4.3" LCD display is not supported by klipper - -[output_pin beeper] -pin: PB13 - -# Replace the slicer's custom start and end g-code scripts with -# START_PRINT and END_PRINT. See docs/Slicers.md for more information on using these macros. -[gcode_macro START_PRINT] -gcode: - {% set BED_TEMP = params.BED_TEMP|default(60)|float %} - {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} - # Start bed heating - M140 S{BED_TEMP} - # Use absolute coordinates - G90 - # Reset the G-Code Z offset (adjust Z offset if needed) - SET_GCODE_OFFSET Z=0.0 - # Home the printer - G28 - # Wait for bed to reach temperature - M190 S{BED_TEMP} - # Perform bed mesh leveling - BED_MESH_CALIBRATE - # Set and wait for nozzle to reach temperature - M109 S{EXTRUDER_TEMP} - # Cura slicer purge line - G92 E0 # Reset Extruder - G1 Z2.0 F3000 # Move Z Axis up little to prevent scratching of Heat Bed - G1 X10.1 Y20 Z0.3 F5000.0 # Move to start position - G1 X10.1 Y200.0 Z0.3 F1500.0 E15 # Draw the first line - G1 X10.4 Y200.0 Z0.3 F5000.0 # Move to side a little - G1 X10.4 Y20 Z0.3 F1500.0 E30 # Draw the second line - G92 E0 # Reset Extruder - G1 Z2.0 F3000 # Move Z Axis up little to prevent scratching of Heat Bed - G1 X15 Y20 Z0.3 F5000.0 # Move over to prevent blob squish - -[gcode_macro END_PRINT] -gcode: - # Turn off bed, extruder, and fan - M140 S0 - M104 S0 - M106 S0 - # Move nozzle away from print while retracting - G91 - G1 X-2 Y-2 E-3 F300 - # Raise nozzle by 10mm - G1 Z10 F3000 - G90 - # Disable steppers - M84 - -# Fluidd initial setup - -# Allows file uploads to work correctly. -[virtual_sdcard] -path: /var/lib/moonraker/gcodes - -# Required to properly support display updates in fluidd -[display_status] - -# Enables Pause / Resume functionality within klipper. -[pause_resume] - -# These can be assumed sane defaults, but should be checked and modified to your own needs. -[gcode_macro PAUSE] -description: Pause the actual running print -rename_existing: PAUSE_BASE -# change this if you need more or less extrusion -variable_extrude: 1.0 -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - ##### set park positon for x and y ##### - # default is your max posion from your printer.cfg - {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} - {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} - ##### calculate save lift position ##### - {% set max_z = printer.toolhead.axis_maximum.z|float %} - {% set act_z = printer.toolhead.position.z|float %} - {% if act_z < (max_z - 2.0) %} - {% set z_safe = 2.0 %} - {% else %} - {% set z_safe = max_z - act_z %} - {% endif %} - ##### end of definitions ##### - PAUSE_BASE - G91 - {% if printer.extruder.can_extrude|lower == 'true' %} - G1 E-{E} F2100 - {% else %} - {action_respond_info("Extruder not hot enough")} - {% endif %} - {% if "xyz" in printer.toolhead.homed_axes %} - G1 Z{z_safe} F900 - G90 - G1 X{x_park} Y{y_park} F6000 - {% else %} - {action_respond_info("Printer not homed")} - {% endif %} - -[gcode_macro RESUME] -description: Resume the actual running print -rename_existing: RESUME_BASE -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - #### get VELOCITY parameter if specified #### - {% if 'VELOCITY' in params|upper %} - {% set get_params = ('VELOCITY=' + params.VELOCITY) %} - {%else %} - {% set get_params = "" %} - {% endif %} - ##### end of definitions ##### - {% if printer.extruder.can_extrude|lower == 'true' %} - G91 - G1 E{E} F2100 - {% else %} - {action_respond_info("Extruder not hot enough")} - {% endif %} - RESUME_BASE {get_params} - -[gcode_macro CANCEL_PRINT] -description: Cancel the actual running print -rename_existing: CANCEL_PRINT_BASE -gcode: - TURN_OFF_HEATERS - CANCEL_PRINT_BASE -