# Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). { config, pkgs, inputs, ... }: let nvidia_grid_version = "535.288.01"; nvidia_grid_sha256 = "06jbq7hmzynrysxwac34sm0700137k2lliw789q1lkxb7dvzxyg7"; in { imports = [ # Include the results of the hardware scan. /etc/nixos/hardware-configuration.nix ]; # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; boot.kernelPackages = pkgs.linuxPackages_6_12; boot.blacklistedKernelModules = [ "nouveau" ]; boot.kernelModules = [ "uinput" ]; boot.supportedFilesystems = [ "nfs" ]; services.rpcbind.enable = true; # needed for NFS services.sunshine = { enable = true; autoStart = true; capSysAdmin = true; # Sunshine이 가상 입력을 제어하기 위해 필요 openFirewall = true; # Sunshine 포트(47984-48010) 자동 허용 }; # 2. XDG Desktop Portal 설정 (libei의 통로 역할을 합니다) xdg.portal = { enable = true; wlr.enable = true; # Sway(wlroots) 전용 포털 extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.libei # libei 패키지 명시적 포함 ]; config.common.default = "*"; }; # 3. 환경 변수 추가 (Sway가 libei를 인식하도록 함) environment.variables = { "LIBEI_SOCKET" = "1"; "WLR_LIBSEAT_BACKEND" = "seatd"; }; services.udev.extraRules = '' KERNEL=="uinput", GROUP="input", MODE="0666", OPTIONS+="static_node=uinput" ''; systemd.user.services.mango = { description = "mango Headless Session"; wantedBy = [ "default.target" ]; serviceConfig = { # Wayland 헤드리스 백엔드 강제 사용 Environment = [ "WLR_BACKENDS=headless" "WLR_LIBINPUT_NO_DEVICES=1" "WLR_LIBSEAT_BACKEND=libseat" "XDG_SESSION_TYPE=wayland" "XDG_CURRENT_DESKTOP=mango" ]; # Sway 실행 (가상 디스플레이 1개 생성) ExecStart = "dbus-run-session mango"; Restart = "always"; }; }; # 유저 세션이 로그아웃 되어도 서비스가 유지되도록 설정 users.users.bangae1.linger = true; systemd.mounts = [{ type = "nfs"; mountConfig = { Options = "noatime"; }; what = "192.168.0.137:/mnt/user1/book"; where = "/book"; }]; systemd.automounts = [{ wantedBy = [ "multi-user.target" ]; automountConfig = { TimeoutIdleSec = "600"; }; where = "/book"; }]; networking.hostName = "nixos"; # Define your hostname. networking.networkmanager.enable = true; # Set your time zone. time.timeZone = "Asia/Seoul"; # Select internationalisation properties. i18n.defaultLocale = "ko_KR.UTF-8"; i18n.extraLocaleSettings = { LC_ADDRESS = "ko_KR.UTF-8"; LC_IDENTIFICATION = "ko_KR.UTF-8"; LC_MEASUREMENT = "ko_KR.UTF-8"; LC_MONETARY = "ko_KR.UTF-8"; LC_NAME = "ko_KR.UTF-8"; LC_NUMERIC = "ko_KR.UTF-8"; LC_PAPER = "ko_KR.UTF-8"; LC_TELEPHONE = "ko_KR.UTF-8"; LC_TIME = "ko_KR.UTF-8"; }; # Configure keymap in X11 services.xserver.xkb = { layout = "us"; variant = ""; }; #services.displayManager.sddm.enable = true; #services.displayManager.sddm.wayland.enable = true; hardware.graphics.enable = true; # Required for graphics acceleration # 2. NVIDIA 드라이버 설정 services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { open = false; # GRID 드라이버 패키지 오버라이드 package = config.boot.kernelPackages.nvidiaPackages.stable.overrideAttrs (oldAttrs: { version = nvidia_grid_version; src = pkgs.fetchurl { url = "file:///home/bangae1/mango/NVIDIA-Linux-x86_64-${nvidia_grid_version}-grid.run"; sha256 = nvidia_grid_sha256; }; }); # GRID 기능을 위한 필수 설정 modesetting.enable = true; powerManagement.enable = false; }; boot.kernelParams = [ "nvidia.NVreg_EnableVideoMemorySelfRefresh=1" "nvidia.NVreg_OpenRm=0" ]; systemd.services.nvidia-gridd = { description = "NVIDIA Grid Daemon"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "forking"; # 드라이버 패키지 경로에서 gridd 바이너리를 찾아 실행합니다. ExecStart = "${config.hardware.nvidia.package}/bin/nvidia-gridd"; Restart = "on-failure"; }; }; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.bangae1 = { isNormalUser = true; description = "bangae1"; extraGroups = [ "networkmanager" "wheel" "input" "video" "seat" ]; packages = with pkgs; []; }; # Allow unfree packages nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. # wget code git unzip fish eza nfs-utils ydotool grim kime wlr-randr kitty sunshine ]; fonts.packages = with pkgs; [ nerd-fonts.jetbrains-mono ]; environment.etc."nvidia/gridd.conf".text = '' ServerAddress=192.168.0.216 ServerPort=443 FeatureType=1 ''; nix.settings.experimental-features = [ "nix-command" "flakes" ]; programs.firefox.enable = true; programs.fish.enable = true; programs.nano.nanorc = '' set tabsize 2 set tabstospaces ''; services.openssh.enable = true; system.stateVersion = "25.11"; # Did you read the comment? }