diff --git a/flake.lock b/flake.lock index 3552742..4d215a5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,31 @@ { "nodes": { + "claude-code": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1775966787, + "narHash": "sha256-wq1rMcMxMK9ZBg8TsJkXxli9K4ey+C2qKKmRYphhbek=", + "owner": "sadjow", + "repo": "claude-code-nix", + "rev": "e128b713477ef9732a0b5d9bed155ff37c0bb5a4", + "type": "github" + }, + "original": { + "owner": "sadjow", + "repo": "claude-code-nix", + "type": "github" + } + }, "den": { "locked": { - "lastModified": 1774597022, - "narHash": "sha256-QEYG3SBlX35TDVV/wyBonrEDEK4Mr3dtXSfnzvM0lII=", + "lastModified": 1776059725, + "narHash": "sha256-ifB3mLiGlMTfRWrb5n2LvJnlepsierXi2WYz2cwogTo=", "owner": "vic", "repo": "den", - "rev": "b7f910ab47260c91a0ae8d55fa72cd2178ba2458", + "rev": "2c16b8ce58172599a21310ff5f004ad6a918f349", "type": "github" }, "original": { @@ -30,6 +49,24 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -37,11 +74,11 @@ ] }, "locked": { - "lastModified": 1774559029, - "narHash": "sha256-deix7yg3j6AhjMPnFDCmWB3f83LsajaaULP5HH2j34k=", + "lastModified": 1775425411, + "narHash": "sha256-KY6HsebJHEe5nHOWP7ur09mb0drGxYSzE3rQxy62rJo=", "owner": "nix-community", "repo": "home-manager", - "rev": "a0bb0d11514f92b639514220114ac8063c72d0a3", + "rev": "0d02ec1d0a05f88ef9e74b516842900c41f0f2fe", "type": "github" }, "original": { @@ -70,17 +107,17 @@ "inputs": { "niri-stable": "niri-stable", "niri-unstable": "niri-unstable", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-stable": "nixpkgs-stable", "xwayland-satellite-stable": "xwayland-satellite-stable", "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1774620721, - "narHash": "sha256-QucawBaJ6Rl5JWAXAbpouXM1MsvlzwCsPGl3zOwLtzw=", + "lastModified": 1775877135, + "narHash": "sha256-nAqtUMy22olwyiOJB0CASVrbu5XB5+43GjlbIJ1KuvQ=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "fb83d584532282f585cd02f3aa513e98b843e7e7", + "rev": "f943da038fd668d435c2d17916577f295faa8839", "type": "github" }, "original": { @@ -109,11 +146,11 @@ "niri-unstable": { "flake": false, "locked": { - "lastModified": 1774616418, - "narHash": "sha256-z+dLkAS4bqytIlOI4h2MnjBJrSP4d1Awx0n+IV5YA3Y=", + "lastModified": 1775561155, + "narHash": "sha256-TK2IrqQivRcwqJa0suZMbcsN17CtA8Uu0v7CDnLATb0=", "owner": "YaLTeR", "repo": "niri", - "rev": "8f48f56fe19918b5cfa02e5d68a47ebaf7bf3dee", + "rev": "599db847f857b8a7ff78ce02f15acab5d5d9fee1", "type": "github" }, "original": { @@ -124,27 +161,27 @@ }, "nixpkgs": { "locked": { - "lastModified": 1774386573, - "narHash": "sha256-4hAV26quOxdC6iyG7kYaZcM3VOskcPUrdCQd/nx8obc=", + "lastModified": 1775888245, + "narHash": "sha256-nwASzrRDD1JBEu/o8ekKYEXm/oJW6EMCzCRdrwcLe90=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9", + "rev": "13043924aaa7375ce482ebe2494338e058282925", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-stable": { "locked": { - "lastModified": 1774388614, - "narHash": "sha256-tFwzTI0DdDzovdE9+Ras6CUss0yn8P9XV4Ja6RjA+nU=", + "lastModified": 1775811116, + "narHash": "sha256-t+HZK42pB6N+i5RGbuy7Xluez/VvWbembBdvzsc23Ss=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1073dad219cb244572b74da2b20c7fe39cb3fa9e", + "rev": "54170c54449ea4d6725efd30d719c5e505f1c10e", "type": "github" }, "original": { @@ -154,13 +191,45 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs-unstable": { "locked": { - "lastModified": 1774388614, - "narHash": "sha256-tFwzTI0DdDzovdE9+Ras6CUss0yn8P9XV4Ja6RjA+nU=", + "lastModified": 1775710090, + "narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1073dad219cb244572b74da2b20c7fe39cb3fa9e", + "rev": "4c1018dae018162ec878d42fec712642d214fdfa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1775710090, + "narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4c1018dae018162ec878d42fec712642d214fdfa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1775811116, + "narHash": "sha256-t+HZK42pB6N+i5RGbuy7Xluez/VvWbembBdvzsc23Ss=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "54170c54449ea4d6725efd30d719c5e505f1c10e", "type": "github" }, "original": { @@ -172,12 +241,14 @@ }, "root": { "inputs": { + "claude-code": "claude-code", "den": "den", "flake-aspects": "flake-aspects", "home-manager": "home-manager", "import-tree": "import-tree", "niri-flake": "niri-flake", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", + "nixpkgs-unstable": "nixpkgs-unstable", "sops-nix": "sops-nix" } }, @@ -188,11 +259,11 @@ ] }, "locked": { - "lastModified": 1774303811, - "narHash": "sha256-fhG4JAcLgjKwt+XHbjs8brpWnyKUfU4LikLm3s0Q/ic=", + "lastModified": 1775971308, + "narHash": "sha256-VKp9bhVSm0bT6JWctFy06ocqxGGnWHi1NfoE90IgIcY=", "owner": "Mic92", "repo": "sops-nix", - "rev": "614e256310e0a4f8a9ccae3fa80c11844fba7042", + "rev": "31ac5fe5d015f76b54058c69fcaebb66a55871a4", "type": "github" }, "original": { @@ -201,6 +272,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "xwayland-satellite-stable": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index e944459..441de1b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,7 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; import-tree.url = "github:vic/import-tree"; flake-aspects.url = "github:vic/flake-aspects"; den.url = "github:vic/den"; @@ -13,6 +14,7 @@ url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + claude-code.url = "github:sadjow/claude-code-nix"; }; outputs = inputs: diff --git a/modules/_hardware/desktop-hardware.nix b/modules/_hardware/desktop-hardware.nix index 3174fb8..67f0b1c 100644 --- a/modules/_hardware/desktop-hardware.nix +++ b/modules/_hardware/desktop-hardware.nix @@ -10,7 +10,7 @@ boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; + boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; fileSystems."/" = diff --git a/modules/_home/default.nix b/modules/_home/default.nix index 30411ee..aa6d5db 100644 --- a/modules/_home/default.nix +++ b/modules/_home/default.nix @@ -1,13 +1,21 @@ -{ pkgs, ... }: { +{ inputs, pkgs, ... }: +let + claude-code = inputs.claude-code.packages.${pkgs.system}.default; +in { home.packages = with pkgs; [ firefox discord stremio-linux-shell + obsidian + kitty + qbittorrent + claude-code + mpv ]; home.sessionVariables = { - TERMINAL = "wezterm"; - XDG_TERMINAL_EMULATOR = "wezterm"; + TERMINAL = "kitty"; + XDG_TERMINAL_EMULATOR = "kitty"; }; programs.zsh = { diff --git a/modules/_home/niri.nix b/modules/_home/niri.nix index bb67302..c72b6b2 100644 --- a/modules/_home/niri.nix +++ b/modules/_home/niri.nix @@ -10,6 +10,37 @@ QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; XDG_MENU_PREFIX = "plasma-"; }; + + home.packages = with pkgs; [ + grim + slurp + satty + wl-clipboard + ]; + + home.file.".local/bin/screenshot" = { + executable = true; + text = '' + #!/usr/bin/env bash + MODE="''${1:-region}" + SAVE_DIR="$HOME/Images/screenshots" + mkdir -p "$SAVE_DIR" + FILENAME="$SAVE_DIR/$(date '+%Y%m%d-%H%M%S').png" + + case "$MODE" in + region) + grim -g "$(slurp)" -t ppm - | satty --filename - --output-filename "$FILENAME" --copy-command wl-copy --early-exit + ;; + screen) + grim -t ppm - | satty --filename - --output-filename "$FILENAME" --copy-command wl-copy --early-exit + ;; + monitor) + grim -o "$(niri msg focused-output | grep 'Output' | awk '{print $2}')" -t ppm - \ + | satty --filename - --output-filename "$FILENAME" --copy-command wl-copy --early-exit + ;; + esac + ''; + }; xdg.configFile."niri/config.kdl".text = '' // Modificadores: Mod = Super (tecla Windows) @@ -40,7 +71,7 @@ binds { // Aplicativos - Mod+Return { spawn "wezterm"; } + Mod+Return { spawn "kitty"; } Mod+D { spawn "fuzzel"; } Mod+Q { close-window; } @@ -78,8 +109,9 @@ XF86AudioMute { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; } // Screenshot - Print { screenshot; } - Mod+Print { screenshot-screen; } + Mod+Shift+S { spawn "bash" "-c" "$HOME/.local/bin/screenshot region"; } + Mod+Shift+Alt+S { spawn "bash" "-c" "$HOME/.local/bin/screenshot screen"; } + Mod+Shift+Ctrl+S { spawn "bash" "-c" "$HOME/.local/bin/screenshot monitor"; } } ''; } diff --git a/modules/_home/wezterm.nix b/modules/_home/wezterm.nix deleted file mode 100644 index 9d0231f..0000000 --- a/modules/_home/wezterm.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, ... }: { - programs.wezterm = { - enable = true; - package = pkgs.wezterm; - extraConfig = '' - local config = wezterm.config_builder() - - config.front_end = "OpenGL" - config.enable_tab_bar = false - config.max_fps = 60 - config.animation_fps = 60 - config.enable_wayland = true - - return config - ''; - }; - - # I'm not sure why, but this removes the annoying input - # delay from wezterm. - home.sessionVariables = { - __GL_SYNC_TO_VBLANK = "0"; - }; -} diff --git a/modules/androidcam.nix b/modules/androidcam.nix new file mode 100644 index 0000000..725f8dd --- /dev/null +++ b/modules/androidcam.nix @@ -0,0 +1,17 @@ +{ den, ... }: { + den.aspects.androidcam.nixos = { pkgs, ... }: { + boot.extraModulePackages = with pkgs.linuxPackages; [ v4l2loopback ]; + + boot.kernelModules = [ "v4l2loopback" ]; + + boot.extraModprobeConfig = '' + options v4l2loopback \ + devices=1 \ + video_nr=2 \ + card_label="DroidCam" \ + exclusive_caps=1 + ''; + + programs.droidcam.enable = true; + }; +} diff --git a/modules/core.nix b/modules/core.nix index 0be28a2..b5c2eaf 100644 --- a/modules/core.nix +++ b/modules/core.nix @@ -1,12 +1,14 @@ -{ den, ... }: { - den.aspects.core.nixos = { pkgs, ... }: { +{ den, inputs, ... }: { + den.aspects.core.nixos = { pkgs, ... }: + let + pkgs-unstable = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}; + in { nixpkgs.config.allowUnfree = true; nix = { settings = { experimental-features = [ "nix-command" "flakes" ]; - auto-optimise-store = true; - + auto-optimise-store = true; }; gc = { automatic = true; @@ -15,17 +17,25 @@ }; }; + zramSwap = { + enable = true; + algorithm = "zstd"; + memoryPercent = 300; + }; + services.xserver = { enable = false; xkb.layout = "en"; }; environment.systemPackages = with pkgs; [ - curl - wget - neovim + curl + wget + pkgs-unstable.neovim btop nixd + unrar + p7zip ]; networking.networkmanager.enable = true; diff --git a/modules/den.nix b/modules/den.nix index fc75163..4743162 100644 --- a/modules/den.nix +++ b/modules/den.nix @@ -35,6 +35,9 @@ den.aspects.desktop-specific den.aspects.dev den.aspects.secrets + den.aspects.steam + den.aspects.prismlauncher + den.aspects.androidcam ]; nixos = { system.stateVersion = "25.11"; @@ -58,6 +61,7 @@ useGlobalPkgs = true; useUserPackages = true; backupFileExtension = "backup"; + extraSpecialArgs = { inherit inputs; }; }; security.sudo.wheelNeedsPassword = false; }; @@ -67,7 +71,6 @@ ./_home/niri.nix ./_home/cursor.nix ./_home/git.nix - ./_home/wezterm.nix ./_home/mako.nix ./_home/dolphin.nix ./_home/theme.nix diff --git a/modules/desktop.nix b/modules/desktop.nix index 3c4e4f2..1e9aedd 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -27,13 +27,17 @@ services.xserver.videoDrivers = [ "nvidia" ]; boot = { - initrd.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; + initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ]; + initrd.kernelModules = [ ]; + kernelModules = [ "kvm-intel" "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; + initrd.compressor = "zstd"; kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ]; loader = { grub = { enable = true; device = "nodev"; efiSupport = true; + configurationLimit = 2; }; efi.canTouchEfiVariables = true; }; @@ -45,6 +49,8 @@ __GLX_VENDOR_LIBRARY_NAME = "nvidia"; MOZ_ENABLE_WAYLAND = "1"; MOZ_USE_XINPUT2 = "1"; + __GL_SYNC_TO_VBLANK = "0"; + __GL_MaxFramesAllowed = "1"; }; }; } diff --git a/modules/dev.nix b/modules/dev.nix index 40de75e..870b136 100644 --- a/modules/dev.nix +++ b/modules/dev.nix @@ -1,7 +1,45 @@ -{ den, pkgs, ... }: { - den.aspects.dev.nixos = { pkgs, ... }: { - environment.systemPackages = with pkgs; [ +{ den, inputs, pkgs, ... }: { + den.aspects.dev.nixos = { pkgs, ... }: + let + pkgs-unstable = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}; + in + { + environment.systemPackages = (with pkgs-unstable; [ + # Basic + gcc fzf - ]; + tree-sitter + # LSPs + bash-language-server # Bash + lua-language-server # lua + nixd # Nix + vscode-langservers-extracted # Json & CSS + yaml-language-server # Yaml + dockerfile-language-server # Docker + marksman # Markdown + clang-tools # C++ + jdt-language-server # Java + typescript-language-server # Typescript + pyright # Python + taplo # TOML and rust crates + sqls # SQL + astro-language-server # Astro + angular-language-server # Angular + vue-language-server # Vue + tailwindcss-language-server # Tailwind + # Extra + chafa + ripgrep + ]) ++ (with pkgs; [ + # Other + vimPlugins.blink-cmp + jetbrains.idea-community + aseprite + ]); + + programs.java = { + enable = true; + package = pkgs.jdk17; + }; }; } diff --git a/modules/niri.nix b/modules/niri.nix index 995a160..6d991e7 100644 --- a/modules/niri.nix +++ b/modules/niri.nix @@ -7,6 +7,8 @@ package = pkgs.niri; }; + programs.gpu-screen-recorder.enable = true; + environment.systemPackages = with pkgs; [ waybar fuzzel @@ -18,6 +20,7 @@ xdg-desktop-portal-gnome kdePackages.xdg-desktop-portal-kde xwayland-satellite + gpu-screen-recorder-gtk ]; xdg.portal = { diff --git a/modules/prismlauncher.nix b/modules/prismlauncher.nix new file mode 100644 index 0000000..f6feb3f --- /dev/null +++ b/modules/prismlauncher.nix @@ -0,0 +1,14 @@ +{ den, ...}: { + den.aspects.prismlauncher.nixos = { pkgs, ... }: { + environment.systemPackages = with pkgs; [ + (prismlauncher.override { + jdks = [ + temurin-bin-8 + temurin-bin-17 + temurin-bin-21 + temurin-bin-25 + ]; + }) + ]; + }; +} diff --git a/modules/steam.nix b/modules/steam.nix new file mode 100644 index 0000000..6faa1e3 --- /dev/null +++ b/modules/steam.nix @@ -0,0 +1,37 @@ +{ den, ... }: { + den.aspects.steam.nixos = { pkgs, ... }: { + programs.steam = { + enable = true; + + remotePlay.openFirewall = false; + dedicatedServer.openFirewall = false; + localNetworkGameTransfers.openFirewall = true; + gamescopeSession.enable = true; + protontricks.enable = true; + + extraCompatPackages = with pkgs; [ + proton-ge-bin + ]; + + # Extra packages that steam might need + extraPackages = with pkgs; [ + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + libkrb5 + keyutils + ]; + }; + + # Fonts for better game text rendering + fonts.packages = with pkgs; [ + liberation_ttf + wqy_zenhei + ]; + }; +}