diff --git a/configuration.nix b/configuration.nix index 1dbfe07..8244e47 100644 --- a/configuration.nix +++ b/configuration.nix @@ -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 # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). -{ config, lib, pkgs, inputs, ... }: +{ + config, + lib, + pkgs, + inputs, + ... +}: let - myRizin = pkgs.rizin.passthru.withPlugins - (plugins: [ plugins.jsdec plugins.rz-ghidra ]); -in { + myRizin = pkgs.rizin.passthru.withPlugins (plugins: [ + plugins.jsdec + plugins.rz-ghidra + ]); +in +{ imports = [ ./hardware-configuration.nix ./services/virtual.nix ./services/x.nix ./services/timer.nix ./services/sound.nix + ./services/ollama.nix + ]; + + nixpkgs.overlays = [ + (import ./overlays/bambu-studio.nix) ]; 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 = { enable = 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 = { systemd-boot.enable = false; @@ -50,21 +84,25 @@ in { security.sudo = { enable = true; extraRules = [ - { - users = ["allen"]; - commands = [{ - command = "/run/current-system/sw/bin/systemctl reboot --force"; - options = [ "NOPASSWD" ]; - }]; - } + { + users = [ "allen" ]; + commands = [ + { + command = "/run/current-system/sw/bin/systemctl reboot --force"; + options = [ "NOPASSWD" ]; + } + ]; + } - { - commands = [{ + { + commands = [ + { command = "${pkgs.grub2}/bin/grub-reboot"; options = [ "NOPASSWD" ]; - }]; - groups = [ "wheel" ]; - } + } + ]; + groups = [ "wheel" ]; + } ]; }; @@ -97,10 +135,18 @@ in { time.timeZone = "Asia/Seoul"; i18n.defaultLocale = "en_US.UTF-8"; + + i18n.supportedLocales = [ + "en_US.UTF-8/UTF-8" + ]; + i18n.inputMethod = { type = "fcitx5"; enable = true; - fcitx5.addons = with pkgs; [ fcitx5-gtk fcitx5-hangul ]; + fcitx5.addons = with pkgs; [ + fcitx5-gtk + fcitx5-hangul + ]; }; # console = { # font = "Lat2-Terminus16"; @@ -108,7 +154,13 @@ in { # 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 = { enable = false; @@ -123,8 +175,13 @@ in { # Define a user account. Don't forget to set a password with ‘passwd’. users.users.allen = { isNormalUser = true; - extraGroups = - [ "wheel" "wireshark" "podman" "dialout" ]; # Enable ‘sudo’ for the user. + extraGroups = [ + "wheel" + "incus-admin" + "wireshark" + "podman" + "dialout" + ]; # Enable ‘sudo’ for the user. shell = pkgs.nushell; home = "/home/allen"; packages = with pkgs; [ tree ]; @@ -164,15 +221,27 @@ in { libgit2 ntfs3g 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; environment.variables = { - LD_LIBRARY_PATH = lib.makeLibraryPath - (with pkgs; [ libglvnd libGL glfw pulseaudio libgit2 ]); + LD_LIBRARY_PATH = lib.makeLibraryPath ( + with pkgs; + [ + libglvnd + libGL + glfw + pulseaudio + libgit2 + ] + ); }; environment.variables.EDITOR = "vim"; @@ -184,5 +253,3 @@ in { system.stateVersion = "25.05"; # Did you read the comment? } - - diff --git a/overlays/bambu-studio.nix b/overlays/bambu-studio.nix new file mode 100644 index 0000000..4b5d66d --- /dev/null +++ b/overlays/bambu-studio.nix @@ -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 + ]; + }; +} diff --git a/pkgs/tools.nix b/pkgs/tools.nix index 7b2b09b..2b02b9d 100644 --- a/pkgs/tools.nix +++ b/pkgs/tools.nix @@ -2,7 +2,8 @@ { pkgs, ... }: -with pkgs; [ +with pkgs; +[ zathura google-chrome speed-cloudflare-cli @@ -70,6 +71,6 @@ with pkgs; [ gource iaito - qgis orca-slicer + netbird-ui ] diff --git a/pkgs/util.nix b/pkgs/util.nix index f03aff3..a56fa3b 100644 --- a/pkgs/util.nix +++ b/pkgs/util.nix @@ -2,7 +2,8 @@ { pkgs, ... }: -with pkgs; [ +with pkgs; +[ neofetch nnn # terminal file manager nushell @@ -102,4 +103,7 @@ with pkgs; [ nwg-displays ripdrag node-gyp + tmux + pev + virtiofsd ] diff --git a/services/ollama.nix b/services/ollama.nix new file mode 100644 index 0000000..93d1ca8 --- /dev/null +++ b/services/ollama.nix @@ -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 + }; + }; +} diff --git a/services/virtual.nix b/services/virtual.nix index d44c78a..f729499 100644 --- a/services/virtual.nix +++ b/services/virtual.nix @@ -1,6 +1,7 @@ # container and vm config -{ ... }: { +{ ... }: +{ virtualisation = { containers.enable = true; podman = { @@ -11,6 +12,9 @@ }; libvirtd.enable = true; spiceUSBRedirection.enable = true; + + incus.enable = true; + lxc.enable = true; }; programs.virt-manager.enable = true; diff --git a/services/x.nix b/services/x.nix index 583d193..7640d39 100644 --- a/services/x.nix +++ b/services/x.nix @@ -5,7 +5,12 @@ services.xserver.enable = true; services.xserver.wacom.enable = true; services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia.open = false; + + hardware.nvidia = { + open = false; + modesetting.enable = true; + powerManagement.enable = false; + }; xdg.portal = { enable = true; diff --git a/shell/nu/config.nu b/shell/nu/config.nu index 8dc0cd0..e310f07 100644 --- a/shell/nu/config.nu +++ b/shell/nu/config.nu @@ -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/bin") $env.PATH = ($env.PATH | append "/home/allen/.cargo/bin") +$env.PATH = ($env.PATH | append "/usr/bin") alias c = clear alias rb = sudo nixos-rebuild switch --flake ~/nixos-config#