add bambu!

This commit is contained in:
2026-04-20 14:28:12 +09:00
parent e20fd1dd81
commit ff46f6b509
8 changed files with 177 additions and 31 deletions

View File

@@ -1,18 +1,32 @@
# Edit this configuration file to define what should be installed on your system. Help is available in the configuration.nix(5) man page, on # Edit this configuration file to define what should be installed on your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, inputs, ... }: {
config,
lib,
pkgs,
inputs,
...
}:
let let
myRizin = pkgs.rizin.passthru.withPlugins myRizin = pkgs.rizin.passthru.withPlugins (plugins: [
(plugins: [ plugins.jsdec plugins.rz-ghidra ]); plugins.jsdec
in { plugins.rz-ghidra
]);
in
{
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./services/virtual.nix ./services/virtual.nix
./services/x.nix ./services/x.nix
./services/timer.nix ./services/timer.nix
./services/sound.nix ./services/sound.nix
./services/ollama.nix
];
nixpkgs.overlays = [
(import ./overlays/bambu-studio.nix)
]; ];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@@ -24,11 +38,31 @@ in {
''; '';
}; };
networking.bridges."lxcbr0".interfaces = [ ];
networking.interfaces."lxcbr0".ipv4.addresses = [
{
address = "10.0.3.1";
prefixLength = 24;
}
];
services.netbird.enable = true;
# Enable NAT so the container can reach the Debian repos
networking.nat = {
enable = true;
internalInterfaces = [ "lxcbr0" ];
externalInterface = "enp5s0"; # Check 'ip link' for your actual interface name
};
services.resolved = { services.resolved = {
enable = true; enable = true;
dnssec = "true"; dnssec = "true";
}; };
networking.nameservers = [ "1.1.1.1" "8.8.8.8" ]; networking.nameservers = [
"1.1.1.1"
"8.8.8.8"
];
boot.loader = { boot.loader = {
systemd-boot.enable = false; systemd-boot.enable = false;
@@ -51,18 +85,22 @@ in {
enable = true; enable = true;
extraRules = [ extraRules = [
{ {
users = ["allen"]; users = [ "allen" ];
commands = [{ commands = [
{
command = "/run/current-system/sw/bin/systemctl reboot --force"; command = "/run/current-system/sw/bin/systemctl reboot --force";
options = [ "NOPASSWD" ]; options = [ "NOPASSWD" ];
}]; }
];
} }
{ {
commands = [{ commands = [
{
command = "${pkgs.grub2}/bin/grub-reboot"; command = "${pkgs.grub2}/bin/grub-reboot";
options = [ "NOPASSWD" ]; options = [ "NOPASSWD" ];
}]; }
];
groups = [ "wheel" ]; groups = [ "wheel" ];
} }
]; ];
@@ -97,10 +135,18 @@ in {
time.timeZone = "Asia/Seoul"; time.timeZone = "Asia/Seoul";
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
i18n.supportedLocales = [
"en_US.UTF-8/UTF-8"
];
i18n.inputMethod = { i18n.inputMethod = {
type = "fcitx5"; type = "fcitx5";
enable = true; enable = true;
fcitx5.addons = with pkgs; [ fcitx5-gtk fcitx5-hangul ]; fcitx5.addons = with pkgs; [
fcitx5-gtk
fcitx5-hangul
];
}; };
# console = { # console = {
# font = "Lat2-Terminus16"; # font = "Lat2-Terminus16";
@@ -108,7 +154,13 @@ in {
# useXkbConfig = true; # use xkb.options in tty. # useXkbConfig = true; # use xkb.options in tty.
# }; # };
services.udev.packages = with pkgs; [ libwacom rtl-sdr platformio-core.udev ]; services.udev.packages = with pkgs; [
libwacom
rtl-sdr
platformio-core.udev
];
services.flatpak.enable = true;
services.usbmuxd = { services.usbmuxd = {
enable = false; enable = false;
@@ -123,8 +175,13 @@ in {
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users.allen = { users.users.allen = {
isNormalUser = true; isNormalUser = true;
extraGroups = extraGroups = [
[ "wheel" "wireshark" "podman" "dialout" ]; # Enable sudo for the user. "wheel"
"incus-admin"
"wireshark"
"podman"
"dialout"
]; # Enable sudo for the user.
shell = pkgs.nushell; shell = pkgs.nushell;
home = "/home/allen"; home = "/home/allen";
packages = with pkgs; [ tree ]; packages = with pkgs; [ tree ];
@@ -164,15 +221,27 @@ in {
libgit2 libgit2
ntfs3g ntfs3g
inputs.helix.packages."${pkgs.system}".helix inputs.helix.packages."${pkgs.system}".helix
bambu-studio
]; ];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
programs.hyprland.enable = true; programs.hyprland.enable = true;
environment.variables = { environment.variables = {
LD_LIBRARY_PATH = lib.makeLibraryPath LD_LIBRARY_PATH = lib.makeLibraryPath (
(with pkgs; [ libglvnd libGL glfw pulseaudio libgit2 ]); with pkgs;
[
libglvnd
libGL
glfw
pulseaudio
libgit2
]
);
}; };
environment.variables.EDITOR = "vim"; environment.variables.EDITOR = "vim";
@@ -184,5 +253,3 @@ in {
system.stateVersion = "25.05"; # Did you read the comment? system.stateVersion = "25.05"; # Did you read the comment?
} }

32
overlays/bambu-studio.nix Normal file
View File

@@ -0,0 +1,32 @@
final: prev: {
bambu-studio = prev.appimageTools.wrapType2 rec {
name = "BambuStudio";
pname = "bambu-studio";
version = "02.06.00.51";
ubuntu_version = "24.04";
src = prev.fetchurl {
url = "https://github.com/bambulab/BambuStudio/releases/download/v02.06.00.51/BambuStudio_ubuntu-24.04-v02.06.00.51-20260417160415.AppImage";
sha256 = "sha256-CYePefJ7FXcAK+OXsIaNRHkml18BA7um4W2+f6l49zQ=";
};
profile = ''
export SSL_CERT_FILE="${prev.cacert}/etc/ssl/certs/ca-bundle.crt"
export GIO_MODULE_DIR="${prev.glib-networking}/lib/gio/modules/"
'';
extraPkgs =
pkgs: with pkgs; [
cacert
glib
glib-networking
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
webkitgtk_4_1
# Common missing deps for Bambu/Orca AppImages:
libsecret
git
];
};
}

View File

@@ -2,7 +2,8 @@
{ pkgs, ... }: { pkgs, ... }:
with pkgs; [ with pkgs;
[
zathura zathura
google-chrome google-chrome
speed-cloudflare-cli speed-cloudflare-cli
@@ -70,6 +71,6 @@ with pkgs; [
gource gource
iaito iaito
qgis
orca-slicer orca-slicer
netbird-ui
] ]

View File

@@ -2,7 +2,8 @@
{ pkgs, ... }: { pkgs, ... }:
with pkgs; [ with pkgs;
[
neofetch neofetch
nnn # terminal file manager nnn # terminal file manager
nushell nushell
@@ -102,4 +103,7 @@ with pkgs; [
nwg-displays nwg-displays
ripdrag ripdrag
node-gyp node-gyp
tmux
pev
virtiofsd
] ]

32
services/ollama.nix Normal file
View File

@@ -0,0 +1,32 @@
{ config, pkgs, ... }:
{
systemd.services.my-ollama = {
description = "Custom Ollama-like Service";
# Ensure the service starts after the network is up
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
# Environment variables
environment = {
OLLAMA_KV_CACHE_TYPE = "q8_0";
OLLAMA_NUM_GPU = "1";
GGML_CUDA_ENABLE_UNIFIED_MEMORY = "1";
OLLAMA_KEEP_ALIVE = "-1";
OLLAMA_MODELS = "/mnt/ssd1/ollama";
OLLAMA_NUM_PARALLEL = "4";
# Adding CUDA paths for NixOS
LD_LIBRARY_PATH = "/run/opengl-driver/lib:/run/cudatoolkit/lib";
};
serviceConfig = {
# Use the package reference so Nix finds the correct path
ExecStart = "/usr/bin/ollama serve";
# Recommended security/reliability settings
Restart = "always";
User = "root"; # Or a specific user if permissions allow
};
};
}

View File

@@ -1,6 +1,7 @@
# container and vm config # container and vm config
{ ... }: { { ... }:
{
virtualisation = { virtualisation = {
containers.enable = true; containers.enable = true;
podman = { podman = {
@@ -11,6 +12,9 @@
}; };
libvirtd.enable = true; libvirtd.enable = true;
spiceUSBRedirection.enable = true; spiceUSBRedirection.enable = true;
incus.enable = true;
lxc.enable = true;
}; };
programs.virt-manager.enable = true; programs.virt-manager.enable = true;

View File

@@ -5,7 +5,12 @@
services.xserver.enable = true; services.xserver.enable = true;
services.xserver.wacom.enable = true; services.xserver.wacom.enable = true;
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.open = false;
hardware.nvidia = {
open = false;
modesetting.enable = true;
powerManagement.enable = false;
};
xdg.portal = { xdg.portal = {
enable = true; enable = true;

View File

@@ -10,6 +10,7 @@ $env.KUBECONFIG = ("/home/allen/.kube/config")
$env.PATH = ($env.PATH | append "/home/allen/.local/share/pnpm") $env.PATH = ($env.PATH | append "/home/allen/.local/share/pnpm")
$env.PATH = ($env.PATH | append "/home/allen/.local/bin") $env.PATH = ($env.PATH | append "/home/allen/.local/bin")
$env.PATH = ($env.PATH | append "/home/allen/.cargo/bin") $env.PATH = ($env.PATH | append "/home/allen/.cargo/bin")
$env.PATH = ($env.PATH | append "/usr/bin")
alias c = clear alias c = clear
alias rb = sudo nixos-rebuild switch --flake ~/nixos-config# alias rb = sudo nixos-rebuild switch --flake ~/nixos-config#