me like nix
0

Configure Feed

Select the types of activity you want to include in your feed.

1{ inputs, ... }: { 2 flake.modules.nixos.mira-extras = 3 { pkgs, config, lib, ... }: 4 let 5 bambu-studio = 6 let 7 pname = "bambu-studio"; 8 version = "02.05.02.51"; 9 10 src = pkgs.fetchurl { 11 url = "https://github.com/bambulab/BambuStudio/releases/download/v${version}/BambuStudio_ubuntu-24.04_v${version}-20260327222803.AppImage"; 12 hash = "sha256-tWda80M3cV5hztEoYkZVGabQMgg6pyc/OniPJfghN0Q="; 13 }; 14 15 appimage-contents = pkgs.appimageTools.extractType2 { 16 inherit src pname version; 17 }; 18 19 wrapped = pkgs.appimageTools.wrapType2 { 20 inherit src pname version; 21 22 profile = '' 23 export SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" 24 export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules/" 25 export __GLX_VENDOR_LIBRARY_NAME=nvidia 26 ''; 27 28 extraPkgs = 29 p: with p; [ 30 cacert 31 glib 32 glib-networking 33 gst_all_1.gst-plugins-bad 34 gst_all_1.gst-plugins-base 35 gst_all_1.gst-plugins-good 36 webkitgtk_4_1 37 ]; 38 }; 39 in 40 pkgs.runCommand "bambu-studio-${version}" { } '' 41 mkdir -p $out/bin 42 ln -s ${wrapped}/bin/${pname} $out/bin/bambu-studio 43 ln -s ${wrapped}/bin/${pname} $out/bin/BambuStudio 44 45 mkdir -p $out/share/applications 46 substitute ${appimage-contents}/BambuStudio.desktop $out/share/applications/BambuStudio.desktop \ 47 --replace-fail "Exec=AppRun" "Exec=$out/bin/BambuStudio" 48 49 if [ -d ${appimage-contents}/usr/share/icons ]; then 50 cp -r ${appimage-contents}/usr/share/icons $out/share/ 51 fi 52 ''; 53 in 54 { 55 networking.hostName = "mira"; 56 57 fileSystems."/".options = [ "noatime" ]; 58 fileSystems."/boot".options = [ "noatime" ]; 59 60 boot.tmp.useTmpfs = true; 61 62 zramSwap = { 63 enable = true; 64 memoryPercent = 50; 65 }; 66 67 boot.kernel.sysctl = { 68 "vm.swappiness" = 10; 69 "vm.dirty_background_ratio" = 5; 70 "vm.dirty_ratio" = 10; 71 }; 72 73 services.fstrim.enable = true; 74 75 # NVMe drives manage their own I/O queuing; mq-deadline adds unnecessary latency 76 services.udev.extraRules = '' 77 ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="none" 78 ''; 79 80 # Enable QEMU emulation for aarch64 (for building Pi images) 81 boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; 82 83 # Prevent NetworkManager from managing USB Ethernet 84 networking.networkmanager.unmanaged = [ "interface-name:enp0s20f0u4u3" ]; 85 86 # Avahi (mDNS discovery) 87 services.avahi = { 88 enable = true; 89 nssmdns4 = true; 90 openFirewall = true; 91 }; 92 93 services.copyparty.enable = true; 94 95 # SSH 96 services.openssh = { 97 enable = true; 98 settings = { 99 PasswordAuthentication = false; 100 KbdInteractiveAuthentication = false; 101 PermitRootLogin = "no"; 102 AllowUsers = [ "sean" ]; 103 }; 104 }; 105 106 # trmnl-rs server 107 systemd.services.trmnl-rs = { 108 description = "TRMNL Server"; 109 wantedBy = [ "multi-user.target" ]; 110 wants = [ "network-online.target" ]; 111 after = [ 112 "network-online.target" 113 "nss-lookup.target" 114 ]; 115 environment = { 116 RUST_LOG = "info,tower_http=debug"; 117 }; 118 serviceConfig = { 119 ExecStart = "${inputs.trmnl-rs.packages.x86_64-linux.default}/bin/server"; 120 Restart = "on-failure"; 121 RestartSec = 5; 122 DynamicUser = true; 123 StateDirectory = "trmnl-rs"; 124 WorkingDirectory = "/var/lib/trmnl-rs"; 125 }; 126 }; 127 128 environment.systemPackages = [ 129 pkgs.lm_sensors 130 bambu-studio 131 ]; 132 133 # Firewall 134 networking.firewall.allowedTCPPorts = [ 135 8096 # jellyfin 136 5055 # jellyseer 137 3000 # vite dev port 138 3001 139 1883 # MQTT for Tasmota devices 140 2300 # trmnl 141 5000 # Frigate web UI 142 8971 # Frigate API 143 config.services.home-assistant.config.http.server_port 144 ]; 145 networking.firewall.allowedUDPPorts = [ ]; 146 147 system.stateVersion = "25.05"; 148 }; 149}