commit 60df66aab0c933e7e934125c9602602ebe622273 Author: emmatherock Date: Wed Jun 17 11:37:56 2026 -0300 nixos: initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..123d288 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# Nix build artifacts +result +result-* + +# Archivos temporales de editores +*.swp +*~ +.DS_Store + +# Logs de compilación o basura de Git +.direnv/ diff --git a/.vscode/mcp.json b/.vscode/mcp.json new file mode 100644 index 0000000..4ea4feb --- /dev/null +++ b/.vscode/mcp.json @@ -0,0 +1,8 @@ +{ + "servers": { + "nixos": { + "command": "uvx", + "args": ["mcp-nixos"] + } + } +} \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..cf6cb24 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1 @@ +Before suggesting NixOS/Home Manager options or package names, verify them with MCP-NixOS or official search.nixos.org. Do not invent option paths. \ No newline at end of file diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..211a69f --- /dev/null +++ b/configuration.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, apple-fonts, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ./secureboot.nix + ./maintenance.nix + ./users.nix + ./network.nix + ./desktop.nix + ./containers.nix + ]; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + plymouth.enable = true; + initrd.kernelModules = [ "amdgpu" ]; + kernelPackages = pkgs.linuxPackages_cachyos ; + kernelParams = [ "quiet" "splash" "boot.shell_on_fail" "loglevel=3" "iommu=pt" ]; + }; + + time.timeZone = "America/Argentina/Buenos_Aires"; + i18n.defaultLocale = "es_AR.UTF-8"; + + services.hardware.deepcool-digital-linux.enable = true; + + services.udev.extraRules = '' + # Intel RAPL energy usage file + ACTION=="add", SUBSYSTEM=="powercap", KERNEL=="intel-rapl:0", RUN+="${pkgs.coreutils}/bin/chmod 444 /sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj" + + # DeepCool HID raw devices + SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3633", MODE="0666" + + # CH510 MESH DIGITAL + SUBSYSTEM=="hidraw", ATTRS{idVendor}=="34d3", ATTRS{idProduct}=="1100", MODE="0666" + # Elgato 4K X (all speed modes) + SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="009b", MODE="0666", GROUP="plugdev" + SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="009c", MODE="0666", GROUP="plugdev" + SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="009d", MODE="0666", GROUP="plugdev" + + # Elgato 4K S (all speed modes) + SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="00af", MODE="0666", GROUP="plugdev" + SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="00ae", MODE="0666", GROUP="plugdev" + + # nvtop + SUBSYSTEM=="drm", KERNEL=="card*", SUBSYSTEMS=="pci", DRIVERS=="amdgpu", RUN+="/bin/sh -c 'chmod -R g+r /sys/class/drm/%k/device/'" + ''; + + nixpkgs.config.allowUnfree = true; + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + }; + + system.stateVersion = "25.11"; +} diff --git a/containers.nix b/containers.nix new file mode 100644 index 0000000..8e7ee30 --- /dev/null +++ b/containers.nix @@ -0,0 +1,70 @@ +{ pkgs, ... }: +{ + virtualisation = { + containers.enable = true; + podman = { + enable = true; + defaultNetwork.settings.dns_enabled = true; + }; + docker = { + enable = true; + storageDriver = "btrfs"; + daemon.settings = { + dns = [ "1.1.1.1" "8.8.8.8" ]; + }; + }; + }; + + systemd.services = { + init-docker-networks = { + description = "Crear redes globales de Docker si no existen"; + after = [ "docker.service" ]; + requires = [ "docker.service" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.docker}/bin/docker network inspect homelab_net >/dev/null 2>&1 || ${pkgs.docker}/bin/docker network create homelab_net'"; + }; + }; + docker-compose-tools = { + description = "Stack de Docker Compose: Tools"; + after = [ "docker.service" "network-online.target" "tailscaled.service" ]; + wants = [ "docker.service" "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + WorkingDirectory = "/mnt/containers/tools"; + ExecStart = "${pkgs.docker}/bin/docker compose up -d --remove-orphans"; + ExecStop = "${pkgs.docker}/bin/docker compose down"; + }; + }; + docker-compose-arrs = { + description = "Stack de Docker Compose: Arrs"; + after = [ "docker.service" "docker-compose-tools.service" "local-fs.target" ]; + wants = [ "docker.service" "docker-compose-tools.service" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + WorkingDirectory = "/mnt/containers/arrs"; + ExecStart = "${pkgs.docker}/bin/docker compose up -d --remove-orphans"; + ExecStop = "${pkgs.docker}/bin/docker compose down"; + }; + }; + docker-compose-gameservers = { + description = "Stack de Docker Compose: Gameservers"; + after = [ "docker.service" "docker-compose-tools.service" ]; + wants = [ "docker.service" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + WorkingDirectory = "/mnt/containers/gameserver"; + ExecStart = "${pkgs.docker}/bin/docker compose up -d --remove-orphans"; + ExecStop = "${pkgs.docker}/bin/docker compose down"; + }; + }; + }; +} diff --git a/desktop.nix b/desktop.nix new file mode 100644 index 0000000..726fb71 --- /dev/null +++ b/desktop.nix @@ -0,0 +1,126 @@ +{pkgs, apple-fonts, vscode-server, inputs, ... }: +{ + hardware.graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ + rocmPackages.clr.icd + ]; + }; + services.desktopManager.plasma6.enable = true; + services.displayManager = { + plasma-login-manager.enable = true; + sddm = { enable = true; wayland.enable = true; }; + autoLogin = { enable = true; user = "emmatherock"; }; + }; + security.pam.services.sddm.enableKwallet = true; + security.pam.services.login.enableKwallet = true; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + services.vscode-server.enable = true; + + fonts.packages = with pkgs; [ + noto-fonts noto-fonts-cjk-sans noto-fonts-color-emoji + nerd-fonts.fira-code nerd-fonts.jetbrains-mono + apple-fonts.packages.${pkgs.stdenv.hostPlatform.system}.sf-pro + apple-fonts.packages.${pkgs.stdenv.hostPlatform.system}.sf-mono + apple-fonts.packages.${pkgs.stdenv.hostPlatform.system}.ny + ]; + + environment.systemPackages = with pkgs; [ + # --- Base y Terminal --- + vim + git + wget + curl + fastfetch + (btop.override { cudaSupport = false; rocmSupport = true; }) + nvtopPackages.full + ethtool + zsh + fish + starship + gemini-cli + rocmPackages.rocm-smi + + # --- Herramientas de Sistema --- + btrfs-progs + kdePackages.partitionmanager + kdePackages.kalk + tailscale + distrobox + steam-run + localsend + inputs.lan-mouse.packages.${pkgs.stdenv.hostPlatform.system}.default + deskflow + + # --- Trabajo y Notas --- + (vscode-with-extensions.override { + vscodeExtensions = with vscode-extensions; [ + jnoortheen.nix-ide + ms-python.python + vscode-extensions.ms-dotnettools.csharp + vscode-extensions.ms-vscode.cpptools + vscode-extensions.golang.go + vscode-extensions.rust-lang.rust-analyzer + vscode-extensions.Google.gemini-cli-vscode-ide-companion + vscode-extensions.ms-azuretools.vscode-containers + ms-vscode-remote.remote-ssh + vscode-extensions.coolbear.systemd-unit-file + ]; + }) + obsidian + + # --- Multimedia y Comunicación --- + (discord.override { + # withOpenASAR = true; # can do this here too + withVencord = true; + }) + spotify + chatterino7 + plex-desktop + cider-2 + inputs.sidra.packages.${pkgs.stdenv.hostPlatform.system}.default + telegram-desktop + + # --- Audio y Video --- + carla + haruna + qpwgraph + pipewire + (pkgs.wrapOBS { + plugins = with pkgs.obs-studio-plugins; [ + obs-pipewire-audio-capture + obs-vkcapture + obs-composite-blur + obs-aitum-multistream + obs-vertical-canvas + ]; + }) + vlc + + # --- Gaming --- + faugus-launcher + plezy + protonplus + protontricks + proton-authenticator + mangohud + gamemode + cemu + ]; + + programs = { + firefox.enable = true; + fish.enable = true; + starship.enable = true; + steam = { enable = true; remotePlay.openFirewall = true; }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..42b42be --- /dev/null +++ b/flake.lock @@ -0,0 +1,628 @@ +{ + "nodes": { + "apple-fonts": { + "inputs": { + "ci": "ci", + "nixpkgs": "nixpkgs", + "ny": "ny", + "sf-arabic": "sf-arabic", + "sf-armenian": "sf-armenian", + "sf-compact": "sf-compact", + "sf-georgian": "sf-georgian", + "sf-hebrew": "sf-hebrew", + "sf-mono": "sf-mono", + "sf-pro": "sf-pro" + }, + "locked": { + "lastModified": 1780240721, + "narHash": "sha256-O5dSz9h4zRnYyGYTS0hfMamYEDutsEC1PzxQELdsttU=", + "owner": "Lyndeno", + "repo": "apple-fonts.nix", + "rev": "a11f7174137d4a0267bd8d7abd85da05bd9a41cc", + "type": "github" + }, + "original": { + "owner": "Lyndeno", + "repo": "apple-fonts.nix", + "type": "github" + } + }, + "blueprint": { + "inputs": { + "nixpkgs": [ + "apple-fonts", + "ci", + "nixpkgs" + ], + "systems": [ + "apple-fonts", + "ci" + ] + }, + "locked": { + "lastModified": 1776249299, + "narHash": "sha256-Dt9t1TGRmJFc0xVYhttNBD6QsAgHOHCArqGa0AyjrJY=", + "owner": "numtide", + "repo": "blueprint", + "rev": "56131e8628f173d24a27f6d27c0215eff57e40dd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, + "chaotic": { + "inputs": { + "flake-schemas": "flake-schemas", + "home-manager": "home-manager", + "jovian": "jovian", + "niks3": "niks3", + "nixpkgs": "nixpkgs_2", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1781537616, + "narHash": "sha256-xIymhdrUEJ1HXhprACY/st+m0uT9Y48uw7o68dMfJ+U=", + "owner": "chaotic-cx", + "repo": "nyx", + "rev": "b3e97bde839af37572c2dc5781a3e9006c70031a", + "type": "github" + }, + "original": { + "owner": "chaotic-cx", + "ref": "nyxpkgs-unstable", + "repo": "nyx", + "type": "github" + } + }, + "ci": { + "inputs": { + "blueprint": "blueprint", + "nixpkgs": [ + "apple-fonts", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1779849193, + "narHash": "sha256-Bc80n+fA3NtxqYHWcdb1XFuYLaV+yX2xnvDRnwAv4ak=", + "owner": "Lyndeno", + "repo": "ci", + "rev": "38cfa6f01bdaf91bc4ce44176b322bab2bb208a0", + "type": "github" + }, + "original": { + "owner": "Lyndeno", + "repo": "ci", + "type": "github" + } + }, + "crane": { + "locked": { + "lastModified": 1765145449, + "narHash": "sha256-aBVHGWWRzSpfL++LubA0CwOOQ64WNLegrYHwsVuVN7A=", + "owner": "ipetkov", + "repo": "crane", + "rev": "69f538cdce5955fcd47abfed4395dc6d5194c1c5", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1761588595, + "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-schemas": { + "locked": { + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.5.tar.gz" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "pre-commit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1781497404, + "narHash": "sha256-9GAF8sSsnkyCVCWkomXR0T+zdSxyUlfPt6neQidimdg=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1285cd3d6882a9847f2d56ed5541b3350c8a6162", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "jovian": { + "inputs": { + "nix-github-actions": [ + "chaotic" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1781344759, + "narHash": "sha256-S6UBeQM7NLaQX6RZYS65fMypWfRQL/F4iRu0y8sTLPc=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "ffac737e4117f7e9f070d38078801a5433f19d5b", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "lan-mouse": { + "inputs": { + "nixpkgs": "nixpkgs_3", + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1781517640, + "narHash": "sha256-zCFYzIGWm5ShL/dO/SxwyHCCDerWveLiWpoeGDWKLi4=", + "owner": "feschber", + "repo": "lan-mouse", + "rev": "d1f41180e3f18cbc66d69dae39917b2d705c9abc", + "type": "github" + }, + "original": { + "owner": "feschber", + "repo": "lan-mouse", + "type": "github" + } + }, + "lanzaboote": { + "inputs": { + "crane": "crane", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit": "pre-commit", + "rust-overlay": "rust-overlay_3" + }, + "locked": { + "lastModified": 1765382359, + "narHash": "sha256-RJmgVDzjRI18BWVogG6wpsl1UCuV6ui8qr4DJ1LfWZ8=", + "owner": "nix-community", + "repo": "lanzaboote", + "rev": "e8c096ade12ec9130ff931b0f0e25d2f1bc63607", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "v1.0.0", + "repo": "lanzaboote", + "type": "github" + } + }, + "niks3": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "treefmt-nix": [ + "chaotic" + ] + }, + "locked": { + "lastModified": 1781027181, + "narHash": "sha256-IHIUd1/lYTaS4ilHZNV6+x0fchxDpvUdMjwnnEBASu4=", + "owner": "Mic92", + "repo": "niks3", + "rev": "c74d275536d9a38ff279b498612fae0fd68cfe85", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "niks3", + "rev": "c74d275536d9a38ff279b498612fae0fd68cfe85", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1771848320, + "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2fc6539b481e1d2569f25f8799236694180c0993", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1781074563, + "narHash": "sha256-md8WlXOlfnIeHeOScMTTHFyf2d6iaTwPl2apR5EQ3P4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9ae611a455b90cf061d8f332b977e387bda8e1ca", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1772963539, + "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1781074563, + "narHash": "sha256-md8WlXOlfnIeHeOScMTTHFyf2d6iaTwPl2apR5EQ3P4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9ae611a455b90cf061d8f332b977e387bda8e1ca", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1682134069, + "narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fd901ef4bf93499374c5af385b2943f5801c0833", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "ny": { + "flake": false, + "locked": { + "narHash": "sha256-3257NAH4qlan2YHVLpNRy7x8IJqR2pal3OzFo/ykqXs=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/NY.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/NY.dmg" + } + }, + "pre-commit": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765016596, + "narHash": "sha256-rhSqPNxDVow7OQKi4qS5H8Au0P4S3AYbawBSmJNUtBQ=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "548fc44fca28a5e81c5d6b846e555e6b9c2a5a3c", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "apple-fonts": "apple-fonts", + "chaotic": "chaotic", + "lan-mouse": "lan-mouse", + "lanzaboote": "lanzaboote", + "nixpkgs": "nixpkgs_4", + "sidra": "sidra", + "vscode-server": "vscode-server" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1781493707, + "narHash": "sha256-lzf7qdQWuiY0T9VEbfH2CmP1LZQAYooU/sZuSgEJEBk=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "06f25b8e40805beb2121a4dae4cc37d6f981800f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { + "inputs": { + "nixpkgs": [ + "lan-mouse", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773025773, + "narHash": "sha256-Wik8+xApNfldpUFjPmJkPdg0RrvUPSWGIZis+A/0N1w=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "3c06fdbbd36ff60386a1e590ee0cd52dcd1892bf", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_3": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765075567, + "narHash": "sha256-KFDCdQcHJ0hE3Nt5Gm5enRIhmtEifAjpxgUQ3mzSJpA=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "769156779b41e8787a46ca3d7d76443aaf68be6f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "sf-arabic": { + "flake": false, + "locked": { + "narHash": "sha256-/0gjRimqvZyE60xYxxPdlU+7Q2LJnnvtbmwOP0YmS9U=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Arabic.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Arabic.dmg" + } + }, + "sf-armenian": { + "flake": false, + "locked": { + "narHash": "sha256-rRoDkbNMYkzOHZmQm96Zv80TZvRlAeoxkv4pMHP5nUg=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Armenian.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Armenian.dmg" + } + }, + "sf-compact": { + "flake": false, + "locked": { + "narHash": "sha256-oLhkN4HYkU1Xjxk+xdmyxJmROSzo1qd/tafdxw7icxs=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg" + } + }, + "sf-georgian": { + "flake": false, + "locked": { + "narHash": "sha256-IevVNOC28IiR45YfI3PsZzXLMRxuB5u7UiE53Zn6tRU=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Georgian.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Georgian.dmg" + } + }, + "sf-hebrew": { + "flake": false, + "locked": { + "narHash": "sha256-Dw84kYwMpCtKKKqm8cZcQ9TZ7GayU5MO7W0LJw0Rcwk=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Hebrew.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Hebrew.dmg" + } + }, + "sf-mono": { + "flake": false, + "locked": { + "narHash": "sha256-ICdHRFdNL7PM/fXJUzS7LgZxZiqcyIuCMHLze4En4vg=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg" + } + }, + "sf-pro": { + "flake": false, + "locked": { + "narHash": "sha256-s42hsaUe0Vkaw5yw8G7G3W3AYJb2TPqSlMqPyY0e5WU=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg" + } + }, + "sidra": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1781412000, + "narHash": "sha256-XxKL+f+2+mQ6zbw1Aszx8WuH12rLdUQvEL1YppbKap4=", + "owner": "wimpysworld", + "repo": "sidra", + "rev": "91665a8313d5ecf7c2e65e22bf7b029cc0d627bc", + "type": "github" + }, + "original": { + "owner": "wimpysworld", + "repo": "sidra", + "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" + } + }, + "vscode-server": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1770124655, + "narHash": "sha256-yHmd2B13EtBUPLJ+x0EaBwNkQr9LTne1arLVxT6hSnY=", + "owner": "nix-community", + "repo": "nixos-vscode-server", + "rev": "92ce71c3ba5a94f854e02d57b14af4997ab54ef0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-vscode-server", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f240b49 --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "NixOS con Kernel CachyOS (vía xddxdd)"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; + apple-fonts.url = "github:Lyndeno/apple-fonts.nix"; + sidra ={ + url = "github:wimpysworld/sidra"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + lanzaboote = { + url = "github:nix-community/lanzaboote/v1.0.0"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + lan-mouse.url = "github:feschber/lan-mouse"; + vscode-server.url = "github:nix-community/nixos-vscode-server"; + }; + + outputs = { self, nixpkgs, chaotic, apple-fonts, lanzaboote, lan-mouse, sidra, vscode-server, ... }@inputs: { + nixosConfigurations = { + miku-homelab = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + + specialArgs = { inherit apple-fonts inputs; }; + modules = [ + ./configuration.nix + lanzaboote.nixosModules.lanzaboote + vscode-server.nixosModules.default + chaotic.nixosModules.default + ]; + }; + }; + }; + nixConfig = { + extra-substituters = [ + "https://lan-mouse.cachix.org/" + ]; + extra-trusted-public-keys = [ + "lan-mouse.cachix.org-1:KlE2AEZUgkzNKM7BIzMQo8w9yJYqUpor1CAUNRY6OyM=" + ]; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..2e9609d --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,61 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/f67a5f9f-b31b-46f8-9026-6e276e5b0bb9"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/f67a5f9f-b31b-46f8-9026-6e276e5b0bb9"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/f67a5f9f-b31b-46f8-9026-6e276e5b0bb9"; + fsType = "btrfs"; + options = [ "subvol=@nix" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/64D0-FE2C"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + fileSystems."/mnt/containers" = { + device = "/dev/disk/by-uuid/350fedfa-fa0b-4941-a07e-cec4e817e566"; + fsType = "btrfs"; + options = [ "subvol=containers" "compress=zstd:1" "discard=async" "noatime" ]; + }; + + fileSystems."/mnt/ssd" = { + device = "/dev/disk/by-uuid/350fedfa-fa0b-4941-a07e-cec4e817e566"; + fsType = "btrfs"; + options = [ "subvol=ssd" "compress=zstd:1" "discard=async" "noatime" ]; + }; + + fileSystems."/mnt/data" = { + device = "/dev/disk/by-uuid/dbab8467-a044-4a44-a265-0f268971f3db"; + fsType = "btrfs"; + options = [ "subvol=data" "compress=zstd:1" "autodefrag" "noatime" "x-systemd.device-timeout=40s" ]; + }; + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/maintenance.nix b/maintenance.nix new file mode 100644 index 0000000..df282d7 --- /dev/null +++ b/maintenance.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: + +{ + # Optimización automática del storage (une archivos idénticos) + nix.settings.auto-optimise-store = true; + + # Garbage Collector automático + nix.gc = { + automatic = true; + dates = "weekly"; # Se ejecuta cada semana + options = "--delete-older-than 14d"; # Borra lo que tenga más de 2 semanas + }; + + # Opcional: Limpieza de logs de Systemd para que no crezcan infinito + services.journald.extraConfig = "SystemMaxUse=500M"; +} diff --git a/network.nix b/network.nix new file mode 100644 index 0000000..e8dd3f3 --- /dev/null +++ b/network.nix @@ -0,0 +1,67 @@ +{ config, pkgs, ... }: { + networking = { + hostName = "miku-homelab"; + networkmanager.enable = true; + firewall = { + enable = true; + allowedUDPPorts = [ config.services.tailscale.port 4242 49983 24800 26900 ]; + allowedTCPPorts = [ 22 4242 49983 24800 26900 ]; + }; + useDHCP = false; + interfaces.enp6s0.ipv4.addresses = [{ + address = "192.168.1.21"; + prefixLength = 24; + }]; + defaultGateway = "192.168.1.1"; + + # DNS rápidos para que la resolución de nombres sea instantánea + nameservers = [ "1.1.1.1" "8.8.8.8" ]; + }; + + services.tailscale.enable = true; + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + AllowUsers = [ "emmatherock" ]; + }; + }; + + services.samba = { + enable = true; + openFirewall = true; + settings = { + global = { + "vfs objects" = "acl_xattr"; + "map acl inherit" = "yes"; + "store dos attributes" = "yes"; + }; + mikufanclub = { + path = "/mnt/data/mikufanclub"; + writable = "yes"; + "valid users" = "mikushare emmatherock"; + "force group" = "mikushare-group"; + "create mask" = "0660"; + "directory mask" = "0770"; + }; + data-private = { + path = "/mnt/data"; + writable = "yes"; + "valid users" = "emmatherock"; + "browseable" = "yes"; + }; + }; + }; + + systemd.services.tailscale-udp-gro = { + description = "Configurar UDP GRO para Tailscale"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.ethtool}/bin/ethtool -K enp6s0 rx-udp-gro-forwarding on rx-gro-list on"; + RemainAfterExit = true; + }; + }; +} diff --git a/secureboot.nix b/secureboot.nix new file mode 100644 index 0000000..ed796bc --- /dev/null +++ b/secureboot.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, ... }: + +{ + # Lanzaboote reemplaza al systemd-boot estándar + boot.loader.systemd-boot.enable = lib.mkForce false; + + boot.lanzaboote = { + enable = true; + pkiBundle = "/var/lib/sbctl"; + }; +} diff --git a/users.nix b/users.nix new file mode 100644 index 0000000..4430b40 --- /dev/null +++ b/users.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: { + environment.localBinInPath = true; + + users.groups.mikushare-group = {}; + + users.groups.plugdev = {}; + + users.users.emmatherock = { + isNormalUser = true; + description = "EmmaTheRock"; + shell = pkgs.fish; + extraGroups = [ "plugdev" "networkmanager" "wheel" "video" "mikushare-group" "render" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA8vfwM5g9RJXqHtqTgNqsYg9SxSm+UMvFqTjBoAsLJ6 emmatherock@MAIN-PC" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIpTslcK0yQ6k+h8foNl17wVRyJUfEGzq7f1h3014WNB s21 plus" + ]; + }; + + users.users.mikushare = { + isNormalUser = true; + description = "Acceso remoto Mikufanclub"; + group = "mikushare-group"; + createHome = false; + }; +}