diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79829c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Nix build artifacts +result +result-* + +# Direnv +.direnv + +# IDE / edytory +.aider* + +# Systemowe pliki tymczasowe +*.swp +*.swo diff --git a/base.nix b/base.nix index e6b7506..4dc7e1c 100644 --- a/base.nix +++ b/base.nix @@ -1,21 +1,18 @@ { pkgs, ... }: { - # Włączamy Flakes + # === Włączamy Flakes === nix.settings.experimental-features = [ "nix-command" "flakes" ]; - # paczki systemowe - environment.systemPackages = with pkgs; [ - file - tree - wget - git - openssh - neovim - keepassxc - nextcloud-client - tmux - unzip - ]; + # === Automatyczne sprzątanie store === + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + # === Optymalizacja store (deduplikacja) === + nix.settings.auto-optimise-store = true; + + # === Pozwalamy na niewolne pakiety === nixpkgs.config.allowUnfree = true; } diff --git a/flake.nix b/flake.nix index f51d5f3..ea87faf 100644 --- a/flake.nix +++ b/flake.nix @@ -2,50 +2,33 @@ description = "Konfiguracja wielu maszyn na raz"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # Bleeding edge! + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { - url = "github:nix-community/home-manager"; + url = "github:nix-community/home-manager/nixos-unstable"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, home-manager, ... }: - let # pomocnicza funkcja + outputs = { self, nixpkgs, home-manager, ... }: + let mk_system = system: hostname: modules: nixpkgs.lib.nixosSystem { inherit system; modules = [ { networking.hostName = hostname; } - # base configuration ./base.nix - # home manager home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.sharedModules = [ ./modules/home/tibia.nix ]; home-manager.users.sasza = import ./home.nix; } ] ++ modules; - }; + }; in { nixosConfigurations = { nix-latitude = mk_system "x86_64-linux" "nix-latitude" [ - ./hosts/nix-latitude/configuration.nix - ./modules/plasma.nix - ./modules/3dmodel.nix - #./modules/network.nix - #./modules/office.nix - ./modules/tibia.nix - ./modules/multimedia.nix - ]; - - nix-gaming = mk_system "x86_64-linux" "nix-gaming" [ - ./hosts/nix-gaming/configuration.nix - ./modules/plasma.nix - ./modules/gaming.nix - ./modules/network.nix - # ./modules/office.nix - ./modules/3dmodel.nix - ./modules/3dprint.nix - ./modules/multimedia.nix + ./hosts/nix-latitude/configuration.nix + ./modules/plasma.nix ]; }; }; diff --git a/home.nix b/home.nix index 78535ac..eb0c374 100644 --- a/home.nix +++ b/home.nix @@ -3,18 +3,55 @@ home.homeDirectory = "/home/sasza"; home.packages = with pkgs; [ + # Przeglądarki brave + + # Narzędzia CLI + neovim + git htop glances + tree + wget + openssh + + # Modelowanie 3D + openscad-unstable + + # Druk 3D + orca-slicer + + # Gry + lutris + + # Sieć / VPN + eddie + wireguard-tools + qbittorrent + + # Biuro + libreoffice-fresh + + # KDE + kdePackages.kate + + # Dodane z remote + file + keepassxc + nextcloud-client + tmux + unzip + vlc ]; - # Przykład prostej konfiguracji Git programs.git = { enable = true; settings.user.name = "Sasza Stanczew"; settings.user.email = "sasza@stanczew.com"; }; + programs.tibia.enable = true; + programs.home-manager.enable = true; - home.stateVersion = "24.11"; + home.stateVersion = "25.11"; } diff --git a/hosts/nix-latitude/configuration.nix b/hosts/nix-latitude/configuration.nix index c75460d..349af98 100644 --- a/hosts/nix-latitude/configuration.nix +++ b/hosts/nix-latitude/configuration.nix @@ -1,38 +1,25 @@ -# 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, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; + imports = [ + ./hardware-configuration.nix + ]; - # Bootloader. + # Bootloader boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # Use latest kernel. + # Use latest kernel boot.kernelPackages = pkgs.linuxPackages_latest; - networking.hostName = "nix-latitude"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - # Enable networking networking.networkmanager.enable = true; - # Set your time zone. + # Timezone time.timeZone = "Europe/Warsaw"; - # Select internationalisation properties. + # Locale i18n.defaultLocale = "pl_PL.UTF-8"; - i18n.extraLocaleSettings = { LC_ADDRESS = "pl_PL.UTF-8"; LC_IDENTIFICATION = "pl_PL.UTF-8"; @@ -45,45 +32,16 @@ LC_TIME = "pl_PL.UTF-8"; }; - # Configure console keymap + # Console keymap console.keyMap = "pl2"; - # Define a user account. Don't forget to set a password with ‘passwd’. + # User account (pakiety w home-manager) users.users.sasza = { isNormalUser = true; description = "Sasza Stanczew"; extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ - kdePackages.kate - # thunderbird - ]; }; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "25.11"; # Did you read the comment? - + # State version + system.stateVersion = "25.11"; } diff --git a/modules/3dmodel.nix b/modules/3dmodel.nix deleted file mode 100644 index 69bc9e6..0000000 --- a/modules/3dmodel.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: { - - # paczki - environment.systemPackages = with pkgs; [ - openscad-unstable - ]; -} diff --git a/modules/3dprint.nix b/modules/3dprint.nix deleted file mode 100644 index 5cb0803..0000000 --- a/modules/3dprint.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: { - - # paczki - environment.systemPackages = with pkgs; [ - orca-slicer - ]; -} diff --git a/modules/gaming.nix b/modules/gaming.nix index 4c77034..7766f26 100644 --- a/modules/gaming.nix +++ b/modules/gaming.nix @@ -1,13 +1,9 @@ { pkgs, ... }: { - # Grafika AMD i Steam + # Akceleracja grafiki (AMD/Intel) hardware.graphics.enable = true; hardware.graphics.enable32Bit = true; + + # Steam programs.steam.enable = true; - - # paczki - environment.systemPackages = with pkgs; [ - lutris - - ]; } diff --git a/modules/home/tibia.nix b/modules/home/tibia.nix new file mode 100644 index 0000000..47078d7 --- /dev/null +++ b/modules/home/tibia.nix @@ -0,0 +1,153 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.programs.tibia; + + # Legacy libxml2 (2.9.x) — wymagany przez Tibię, usunięty z nixpkgs-unstable + libxml2_2_9 = pkgs.callPackage ../../packages/libxml2-2.9 { }; + + # Wspólne ścieżki bibliotek + tibiaLibPath = lib.makeLibraryPath [ + pkgs.nss + pkgs.nspr + pkgs.libxkbfile + libxml2_2_9 + ]; + + # Helper: eksport LD_LIBRARY_PATH + exportLibs = '' + export LD_LIBRARY_PATH="${tibiaLibPath}:$LD_LIBRARY_PATH" + ''; + + # Wrapper dla właściwego clienta (uruchamiany przez Tibia package.json) + tibiaClientWrapper = pkgs.writeShellScriptBin "tibia-client" '' + #!/usr/bin/env bash + ${exportLibs} + exec steam-run "$HOME/.local/share/CipSoft GmbH/Tibia/packages/Tibia/bin/client" "$@" + ''; + + # Patchuje package.json Tibii żeby używała wrappera zamiast surowego binary + tibiaPatcher = pkgs.writeShellScriptBin "tibia-patch" '' + #!/usr/bin/env bash + set -e + + PKGDIR="$HOME/.local/share/CipSoft GmbH/Tibia/packages/Tibia" + PKGJSON="$PKGDIR/package.json" + LOCALWRAPPER="$PKGDIR/tibia-client-wrapper" + + if [ ! -f "$PKGJSON" ]; then + echo "package.json not found — run the launcher once first." + exit 0 + fi + + if grep -q "tibia-client-wrapper" "$PKGJSON" 2>/dev/null; then + echo "Already patched." + exit 0 + fi + + cat > "$LOCALWRAPPER" <<'TIBIA_WRAPPER' + #!/usr/bin/env bash + ${exportLibs} + exec ${tibiaClientWrapper}/bin/tibia-client "$@" +TIBIA_WRAPPER + chmod +x "$LOCALWRAPPER" + + sed -i 's#"executable": "bin/client"#"executable": "tibia-client-wrapper"#' "$PKGJSON" + + echo "Tibia client patched to use tibia-client-wrapper." + ''; + + # Uruchamia launcher Tibii (pobrany ręcznie przez tibia-install) + tibiaLauncherWrapper = pkgs.writeShellScriptBin "tibia" '' + #!/usr/bin/env bash + set -e + + LAUNCHER="$HOME/Gry/Tibia/Tibia" + + if [ ! -x "$LAUNCHER" ]; then + echo "Tibia launcher not found at:" + echo " $LAUNCHER" + echo "" + echo "Run 'tibia-install' first, or download manually from:" + echo " https://www.tibia.com/download/" + exit 1 + fi + + tibia-patch + + ${exportLibs} + exec steam-run "$LAUNCHER" + ''; + + # Pomija launcher, odpala clienta bezpośrednio + tibiaDirect = pkgs.writeShellScriptBin "tibia-direct" '' + #!/usr/bin/env bash + + CLIENT="$HOME/.local/share/CipSoft GmbH/Tibia/packages/Tibia/bin/client" + + if [ ! -x "$CLIENT" ]; then + echo "Tibia client not found." + echo "Run 'tibia' once so the launcher downloads the client." + exit 1 + fi + + ${exportLibs} + exec steam-run "$CLIENT" + ''; + + # Instaluje launcher Tibii na nowym systemie + tibiaInstall = pkgs.writeShellScriptBin "tibia-install" '' + #!/usr/bin/env bash + set -e + + URL="https://static.tibia.com/download/tibia.x64.tar.gz" + DEST="$HOME/Gry/Tibia" + TMPDIR=$(mktemp -d) + trap "rm -rf $TMPDIR" EXIT + + echo "Downloading Tibia launcher from $URL ..." + if command -v wget &>/dev/null; then + wget -q --show-progress -O "$TMPDIR/tibia.tar.gz" "$URL" + elif command -v curl &>/dev/null; then + curl -# -L -o "$TMPDIR/tibia.tar.gz" "$URL" + else + echo "Neither wget nor curl found." + exit 1 + fi + + mkdir -p "$DEST" + tar xzf "$TMPDIR/tibia.tar.gz" -C "$DEST" + chmod +x "$DEST/Tibia" + + echo "" + echo "Tibia launcher installed to: $DEST/Tibia" + echo "Run 'tibia' to start." + ''; + + # .desktop entry + tibiaDesktop = pkgs.makeDesktopItem { + name = "tibia"; + exec = "tibia-direct"; + desktopName = "Tibia"; + comment = "Tibia MMORPG Client"; + categories = [ "Game" ]; + }; + +in { + options.programs.tibia = { + enable = lib.mkEnableOption "Tibia game client support"; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + steam-run + libxml2_2_9 + tibiaClientWrapper + tibiaPatcher + tibiaLauncherWrapper + tibiaDirect + tibiaInstall + tibiaDesktop + ]; + }; +} diff --git a/modules/network.nix b/modules/network.nix deleted file mode 100644 index cbb17cd..0000000 --- a/modules/network.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs, ... }: { - - # paczki - environment.systemPackages = with pkgs; [ - eddie - wireguard-tools - qbittorrent - ]; -} diff --git a/modules/office.nix b/modules/office.nix deleted file mode 100644 index 88908dd..0000000 --- a/modules/office.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: { - - # paczki - environment.systemPackages = with pkgs; [ - libreoffice-fresh - ]; -} diff --git a/modules/plasma.nix b/modules/plasma.nix index 22c48b6..81ce275 100644 --- a/modules/plasma.nix +++ b/modules/plasma.nix @@ -1,26 +1,23 @@ { pkgs, ... }: { - # Enable the X11 windowing system. - # You can disable this if you're only using the Wayland session. + # Enable X11 (można wyłączyć przy czystym Waylandzie) services.xserver.enable = true; - # Enable the KDE Plasma Desktop Environment. - services.displayManager = { + # KDE Plasma 6 + SDDM z autologinem + services.displayManager.sddm.enable = true; + services.displayManager.autoLogin = { enable = true; - autoLogin = { - enable = true; - user = "sasza"; # ← Twój username - }; + user = "sasza"; }; services.desktopManager.plasma6.enable = true; - # Configure keymap in X11 + # Polski układ klawiatury w X11 services.xserver.xkb = { layout = "pl"; variant = ""; }; - # Enable sound with pipewire. + # Dźwięk — PipeWire zamiast PulseAudio services.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { @@ -28,23 +25,5 @@ alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; }; - - # paczki graficzne - environment.systemPackages = with pkgs; [ - brave - ]; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Install firefox. - # programs.firefox.enable = true; - } diff --git a/packages/libxml2-2.9/default.nix b/packages/libxml2-2.9/default.nix new file mode 100644 index 0000000..96487ca --- /dev/null +++ b/packages/libxml2-2.9/default.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchurl, pkg-config, zlib, xz }: + +stdenv.mkDerivation { + pname = "libxml2"; + version = "2.9.14"; + + src = fetchurl { + url = "https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.tar.xz"; + sha256 = "sha256-YNdKJX0czsBHXnScui8hVZ5IE577pv8oIkNXx8eY3+4="; + }; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ zlib xz ]; + + configureFlags = [ + "--disable-static" + "--without-python" + ]; + + enableParallelBuilding = true; +}