diff options
| -rw-r--r-- | archetypes/collections/desktop/cad.nix | 6 | ||||
| -rw-r--r-- | archetypes/collections/desktop/xserver.nix | 10 | ||||
| -rw-r--r-- | archetypes/collections/utilities.nix | 5 | ||||
| -rw-r--r-- | flake.lock | 28 | ||||
| -rw-r--r-- | flake.nix | 5 | ||||
| -rw-r--r-- | home-manager/neovim.nix | 50 | ||||
| -rw-r--r-- | hosts/gnuslashprinter/configuration.nix | 29 | ||||
| -rw-r--r-- | hosts/gnuslashprinter/flask-relay-ctl.nix | 37 | ||||
| -rw-r--r-- | hosts/gnuslashprinter/hardware-configuration.nix | 44 | ||||
| -rw-r--r-- | hosts/gnuslashprinter/klipper.nix | 100 | ||||
| -rw-r--r-- | hosts/gnuslashprinter/resources/flaskrelayctl/pyproject.toml | 10 | ||||
| -rw-r--r-- | hosts/gnuslashprinter/resources/flaskrelayctl/server/__init__.py | 54 | ||||
| -rw-r--r-- | hosts/gnuslashprinter/resources/klipper/mcu/config | 109 | ||||
| -rw-r--r-- | hosts/gnuslashprinter/resources/klipper/printer.cfg | 180 | ||||
| -rw-r--r-- | hosts/optiplex/configuration.nix | 18 | ||||
| -rw-r--r-- | nixos/decklink.nix | 21 | ||||
| -rw-r--r-- | nixos/default.nix | 1 | ||||
| -rw-r--r-- | pkgs/st/overrides.nix | 2 | ||||
| -rw-r--r-- | users/timmy/home.nix | 15 | ||||
| -rw-r--r-- | users/timmy/hosts.nix | 4 | ||||
| -rw-r--r-- | users/timmy/nas.nix | 7 | ||||
| -rw-r--r-- | users/timmy/printing.nix | 4 |
22 files changed, 677 insertions, 62 deletions
diff --git a/archetypes/collections/desktop/cad.nix b/archetypes/collections/desktop/cad.nix index 33edcd5..6b2c26b 100644 --- a/archetypes/collections/desktop/cad.nix +++ b/archetypes/collections/desktop/cad.nix @@ -11,5 +11,11 @@ in { freecad prusa-slicer ]; + # TODO remove once #467783 is resolved + environment.sessionVariables = { + # Make GTK3 file-chooser settings discoverable + # per https://github.com/NixOS/nixpkgs/issues/467783#issuecomment-3648708206 + GSETTINGS_SCHEMA_DIR ="${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}/glib-2.0/schemas"; + }; }; } diff --git a/archetypes/collections/desktop/xserver.nix b/archetypes/collections/desktop/xserver.nix index 050c9d4..9d62048 100644 --- a/archetypes/collections/desktop/xserver.nix +++ b/archetypes/collections/desktop/xserver.nix @@ -18,16 +18,16 @@ in { # Install basic X utilities environment.systemPackages = with pkgs; lib.optionals cfg.utilities.enable [ + setxkbmap unclutter-desktop-entry unclutter-xfixes xcape xclip xdotool - xorg.setxkbmap - xorg.xinput - xorg.xkill - xorg.xrandr - xorg.xset + xinput + xkill + xrandr + xset xwallpaper ]; }; diff --git a/archetypes/collections/utilities.nix b/archetypes/collections/utilities.nix index b539ac9..1597d75 100644 --- a/archetypes/collections/utilities.nix +++ b/archetypes/collections/utilities.nix @@ -8,7 +8,7 @@ htop jq killall - light + #light # TODO find replacement lm_sensors mediainfo nmap @@ -25,10 +25,11 @@ testdisk tmux uhubctl + usbutils vimv-rs wget wireguard-tools - xxHash + xxhash yt-dlp ]; @@ -67,43 +67,43 @@ ] }, "locked": { - "lastModified": 1775425411, - "narHash": "sha256-KY6HsebJHEe5nHOWP7ur09mb0drGxYSzE3rQxy62rJo=", + "lastModified": 1780361225, + "narHash": "sha256-wnV9ttf4fPWNonBIQmvlrSlNpQYgx5HgWWd007mwIFA=", "owner": "nix-community", "repo": "home-manager", - "rev": "0d02ec1d0a05f88ef9e74b516842900c41f0f2fe", + "rev": "e28654b71096e08c019d4861ca26acb646f583d8", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-25.11", + "ref": "release-26.05", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1775811116, - "narHash": "sha256-t+HZK42pB6N+i5RGbuy7Xluez/VvWbembBdvzsc23Ss=", + "lastModified": 1780203844, + "narHash": "sha256-K5sT4jTpGs15ADhviMKNBH38REpPf5Q6mM1+N6cArVE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "54170c54449ea4d6725efd30d719c5e505f1c10e", + "rev": "b51242d7d43689db2f3be91bd05d5b24fbb469c4", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-25.11", + "ref": "nixos-26.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1775710090, - "narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=", + "lastModified": 1780243769, + "narHash": "sha256-x5UQuRsH3MqI0U9afaXSNqzTPSeZlRLvFAav2Ux1pNw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4c1018dae018162ec878d42fec712642d214fdfa", + "rev": "331800de5053fcebacf6813adb5db9c9dca22a0c", "type": "github" }, "original": { @@ -176,11 +176,11 @@ ] }, "locked": { - "lastModified": 1775682595, - "narHash": "sha256-0E9PohY/VuESLq0LR4doaH7hTag513sDDW5n5qmHd1Q=", + "lastModified": 1777944972, + "narHash": "sha256-VfGRo1qTBKOe3s2gOv8LSoA6Fk19PvBlwQ1ECN0Evn8=", "owner": "Mic92", "repo": "sops-nix", - "rev": "d2e8438d5886e92bc5e7c40c035ab6cae0c41f76", + "rev": "c591bf665727040c6cc5cb409079acb22dcce33c", "type": "github" }, "original": { @@ -2,7 +2,7 @@ rec { description = "TimmyOS System Config"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; sops-nix = { @@ -10,7 +10,7 @@ rec { inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { - url = "github:nix-community/home-manager/release-25.11"; + url = "github:nix-community/home-manager/release-26.05"; inputs.nixpkgs.follows = "nixpkgs"; }; arkenfox = { @@ -93,6 +93,7 @@ rec { "T495" "X230" "flex-wg-router" + "gnuslashprinter" "hp-envy-office" "libreX60" "optiplex" diff --git a/home-manager/neovim.nix b/home-manager/neovim.nix index 60608f6..2b19257 100644 --- a/home-manager/neovim.nix +++ b/home-manager/neovim.nix @@ -1,13 +1,13 @@ { lib, config, pkgs, ... }: let cfg = config.programs._neovim; - extraPlugins = cfg.plugins.packages // { - start = (cfg.plugins.packages.start or []) - ++ lib.optionals cfg.plugins.lsp.enable [ cfg.plugins.lsp.pluginPackage ] - ++ lib.optionals cfg.plugins.treesitter.enable [ cfg.plugins.treesitter.pluginPackage ] - ++ lib.optionals cfg.plugins.treesitter.enable cfg.plugins.treesitter.parsers.packages; - }; - pluginDir = pkgs.linkFarm "nvim-site" + pluginDir = let + extraPlugins = cfg.plugins.packages // { + start = (cfg.plugins.packages.start or []) + ++ lib.optionals (cfg.plugins.lsp.enable && cfg.plugins.lsp.lspconfig.enable) [ cfg.plugins.lsp.lspconfig.pluginPackage ] + ++ lib.optionals cfg.plugins.treesitter.enable [ cfg.plugins.treesitter.pluginPackage ]; + }; + in pkgs.linkFarm "nvim-site" (lib.concatLists (lib.mapAttrsToList (stage: plugins: map (plugin: { name = "share/nvim/site/pack/plugins/${stage}/${plugin.name}"; @@ -15,8 +15,19 @@ }) plugins ) extraPlugins)); - extraPackages = cfg.extraPackages - ++ lib.optionals cfg.plugins.lsp.enable cfg.plugins.lsp.languageServers.packages; + extraPackages = pkgs.symlinkJoin { + name = "nvim-extra-packages"; + paths = cfg.extraPackages + ++ lib.optionals cfg.plugins.lsp.enable cfg.plugins.lsp.languageServers.packages; + }; + + parserDir = let + allTSParserPackages = builtins.filter lib.isDerivation + (builtins.attrValues cfg.plugins.treesitter.parsers.installAllFromPackageSet); + in pkgs.symlinkJoin { + name = "nvim-treesitter-parsers"; + paths = if cfg.plugins.treesitter.parsers.installAll then allTSParserPackages else cfg.plugins.treesitter.parsers.packages; + }; finalPackage = pkgs.symlinkJoin { name = "neovim-not-wrapped"; @@ -24,8 +35,13 @@ nativeBuildInputs = [ pkgs.makeWrapper ]; postBuild = '' wrapProgram $out/bin/nvim \ - --prefix PATH : ${pkgs.lib.makeBinPath extraPackages} \ - --prefix XDG_DATA_DIRS : ${pluginDir}/share + --prefix PATH : ${extraPackages} \ + --prefix XDG_DATA_DIRS : ${pluginDir}/share \ + '' + lib.optionalString cfg.plugins.treesitter.enable '' + --add-flags '--cmd "set rtp^=${parserDir}"' \ + --add-flags '--cmd "set rtp^=${cfg.plugins.treesitter.pluginPackage}/runtime"' \ + '' + '' + # blank line here to terminate multiline command string '' + lib.optionalString cfg.viAlias '' ln -s $out/bin/nvim $out/bin/vi '' + lib.optionalString cfg.vimAlias '' @@ -41,7 +57,10 @@ in { plugins = { lsp = { enable = lib.mkEnableOption "install defined language servers into nvim path"; - pluginPackage = lib.mkPackageOption pkgs.vimPlugins "nvim-lspconfig" {}; + lspconfig = { + enable = lib.mkEnableOption "install plugin `lspconfig.pluginPackage`"; + pluginPackage = lib.mkPackageOption pkgs.vimPlugins "nvim-lspconfig" {}; + }; languageServers.packages = lib.mkOption { type = lib.types.listOf lib.types.package; default = [ ]; @@ -51,6 +70,13 @@ in { treesitter = { enable = lib.mkEnableOption "install treesitter and parsers as nvim plugins"; pluginPackage = lib.mkPackageOption pkgs.vimPlugins "nvim-treesitter" {}; + parsers.installAll = lib.mkEnableOption "install all available parsers. overrides `parsers.packages`"; + parsers.installAllFromPackageSet = lib.mkOption { + type = lib.types.attrsOf lib.types.anything; + default = pkgs.vimPlugins.nvim-treesitter-parsers; + defaultText = lib.literalExpression "pkgs.vimPlugins.nvim-treesitter-parsers"; + description = "parent package from which to install all treesitter parsers"; + }; parsers.packages = lib.mkOption { type = lib.types.listOf lib.types.package; default = [ ]; diff --git a/hosts/gnuslashprinter/configuration.nix b/hosts/gnuslashprinter/configuration.nix new file mode 100644 index 0000000..9e1f734 --- /dev/null +++ b/hosts/gnuslashprinter/configuration.nix @@ -0,0 +1,29 @@ +{ + imports = [ + ./flask-relay-ctl.nix + ./klipper.nix + ]; + + boot._loader.enable = true; + + _archetypes = { + profiles = { + headless = { + enable = true; + home.users.timmy.enable = true; + }; + btrfs.enable = true; + }; + }; + + # Enable user timmy + _users.timmy.enable = true; + + # Name devices + services.udev.extraRules = '' + SUBSYSTEM=="tty", KERNELS=="3-9", SYMLINK+="gsp-power" + SUBSYSTEM=="tty", KERNELS=="3-10", SYMLINK+="gsp-control" + ''; + + system.stateVersion = "25.11"; +} diff --git a/hosts/gnuslashprinter/flask-relay-ctl.nix b/hosts/gnuslashprinter/flask-relay-ctl.nix new file mode 100644 index 0000000..27507b6 --- /dev/null +++ b/hosts/gnuslashprinter/flask-relay-ctl.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: let + flaskrelayctl = pkgs.python3Packages.buildPythonApplication { + pname = "flaskrelayctl"; + version = "1.0"; + src = ./resources/flaskrelayctl; + pyproject = true; + build-system = with pkgs.python3Packages; [ setuptools ]; + dependencies = with pkgs.python3Packages; [ + flask + pyserial + ]; + }; +in { + users.users.relay-api = { + isSystemUser = true; + group = "relay-api"; + extraGroups = [ "dialout" ]; + }; + users.groups.relay-api = {}; + + systemd.services.relay-api = let + RELAYCTL_DEV = "/dev/gsp-power"; + in { + description = "USB Relay Flask API"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + serviceConfig = { + User = "relay-api"; + Group = "relay-api"; + ExecStart = "${flaskrelayctl}/bin/flaskrelayctl"; + Restart = "always"; + DeviceAllow = [ "${RELAYCTL_DEV} rw" ]; + }; + }; + + environment.systemPackages = [ flaskrelayctl ]; +} diff --git a/hosts/gnuslashprinter/hardware-configuration.nix b/hosts/gnuslashprinter/hardware-configuration.nix new file mode 100644 index 0000000..278d6e6 --- /dev/null +++ b/hosts/gnuslashprinter/hardware-configuration.nix @@ -0,0 +1,44 @@ +# 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" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/416a481f-d656-4bd1-acdb-bd0a6f2d2c3a"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/416a481f-d656-4bd1-acdb-bd0a6f2d2c3a"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/416a481f-d656-4bd1-acdb-bd0a6f2d2c3a"; + fsType = "btrfs"; + options = [ "subvol=@nix" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/18C4-6D53"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/gnuslashprinter/klipper.nix b/hosts/gnuslashprinter/klipper.nix new file mode 100644 index 0000000..331a0c7 --- /dev/null +++ b/hosts/gnuslashprinter/klipper.nix @@ -0,0 +1,100 @@ +{ + # Klipper firmware + services.klipper = { + enable = true; + firmwares = { + mcu = { + enable = true; + # Serial port connected to the microcontroller + serial = "/dev/gsp-control"; + # Klipper flash must be enabled in order to build mcu firmware + # The resulting `klipper-flash-mcu` command will show the location of the firmware bin in the nix store + enableKlipperFlash = true; + # Run klipper-genconf to generate this + configFile = ./resources/klipper/mcu/config; + }; + }; + configFile = ./resources/klipper/printer.cfg; + logFile = "/var/lib/klipper/klipper.log"; + }; + # Mutable config + services.klipper.mutableConfig = true; + #configDir = "/var/lib/moonraker/config"; # Accessible by moonraker # TODO + + # Moonraker web-api + security.polkit.enable = true; # required for services.moonraker.allowSystemControl + services.moonraker = { + user = "root"; + enable = true; + address = "0.0.0.0"; + allowSystemControl = true; + settings = { + authorization = { + force_logins = true; + cors_domains = [ + "*.local" + "*.lan" + "*://app.fluidd.xyz" + "*://my.mainsail.xyz" + ]; + trusted_clients = [ + "10.0.0.0/8" + "127.0.0.0/8" + "169.254.0.0/16" + "172.16.0.0/12" + "192.168.0.0/16" + "FE80::/10" + "::1/128" + ]; + }; + #file_manager.check_klipper_config_path = false; # Disable warning when klipper config is not accessible by moonraker + # mainsail.cfg + #"update_manager mainsail-config" = { + # type = "git_repo"; + # primary_branch = "master"; + # path = "~/mainsail-config"; + # origin = "https://github.com/mainsail-crew/mainsail-config.git"; + # managed_services = "klipper"; + #}; + + "power printer" = let + relayApiHost = "http://localhost:5050"; + in { + type = "http"; + on_url = "${relayApiHost}/on"; + off_url = "${relayApiHost}/off"; + status_url = "${relayApiHost}/status"; + response_template = '' + + # The module will perform the "GET" request using the appropriate url. + # We use the `last_response` method to fetch the result and decode the + # json response. + {% set resp = http_request.last_response().json() %} + # The expression below will render "on" or "off". + {resp["state"].lower()} + ''; + off_when_shutdown = true; + on_when_job_queued = true; + locked_while_printing = true; + restart_klipper_when_powered = true; + restart_delay = "1"; + bound_services = "klipper"; + initial_state = "off"; + }; + }; + }; + + # Mainsail web-interface + services.mainsail = { + enable = true; + hostName = "0.0.0.0"; + nginx.listenAddresses = [ "0.0.0.0" ]; + }; + services.nginx.clientMaxBodySize = "1000m"; # Allow large gcodes, etc. + networking.firewall.allowedTCPPorts = [ 80 ]; # Port for mainsail via nginx + + # Webcam support in mainsail + # TODO hook to restart ustreamer when webcam is connected + services.ustreamer.enable = true; + services.mainsail.nginx.locations."/webcam/".proxyPass = "http://localhost:8080/stream"; # Default location for ustreamer stream +} diff --git a/hosts/gnuslashprinter/resources/flaskrelayctl/pyproject.toml b/hosts/gnuslashprinter/resources/flaskrelayctl/pyproject.toml new file mode 100644 index 0000000..b151b74 --- /dev/null +++ b/hosts/gnuslashprinter/resources/flaskrelayctl/pyproject.toml @@ -0,0 +1,10 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "flaskrelayctl" +version = "1.0" + +[project.scripts] +flaskrelayctl = "server:main" diff --git a/hosts/gnuslashprinter/resources/flaskrelayctl/server/__init__.py b/hosts/gnuslashprinter/resources/flaskrelayctl/server/__init__.py new file mode 100644 index 0000000..f2c0bc3 --- /dev/null +++ b/hosts/gnuslashprinter/resources/flaskrelayctl/server/__init__.py @@ -0,0 +1,54 @@ +from flask import Flask, jsonify +import serial +import os + +app = Flask(__name__) + +RELAY_DEV = os.environ.get("RELAYCTL_DEV", "/dev/ttyUSB0") +RELAY_HOST = os.environ.get("RELAYCTL_HOST", "127.0.0.1") +RELAY_PORT = os.environ.get("RELAYCTL_PORT", "5050") +RELAY_BAUD = 9600 +RELAY_ID = 1 # NOTE: multi relay boards are not supported (only relay id 1) + +def get_cmd(state: bool): + """ + LCUS relay 4-byte control command syntax is as follows: + start: always 0xA0 + relay: id of relay (counts from 1) + state: coil energized 0 or 1 + checksum: sum of previous 3 bytes + """ + start = 0xA0 + relay = RELAY_ID + state = int(state) + checksum = start + relay + state + return bytes((start, relay, state, checksum)) + +def get_serial(): + return serial.Serial(RELAY_DEV, RELAY_BAUD, timeout=1) + +@app.route("/on", methods=["GET", "POST"]) +def on(): + with get_serial() as ser: + ser.write(get_cmd(True)) + return jsonify({"state": "ON"}) + +@app.route("/off", methods=["GET", "POST"]) +def off(): + with get_serial() as ser: + ser.write(get_cmd(False)) + return jsonify({"state": "OFF"}) + +@app.route("/status", methods=["GET"]) +def status(): + with get_serial() as ser: + ser.write(bytes((0xFF,))) # write 0xFF to get status + r = ser.readline() + state = r.decode("utf-8").removeprefix("CH1: ").strip() + return jsonify({"state": state}) + +def main(): + app.run(host=RELAY_HOST, port=int(RELAY_PORT)) + +if __name__ == "__main__": + main() diff --git a/hosts/gnuslashprinter/resources/klipper/mcu/config b/hosts/gnuslashprinter/resources/klipper/mcu/config new file mode 100644 index 0000000..3e192a3 --- /dev/null +++ b/hosts/gnuslashprinter/resources/klipper/mcu/config @@ -0,0 +1,109 @@ +# CONFIG_LOW_LEVEL_OPTIONS is not set +# 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=y +# CONFIG_MACH_HC32F460 is not set +# CONFIG_MACH_RPXXXX 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_BOARD_DIRECTORY="stm32" +CONFIG_MCU="stm32f103xe" +CONFIG_CLOCK_FREQ=72000000 +CONFIG_SERIAL=y +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_STM32G474 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_STM32F1=y +CONFIG_HAVE_STM32_USBFS=y +CONFIG_STM32_USB_DOUBLE_BUFFER_TX=y +CONFIG_HAVE_STM32_CANBUS=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_CLOCK_REF_FREQ=8000000 +CONFIG_STM32F0_TRIM=16 +# CONFIG_STM32_USB_PA11_PA12 is not set +CONFIG_STM32_SERIAL_USART1=y +# CONFIG_STM32_CANBUS_PA11_PA12 is not set +# CONFIG_STM32_CANBUS_PA11_PB9 is not set +CONFIG_SERIAL_BAUD=250000 +CONFIG_USB_VENDOR_ID=0x1d50 +CONFIG_USB_DEVICE_ID=0x614e +CONFIG_USB_SERIAL_NUMBER="12345" +CONFIG_WANT_ADC=y +CONFIG_WANT_SPI=y +CONFIG_WANT_SOFTWARE_SPI=y +CONFIG_WANT_I2C=y +CONFIG_WANT_SOFTWARE_I2C=y +CONFIG_WANT_HARD_PWM=y +CONFIG_WANT_BUTTONS=y +CONFIG_WANT_TMCUART=y +CONFIG_WANT_NEOPIXEL=y +CONFIG_WANT_PULSE_COUNTER=y +CONFIG_WANT_ST7920=y +CONFIG_WANT_HD44780=y +CONFIG_WANT_ADXL345=y +CONFIG_WANT_LIS2DW=y +CONFIG_WANT_MPU9250=y +CONFIG_WANT_ICM20948=y +CONFIG_WANT_THERMOCOUPLE=y +CONFIG_WANT_HX71X=y +CONFIG_WANT_ADS1220=y +CONFIG_WANT_LDC1612=y +CONFIG_WANT_SENSOR_ANGLE=y +CONFIG_NEED_SENSOR_BULK=y +CONFIG_WANT_LOAD_CELL_PROBE=y +CONFIG_NEED_SOS_FILTER=y +CONFIG_CANBUS_FREQUENCY=1000000 +CONFIG_INLINE_STEPPER_HACK=y +CONFIG_HAVE_STEPPER_OPTIMIZED_BOTH_EDGE=y +CONFIG_WANT_STEPPER_OPTIMIZED_BOTH_EDGE=y +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_STRICT_TIMING=y +CONFIG_HAVE_CHIPID=y +CONFIG_HAVE_BOOTLOADER_REQUEST=y diff --git a/hosts/gnuslashprinter/resources/klipper/printer.cfg b/hosts/gnuslashprinter/resources/klipper/printer.cfg new file mode 100644 index 0000000..4baba56 --- /dev/null +++ b/hosts/gnuslashprinter/resources/klipper/printer.cfg @@ -0,0 +1,180 @@ +# This file contains pin mappings for the stock 2020 Creality Ender 3 +# V2. 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. + +# See docs/Config_Reference.md for a description of parameters. + +[include mainsail.cfg] + +# Default V2 config +[stepper_x] +step_pin: PC2 +dir_pin: PB9 +enable_pin: !PC3 +microsteps: 16 +rotation_distance: 40 +endstop_pin: ^PA5 +position_endstop: -20 +position_min: -20 +position_max: 235 +homing_speed: 50 + +[stepper_y] +step_pin: PB8 +dir_pin: PB7 +enable_pin: !PC3 +microsteps: 16 +rotation_distance: 40 +endstop_pin: ^PA6 +position_endstop: -8 +position_min: -8 +position_max: 235 +homing_speed: 50 + +[stepper_z] +step_pin: PB6 +dir_pin: !PB5 +enable_pin: !PC3 +microsteps: 16 +rotation_distance: 8 +endstop_pin: probe:z_virtual_endstop +#position_endstop: 0.0 +position_min: -5 +position_max: 250 + +[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: 21.527 +pid_Ki: 1.063 +pid_Kd: 108.982 +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 50 degree Celsius target +pid_Kp: 54.027 +pid_Ki: 0.770 +pid_Kd: 948.182 +min_temp: 0 +max_temp: 130 + +[fan] +pin: PA0 + +[mcu] +serial: /dev/gsp-control +restart_method: command + +[printer] +kinematics: cartesian +max_velocity: 300 +max_accel: 3000 +max_z_velocity: 5 +max_z_accel: 100 + +###################################################################### +# 128x64 Full Graphic Creality CR10 / ENDER 3 stockdisplay +###################################################################### + +# This section is used for a Creality "12864" display with a single +# ribbon cable between the display's EXP3 plug and the +# micro-controller board's EXP1 connector. + +[display] +lcd_type: st7920 +cs_pin: EXP1_7 +sclk_pin: EXP1_6 +sid_pin: EXP1_8 +encoder_pins: ^EXP1_5, ^EXP1_3 +click_pin: ^!EXP1_2 + +[output_pin beeper] +pin: EXP1_1 + +[board_pins] +aliases: + EXP1_1=PC6,EXP1_3=PB10,EXP1_5=PB14,EXP1_7=PB12,EXP1_9=<GND>, + EXP1_2=PB2,EXP1_4=PB11,EXP1_6=PB13,EXP1_8=PB15,EXP1_10=<5V>, + PROBE_IN=PB1,PROBE_OUT=PB0,FIL_RUNOUT=PA6 + +[display_status] + +###### +# Bed leveling + +[bltouch] +sensor_pin: ^PROBE_IN +control_pin: PROBE_OUT +x_offset: -40 +y_offset: -12 +#z_offset: 1.1 +probe_with_touch_mode: true +stow_on_each_sample: false + +[bed_mesh] +speed: 120 +mesh_min: 10, 10 +mesh_max: 195, 220 +probe_count: 5,5 +algorithm: bicubic + +[safe_z_home] +home_xy_position: 157.5, 129.5 +speed: 75 +z_hop: 10 +z_hop_speed: 5 +move_to_previous: true + + +#*# <---------------------- SAVE_CONFIG ----------------------> +#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. +#*# +#*# [bed_mesh default] +#*# version = 1 +#*# points = +#*# -0.017500, 0.025000, 0.050000, 0.122500, 0.155000 +#*# -0.045000, -0.040000, 0.037500, 0.102500, 0.145000 +#*# -0.007500, -0.032500, 0.005000, 0.092500, 0.132500 +#*# -0.060000, -0.045000, -0.007500, 0.087500, 0.127500 +#*# 0.075000, 0.042500, 0.015000, 0.105000, 0.175000 +#*# x_count = 5 +#*# y_count = 5 +#*# mesh_x_pps = 2 +#*# mesh_y_pps = 2 +#*# algo = bicubic +#*# tension = 0.2 +#*# min_x = 10.0 +#*# max_x = 195.0 +#*# min_y = 10.0 +#*# max_y = 220.0 +#*# +#*# [bltouch] +#*# z_offset = 1.342 diff --git a/hosts/optiplex/configuration.nix b/hosts/optiplex/configuration.nix index 4c66de5..74d09b5 100644 --- a/hosts/optiplex/configuration.nix +++ b/hosts/optiplex/configuration.nix @@ -1,8 +1,4 @@ { config, lib, pkgs, home-manager, ... }: { - imports = [ - ./g610.nix - ]; - # Setup bootloader boot._loader.enable = true; @@ -50,7 +46,6 @@ enable = true; home.enable = true; home.automount = true; - office.enable = true; }; }; @@ -59,13 +54,16 @@ # Allow unfree for nvidia + others nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "nvidia-x11" + "blackmagic-desktop-video" + "decklink" + "nvidia-kernel-modules" "nvidia-settings" + "nvidia-x11" "spotify" "steam" "steam-original" - "steam-unwrapped" "steam-run" + "steam-unwrapped" ]; # Install more software @@ -84,10 +82,14 @@ powerManagement.enable = false; # Can cause bugs nvidiaSettings = true; open = false; # Not compatible w/ GTX-1050 - package = config.boot.kernelPackages.nvidiaPackages.stable; # Still good for 1050 + package = config.boot.kernelPackages.nvidiaPackages.legacy_580; forceFullCompositionPipeline = true; # Enables vsync }; + # Enable decklink support for intensity pro + services._decklink.enable = true; + services._decklink.decklinkSupport.enable = true; + # Configure home home-manager.users.timmy = { gtk._mintTheme = { diff --git a/nixos/decklink.nix b/nixos/decklink.nix new file mode 100644 index 0000000..d86fde3 --- /dev/null +++ b/nixos/decklink.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, ... }: let + cfg = config.services._decklink; +in { + options.services._decklink = { + enable = lib.mkEnableOption "enables decklink support"; + decklinkSupport.enable = lib.mkEnableOption "enable decklinkSupport flag for all packages that support it by default"; + }; + + config = lib.mkIf cfg.enable { + # Kernel modules + hardware.decklink.enable = true; + + # DesktopVideoHelper + environment.systemPackages = [ pkgs.blackmagic-desktop-video ]; + + # Enable decklinkSupport flag globally for all packages that support it (e.g. obs) + nixpkgs.overlays = [ + (final: prev: { decklinkSupport = cfg.decklinkSupport.enable; }) + ]; + }; +} diff --git a/nixos/default.nix b/nixos/default.nix index fe61320..ff7713e 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -15,6 +15,7 @@ #./services/mainsail.nix ./bootloader.nix + ./decklink.nix ./doas.nix ./filesystems.nix ./geoclue.nix diff --git a/pkgs/st/overrides.nix b/pkgs/st/overrides.nix index 15a35a9..744cbf8 100644 --- a/pkgs/st/overrides.nix +++ b/pkgs/st/overrides.nix @@ -9,7 +9,7 @@ final: prev: { }; makeFlags = previousAttrs.makeFlags ++ [ "CFLAGS=-Ofast" ]; - buildInputs = with prev.pkgs.xorg; previousAttrs.buildInputs ++ [ libXcursor libXext ]; + buildInputs = with prev.pkgs; previousAttrs.buildInputs ++ [ libxcursor libxext ]; meta = with prev.lib; previousAttrs.meta // { homepage = "https://git.tjkeller.xyz/st"; diff --git a/users/timmy/home.nix b/users/timmy/home.nix index 77934bc..8464296 100644 --- a/users/timmy/home.nix +++ b/users/timmy/home.nix @@ -9,12 +9,12 @@ download = "${home}/dls"; documents = "${home}/docs"; pictures = "${home}/pics"; + projects = "${home}/docs/src"; # Set these as null so they're not created music = null; publicShare = null; templates = null; videos = null; - #projects = "${home}/docs/src" }; in { options._users.${username}.home = { @@ -29,7 +29,7 @@ in { home = { username = username; homeDirectory = home; - stateVersion = "24.05"; + stateVersion = "26.05"; }; # Setup userdirs @@ -68,12 +68,12 @@ in { # Setup neovim programs._neovim = { enable = true; - package = pkgs.unstable.neovim; viAlias = true; vimAlias = true; plugins = { lsp = { enable = lib.mkDefault true; + lspconfig.enable = true; languageServers.packages = with pkgs; [ python313Packages.python-lsp-server svelte-language-server @@ -82,12 +82,9 @@ in { vscode-langservers-extracted ]; }; - treesitter = let - allTSParserPackages = builtins.filter lib.isDerivation - (builtins.attrValues pkgs.vimPlugins.nvim-treesitter-parsers); - in { + treesitter = { enable = lib.mkDefault true; - parsers.packages = allTSParserPackages; + parsers.installAll = lib.mkDefault true; }; packages.start = with pkgs.vimPlugins; [ autoclose-nvim @@ -96,7 +93,7 @@ in { minitab-nvim nvim-colorizer-lua nvim-ts-autotag # depends on treesitter - pkgs.unstable.vimPlugins.rainbow-delimiters-nvim # depends on treesitter + rainbow-delimiters-nvim # depends on treesitter snacks-nvim ]; }; diff --git a/users/timmy/hosts.nix b/users/timmy/hosts.nix index 16d9619..970b9d8 100644 --- a/users/timmy/hosts.nix +++ b/users/timmy/hosts.nix @@ -1,8 +1,6 @@ { networking.hosts = { - "192.168.1.9" = [ "optiplex" ]; - "192.168.1.30" = [ "localgit" ]; - "192.168.1.11" = [ "truenas-home" ]; + "192.168.1.1" = [ "poweredge" ]; # TODO remove once poweredge serves this override correctly "192.168.77.11" = [ "truenas-office" ]; "192.168.77.8" = [ "publicgit" "tjkeller" ]; "192.168.77.3" = [ "devel" ]; diff --git a/users/timmy/nas.nix b/users/timmy/nas.nix index 8fa28c3..bacb0f0 100644 --- a/users/timmy/nas.nix +++ b/users/timmy/nas.nix @@ -21,10 +21,9 @@ in { config = lib.mkIf cfg.enable { fileSystems = lib.optionalAttrs cfg.home.enable { - "/media/Storage/Media" = mkNetworkFileSystem "truenas-home:/mnt/Storage/Media" cfg.home.automount; - "/media/Storage/Backups" = mkNetworkFileSystem "truenas-home:/mnt/Storage/Backups" cfg.home.automount; - "/media/Storage/Tapes" = mkNetworkFileSystem "truenas-home:/mnt/Storage/Backups/Tapes" cfg.home.automount; - "/media/Family Photos" = mkNetworkFileSystem "truenas-home:/mnt/Media/Photos" cfg.home.automount; + "/media/ingens/backups" = mkNetworkFileSystem "poweredge:/media/ingens/backups" cfg.home.automount; + "/media/ingens/tapes" = mkNetworkFileSystem "poweredge:/media/ingens/tapes" cfg.home.automount; + "/media/ingens/pictures" = mkNetworkFileSystem "poweredge:/media/ingens/pictures" cfg.home.automount; } // lib.optionalAttrs cfg.office.enable { "/media/chexx/chexx" = mkNetworkFileSystem "truenas-office:/mnt/Storage/chexx" cfg.office.automount; "/media/chexx/tkdocs" = mkNetworkFileSystem "truenas-office:/mnt/Storage/Users/Tim-Keller" cfg.office.automount; diff --git a/users/timmy/printing.nix b/users/timmy/printing.nix index d5cceab..9dbba29 100644 --- a/users/timmy/printing.nix +++ b/users/timmy/printing.nix @@ -3,7 +3,7 @@ # Printer drivers services.printing.drivers = [ pkgs.epson-escpr2 - pkgs.workcentre-7800-series + #pkgs.workcentre-7800-series ]; # Scanning programs @@ -14,7 +14,7 @@ # Printers networking.hosts = { "192.168.1.35" = [ "Epson_ET-8500" ]; - "192.168.77.40" = [ "Xerox_WorkCentre_7855" ]; + #"192.168.77.40" = [ "Xerox_WorkCentre_7855" ]; }; # Add printers to cups |
