me like nix
0

Configure Feed

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

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