diff --git a/.forgejo/workflows/activate.yml b/.forgejo/workflows/activate.yml index 29bfb2d..869f0f4 100644 --- a/.forgejo/workflows/activate.yml +++ b/.forgejo/workflows/activate.yml @@ -7,7 +7,6 @@ on: env: PATH: /run/current-system/sw/bin:/run/wrappers/bin - SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} jobs: rebuild: @@ -16,37 +15,26 @@ jobs: - name: Setup SSH key run: | mkdir -p ./ssh - echo "$SSH_KEY" > ./ssh/deploy_key + echo "${{ secrets.DEPLOY_SSH_KEY }}" > ./ssh/deploy_key chmod 600 ./ssh/deploy_key - - name: Build and set boot configuration + - name: Rebuild and switch run: | ssh -i ./ssh/deploy_key \ -o PasswordAuthentication=no \ -o StrictHostKeyChecking=no \ -o UserKnownHostsFile=/dev/null \ root@localhost \ - "bash -lc 'nixos-rebuild boot --refresh --flake git+http://localhost:5080/satr14/nix-flake#homelab -L'" + "bash -lc 'nixos-rebuild switch --refresh --flake git+http://localhost:5080/satr14/nix-flake#homelab -L'" - - name: Activate configuration - continue-on-error: true + - name: Show generation + if: always() run: | ssh -i ./ssh/deploy_key \ -o PasswordAuthentication=no \ -o StrictHostKeyChecking=no \ -o UserKnownHostsFile=/dev/null \ - root@localhost \ - "bash -lc 'setsid nohup /nix/var/nix/profiles/system/bin/switch-to-configuration switch > /var/log/nixos-switch.log 2>&1 < /dev/null & disown'" - - - name: Notify on failure - if: failure() - run: | - curl -s -X POST https://notify.proxy.satr14.my.id/git-flake-updates \ - -H "Title: NixOS Homelab Rebuild Failed" \ - -H "Priority: high" \ - -H "Tags: x" \ - -H "Actions: view, Action Runs, https://git.satr14.my.id/${{ github.repository }}/actions?workflow=activate.yml; view, View Commit, https://git.satr14.my.id/${{ github.repository }}/commit/${{ github.sha }}" \ - -d "${{ github.event.head_commit.message }}" + root@localhost "bash -lc 'nixos-version'" - name: Clean Up if: always() diff --git a/README.md b/README.md index f8496c7..ee0d382 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,5 @@ - `thinkpad` - Thinkpad T480, i5 8350U, 16GB RAM, 256GB NVME - `homelab` - i7 8700T, 32GB RAM, 512GB NVME, 1TB 2.5" SATA -## Todo -- Automatic backups to external drives. -- Better documentation and code structure. -- Use NixOS modules system. - ## Credits -- [orangc's flake](https://git.orangc.net/c/dots) -- [vimjoyer's tutorials](https://www.youtube.com/@vimjoyer) -- [wallpaper source](https://github.com/er2de2/catppuccin_walls/blob/master/wallpapers_png/autumn_2.0.png) \ No newline at end of file +- [orangc's flake](https://git.orangc.net/c/dots) \ No newline at end of file diff --git a/flake.lock b/flake.lock index c741025..5ab99ba 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1784366307, - "narHash": "sha256-VKatYOZwLQ+MuNkWH6/gZYxrNeSK1Mqb7mC0H1WSu+M=", + "lastModified": 1777734189, + "narHash": "sha256-kbIhdhDPaTP6gxAPkcRYeB+cqPFDpTM/bnw+m+26vkI=", "owner": "catppuccin", "repo": "nix", - "rev": "673f730d0fc8db3468c51575f1d3d777cc55e51f", + "rev": "e68cf5deaf1a7afed2e548835dba2ae99f5a3ccb", "type": "github" }, "original": { @@ -78,11 +78,11 @@ ] }, "locked": { - "lastModified": 1784913159, - "narHash": "sha256-JWq0BfjO4ktpH5USfQNQzdvHpIDT8fSKD5K7LvdMRFs=", + "lastModified": 1777977606, + "narHash": "sha256-8ceIdvijN2tm9fIAUgnIZ8BM8TlsFx7pRYKRoxNsi1k=", "owner": "nix-community", "repo": "home-manager", - "rev": "079a3b5d1aa6a719920a51316253b7d6dd22738d", + "rev": "7ef1c04d11f7ef69fd946b118c768c32de0b89a5", "type": "github" }, "original": { @@ -99,11 +99,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1784949919, - "narHash": "sha256-itGqjPYHqEUqabXbQb+eHguk1c6rBTRGZS4KImp45kM=", + "lastModified": 1777952170, + "narHash": "sha256-8dQ/DOUvQI8x5i6MZ309/xZLLVfV1CgWbD2+JiQ7Hd4=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "a58c1fa23ec0273eb085be1e7874e964aa3cd34f", + "rev": "34a46e4de360c5004ee1866f5e3de78bf5e8b289", "type": "github" }, "original": { @@ -112,87 +112,18 @@ "type": "github" } }, - "niri": { - "inputs": { - "niri-stable": "niri-stable", - "niri-unstable": "niri-unstable", - "nixpkgs": "nixpkgs_4", - "nixpkgs-stable": "nixpkgs-stable", - "xwayland-satellite-stable": "xwayland-satellite-stable", - "xwayland-satellite-unstable": "xwayland-satellite-unstable" - }, - "locked": { - "lastModified": 1784874881, - "narHash": "sha256-u4jhSIf/Un0qZB+Cn3hTTaHSI20XeAxYbA5o4faqdJs=", - "owner": "sodiboo", - "repo": "niri-flake", - "rev": "ef7a2a3d719af46b906c22a3ebfb7d65627b2cd2", - "type": "github" - }, - "original": { - "owner": "sodiboo", - "repo": "niri-flake", - "type": "github" - } - }, - "niri-stable": { - "flake": false, - "locked": { - "lastModified": 1756556321, - "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", - "owner": "YaLTeR", - "repo": "niri", - "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", - "type": "github" - }, - "original": { - "owner": "YaLTeR", - "ref": "v25.08", - "repo": "niri", - "type": "github" - } - }, - "niri-unstable": { - "flake": false, - "locked": { - "lastModified": 1784570726, - "narHash": "sha256-9EMn69JBcFWFgUM7f0VBAX+jBby5b9H3M59U75+5yI4=", - "owner": "YaLTeR", - "repo": "niri", - "rev": "7f26c3ee804fb6ed458ef7fb0e3c794f14e0b3bc", - "type": "github" - }, - "original": { - "owner": "YaLTeR", - "repo": "niri", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1783279667, - "narHash": "sha256-2l8yOB5aYd+05Q9V9Y1YhgbSa1j1o5QX+nvYs5FL80A=", - "rev": "f205b5574fd0cb7da5b702a2da51507b7f4fdd1b", - "type": "tarball", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1028110.f205b5574fd0/nixexprs.tar.xz" - }, - "original": { - "type": "tarball", - "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1782847189, - "narHash": "sha256-twXPFqFsrrY5r28Zh7Homgcp2gUMBgQ6WDS98Q/3xFI=", + "lastModified": 1777268161, + "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b6018f87da91d19d0ab4cf979885689b469cdd41", + "rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-25.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -230,27 +161,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1784796856, - "narHash": "sha256-wWFrV5/Qbm+lyt5x20E/bSbfJiGKMo4RCxZV8cl/WZI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e2587caef70cea85dd97d7daab492899902dbf5d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_5": { - "locked": { - "lastModified": 1784796856, - "narHash": "sha256-wWFrV5/Qbm+lyt5x20E/bSbfJiGKMo4RCxZV8cl/WZI=", + "lastModified": 1777578337, + "narHash": "sha256-Ad49moKWeXtKBJNy2ebiTQUEgdLyvGmTeykAQ9xM+Z4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e2587caef70cea85dd97d7daab492899902dbf5d", + "rev": "15f4ee454b1dce334612fa6843b3e05cf546efab", "type": "github" }, "original": { @@ -266,8 +181,7 @@ "gl": "gl", "hm": "hm", "mc": "mc", - "niri": "niri", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_4" } }, "systems": { @@ -299,39 +213,6 @@ "repo": "default", "type": "github" } - }, - "xwayland-satellite-stable": { - "flake": false, - "locked": { - "lastModified": 1755491097, - "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", - "owner": "Supreeeme", - "repo": "xwayland-satellite", - "rev": "388d291e82ffbc73be18169d39470f340707edaa", - "type": "github" - }, - "original": { - "owner": "Supreeeme", - "ref": "v0.7", - "repo": "xwayland-satellite", - "type": "github" - } - }, - "xwayland-satellite-unstable": { - "flake": false, - "locked": { - "lastModified": 1784679892, - "narHash": "sha256-Mb7jpqnrcYCfNSItIkkHpuR3YxWFxPuIBfcwNKlRBkk=", - "owner": "Supreeeme", - "repo": "xwayland-satellite", - "rev": "8d135d3b2854b30fd01ea6cd6c27e523dd50a839", - "type": "github" - }, - "original": { - "owner": "Supreeeme", - "repo": "xwayland-satellite", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 6f756b4..3ccbd5c 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,6 @@ gl.url = "github:nix-community/nixGL"; ctp.url = "github:catppuccin/nix"; - niri.url = "github:sodiboo/niri-flake"; mc.url = "github:Infinidoge/nix-minecraft"; }; diff --git a/lib/options.nix b/lib/options.nix index 433cc0b..9cc0282 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -25,7 +25,7 @@ in { domain = "satr14.my.id"; # root domain for dns, ssl certs, reverse proxy, etc. ssh-keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIESvQFXoUBafatqnxTd6qk3WEOcfwb3AIWVTstR3lHzX forgejo" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC7nkis5iB9qJ0OLi8YO4MX1F/ISmBng/xYdNcupGAJC forgejo-actions" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJtdH1YqRH9xhuHMivezLvj/hpH77yfH3HUCaRboB/hb forgejo-deploy-runner" ]; disks = { # gallery = ext4 "/dev/disk/by-uuid/834f51c1-90ee-4601-ba76-ef0419198d67"; # disk for photo gallery @@ -41,7 +41,7 @@ in { [ "PocketID" "authentik" "https://auth.${domain}" "http://localhost:1411/" ] [ "Forgejo" "forgejo" "https://git.${domain}" "http://localhost:5080/" ] [ "Copyparty" "files" "https://cdn.${domain}" "http://localhost:3923/" ] - [ "Cockpit" "cockpit" "https://control.proxy.${domain}" "http://localhost:9090/" ] + [ "CryptPad" "cryptpad" "https://docs.${domain}" "http://localhost:7090/" ] [ "CodeServer" "coder" "https://code.proxy.${domain}" "http://localhost:8443/" ] [ "AdGuardHome" "adguard" "https://dns.proxy.${domain}" "http://localhost:8088/" ] [ "Traefik" "traefikproxy" "https://dynamic.proxy.${domain}/dashboard/" "" ] @@ -54,7 +54,10 @@ in { [ "Dockge" "docker" "https://containers.proxy.${domain}" "http://localhost:5001/" ] ]; routes = { - "mc.${domain}" = "tcp://localhost:25565"; + "mc0.${domain}" = "tcp://localhost:25565"; + + "docs-sandbox.${domain}" = "http://localhost:7090"; + "docs.${domain}" = "http://localhost:7090"; "cdn.${domain}" = selfSigned "https://localhost:3923"; @@ -71,7 +74,6 @@ in { "code" = da "http://localhost:8443"; "dns" = da "http://localhost:8088"; - "control" = d "https://localhost:9090"; "gallery" = d "http://localhost:2283"; "dynamic" = d "http://localhost:8082"; "search" = d "http://localhost:8091"; @@ -102,7 +104,7 @@ in { }; rice = { - font = "DroidSansM Nerd Font"; # global font for rice GUIs, must be a Nerd Font for icon glyphs to render correctly + font = "monospace"; # global font for rice GUIs, leave empty to use monospace bar = { top = true; # false will put the bar at the bottom fragmented = true; # enable fragmented bar, false will make it a single block diff --git a/modules/hardware/misc/battery-power.nix b/modules/hardware/misc/battery-power.nix index 80c6ec9..3a2ca6b 100644 --- a/modules/hardware/misc/battery-power.nix +++ b/modules/hardware/misc/battery-power.nix @@ -13,15 +13,12 @@ cron = { enable = true; systemCronJobs = [ - "*/2 * * * * ${username} bash ${pkgs.writeShellScript "low-battery-notifier" '' - ACPI_OUT=$(${pkgs.acpi}/bin/acpi -b) - BAT_PCT=`echo "$ACPI_OUT" | ${pkgs.gnugrep}/bin/grep -P -o '[0-9]+(?=%)'` - BAT_STA=`echo "$ACPI_OUT" | ${pkgs.gnugrep}/bin/grep -P -o '\w+(?=,)'` + "* * * * * ${username} bash -x ${pkgs.writeShellScript "low-battery-notifier" '' + BAT_PCT=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '[0-9]+(?=%)'` + BAT_STA=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '\w+(?=,)'` echo "`date` battery status:$BAT_STA percentage:$BAT_PCT" - export DISPLAY=:0 - export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus - test $BAT_PCT -le 30 && test $BAT_PCT -gt 15 && test $BAT_STA = "Discharging" && ${pkgs.libnotify}/bin/notify-send "Low Battery" "Battery remaining: $BAT_PCT%." && brightnessctl s 30% - test $BAT_PCT -le 15 && test $BAT_STA = "Discharging" && ${pkgs.libnotify}/bin/notify-send -u critical "Low Battery" "Shutdown at 10%." + test $BAT_PCT -le 30 && test $BAT_PCT -gt 15 && test $BAT_STA = "Discharging" && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send "Low Battery" "Battery remaining: $BAT_PCT%." + test $BAT_PCT -le 15 && test $BAT_STA = "Discharging" && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send -u critical "Low Battery" "Shutdown at 10%." ''} > /tmp/cron.batt.log 2>&1" ]; }; diff --git a/modules/hardware/misc/cpu-freq.nix b/modules/hardware/misc/cpu-freq.nix index 63323a3..ad87022 100644 --- a/modules/hardware/misc/cpu-freq.nix +++ b/modules/hardware/misc/cpu-freq.nix @@ -49,27 +49,23 @@ }; auto-cpufreq = { enable = true; # wait for fix: https://github.com/AdnanHodzic/auto-cpufreq/issues/906 - settings = let - performance = { - governor = "performance"; + settings = { + charger = { + governor = "powersave"; # "performance"; energy_performance_preference = "performance"; turbo = "always"; platform_profile = "performance"; scaling_min_freq = 800000; scaling_max_freq = 3600000; }; - balanced = { + battery = { governor = "powersave"; energy_performance_preference = "balance-power"; + platform_profile = "low-power"; turbo = "never"; - platform_profile = "balanced"; scaling_min_freq = 400000; scaling_max_freq = 1700000; }; - in { - battery = balanced; - charger = balanced; # performance; - # ^^ disable overclocking for purely productivity use so low temps and fan noise }; }; }; diff --git a/modules/hardware/thinkpad.nix b/modules/hardware/thinkpad.nix index c976402..f7e193a 100644 --- a/modules/hardware/thinkpad.nix +++ b/modules/hardware/thinkpad.nix @@ -28,13 +28,6 @@ "nvme_core.default_ps_max_latency_us=0" ]; }; - nixpkgs.overlays = [ - (final: prev: { - throttled = prev.throttled.overrideAttrs (old: { - pythonPath = (old.pythonPath or []) ++ [ final.python3Packages.dbus-next ]; - }); - }) - ]; hardware.bluetooth = { enable = true; powerOnBoot = false; diff --git a/modules/home/core/apps.nix b/modules/home/core/apps.nix index 974a602..14d3701 100644 --- a/modules/home/core/apps.nix +++ b/modules/home/core/apps.nix @@ -27,28 +27,43 @@ home.packages = with pkgs; [ zed-editor - opencode - github-copilot-cli + # kicad-small + # arduino-ide slack discord - protonmail-desktop + # protonmail-desktop # https://www.reddit.com/r/NixOS/comments/1rm9alf/protonmail_in_nixos/ vlc brave flameshot libreoffice appimage-run + # keepassxc virt-manager + # winboat + remmina moonlight-qt - gpu-screen-recorder - gpu-screen-recorder-gtk + # rustdesk + + + # inkscape + # davinci-resolve + # kdePackages.kdenlive + (wrapOBS { + plugins = with obs-studio-plugins; [ + wlrobs + obs-backgroundremoval + obs-pipewire-audio-capture + ]; + }) - # LOCK IN - # (prismlauncher.override { - # jdks = with javaPackages.compiler.temurin-bin; [ jre-21 jdk-25 ]; - # }) + ferium + packwiz + portablemc + steamguard-cli + # modrinth-app ]; } diff --git a/modules/home/core/browser.nix b/modules/home/core/browser.nix deleted file mode 100644 index b4a0f82..0000000 --- a/modules/home/core/browser.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ pkgs, ... }: { - programs.chromium = { - enable = true; - package = pkgs.brave; - extensions = map (id: { inherit id; }) [ - "nngceckbapebfimnlniiiahkandclblb" # bitwarden - "kokhpbhfeokchmbimdlaldcmlinjpipm" # 2fauth - "gppongmhjkpfnbhagpmjfkannfbllamg" # wappalyzer - - "cejckpjfigehbeecbbfhangbknpidcnh" # timezone changer - "dmghijelimhndkbmpgbldicpogfkceaj" # dark mode - "cebifddlogbjhoibpjobhlamopmlpckl" # disable page visibility - "efknglbfhoddmmfabeihlemgekhhnabb" # json viewer - "bhchdcejhohfmigjafbampogmaanbfkg" # user agent switcher - "bbppejejjfancffmhncgkhjdaikdgagc" # undisposition - - "ocabkmapohekeifbkoelpmppmfbcibna" # xoom redirector - "fkagelmloambgokoeokbpihmgpkbgbfm" # indie wiki buddy - "bggfcpfjbdkhfhfmkjpbhnkhnpjjeomc" # github material icons - "hfckonpdalooejghjpbpimhcgighijck" # chess move confirm - "babnnfmbjokkeieobamoifmeapbbfhje" # medium unlock - "mnjggcdmjocbbbhaepdhchncahnbgone" # sponsor block - "ekcgkejcjdcmonfpmnljobemcbpnkamh" # whatsapp web plus - ]; - }; -} \ No newline at end of file diff --git a/modules/home/core/cli.nix b/modules/home/core/cli.nix index 2dc4b10..86b3c08 100644 --- a/modules/home/core/cli.nix +++ b/modules/home/core/cli.nix @@ -5,17 +5,10 @@ TERMINAL = "kitty"; }; - home.packages = with pkgs; [ bun packwiz ]; + home.packages = with pkgs; [ bun ]; programs = { - tmux = { - enable = true; - extraConfig = '' - set -g set-clipboard on - set -ag terminal-overrides ",*:Ms=\\E[52;%p1%s;%p2%s\\007" - set -g allow-passthrough on - ''; - }; + tmux.enable = true; vim.enable = true; bat.enable = true; kitty = { @@ -30,9 +23,6 @@ cursor_trail = 10; copy_on_select = true; }; - keybindings = { - "ctrl+backspace" = "send_text all \\x17"; - }; }; ranger = { enable = true; @@ -59,16 +49,11 @@ initLua = '' vim.opt.clipboard = "unnamedplus" vim.opt.termguicolors = true - local osc52 = require("vim.ui.clipboard.osc52") - vim.g.clipboard = { - name = "OSC 52", - copy = { ["+"] = osc52.copy("+"), ["*"] = osc52.copy("*") }, - paste = { ["+"] = osc52.paste("+"), ["*"] = osc52.paste("*") }, - } require("nvim-tree").setup() vim.api.nvim_create_autocmd("VimEnter", { callback = function() - vim.cmd("set nu rnu") + -- vim.cmd("NvimTreeOpen") + vim.cmd("set nu") vim.cmd.wincmd 'p' end, }) @@ -83,7 +68,6 @@ nvim-cmp indent-blankline-nvim markdown-preview-nvim - vim-suda ]; }; gh = { @@ -100,7 +84,6 @@ enable = true; signing.format = null; settings = { - push.autoSetupRemote = true; pull.rebase = "true"; credential.helper = "cache --timeout=3600"; user = { diff --git a/modules/home/core/code.nix b/modules/home/core/code.nix index 6803152..21268ff 100644 --- a/modules/home/core/code.nix +++ b/modules/home/core/code.nix @@ -3,12 +3,12 @@ enable = true; package = pkgs.zed-editor; extensions = [ - "wakatime" "discord-presence" - "catppuccin" "catppuccin-icons" - "codebook" - "git-firefly" "nix" "html" "html-snippets" "svelte" "svelte-snippets" + "wakatime" "discord-presence" + "catppuccin" "catppuccin-icons" + "git-firefly" + "nix" ]; userSettings = { diff_view_style = "unified"; @@ -40,13 +40,12 @@ }; }; agent = { - sidebar_side = "right"; tool_permissions.default = "allow"; default_model = { provider = "copilot_chat"; - model = "claude-sonnet-5"; - effort = "low"; - enable_thinking = true; + model = "claude-sonnet-4.6"; + effort = "high"; + enable_thinking = false; }; }; theme = { diff --git a/modules/home/core/shell.nix b/modules/home/core/shell.nix index 70dab70..2a23a42 100644 --- a/modules/home/core/shell.nix +++ b/modules/home/core/shell.nix @@ -37,9 +37,9 @@ "cd" = "z"; "sys" = "sudo systemctl --runtime"; - "sys-log" = "journalctl -o cat -f -b -u"; + "sys-log" = "journalctl -f -b -u"; "user" = "systemctl --user --runtime"; - "user-log" = "journalctl -o cat -f -b --user-unit"; + "user-log" = "journalctl -f -b --user-unit"; "ts" = "sudo tailscale"; "tsip" = "tailscale ip -4"; @@ -49,6 +49,8 @@ "fetch-update" ="rm -f ~/.fetch.sh && wget https://raw.githubusercontent.com/SX-9/fetch.sh/master/fetch.sh -O ~/.fetch.sh && chmod +x ~/.fetch.sh"; "fetch" = "~/.fetch.sh"; + "hm-sw" = "home-manager switch -b bak-hm --flake"; + "nix-sw" = "sudo nixos-rebuild switch --flake"; "nix-hw-conf" = "nixos-generate-config --show-hardware-config"; "nixos-diff" = "nix build .#nixosConfigurations.$(hostname).config.system.build.toplevel -o /tmp/nix-flake-diff && nvd diff /run/current-system /tmp/nix-flake-diff"; "cd-conf" = "cd ${flake-path}"; @@ -61,16 +63,11 @@ "wm-lock" = "wm-ctl dispatch exec loginctl lock-session && notify-send ${hostname} 'Manual lock triggered'"; "wm-disp" = "wm-ctl dispatch dpms"; - "gz-compress" = "tar -czhf"; - "gz-extract" = "tar -xzf"; - "gh-author-setup" = "git config user.name $(gh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /user | jq -r .login) && git config user.email $(gh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /user/emails | jq -r \".[1].email\")"; "fg-create-repo" = "git remote add origin ${git.server}/${git.username}/$(basename $PWDw).git && git push"; "convert-pdf" = "libreoffice --headless --convert-to pdf"; - "nix-fetch-hash" = "nix store prefetch-url --json"; - "git-fix" = "git rebase --continue"; - "mcl" = "portablemc start -l $(cat ~/.minecraft/portablemc-launch-params.json | jq -r .email) $(cat ~/.minecraft/portablemc-launch-params.json | jq -r .version) --jvm-args=-Xmx6G"; + "mcl" = "portablemc start -l $(cat ~/.minecraft/portablemc-launch-params.json | jq -r .email) $(cat ~/.minecraft/portablemc-launch-params.json | jq -r .version)"; "mc" = "ferium upgrade; mcl"; }; initContent = '' diff --git a/modules/home/default.nix b/modules/home/default.nix index 4a7a95c..00bbbb6 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -6,13 +6,10 @@ catppuccin = { enable = true; - autoEnable = true; - cache.enable = true; + hyprlock.useDefaultConfig = false; + flavor = ctp-opt.flavor; accent = ctp-opt.accent; - - hyprlock.useDefaultConfig = false; - nvim.settings.transparent_background = true; }; home = { diff --git a/modules/home/desktop.nix b/modules/home/desktop.nix index e007ef6..9e34895 100644 --- a/modules/home/desktop.nix +++ b/modules/home/desktop.nix @@ -14,13 +14,8 @@ ./misc/phone.nix ./core/apps.nix ./core/code.nix - ./core/browser.nix ]; - home.file.".config/discord/settings.json".text = builtins.toJSON { - SKIP_HOST_UPDATE = true; - }; - services = { awww.enable = true; hyprpolkitagent.enable = true; @@ -29,7 +24,7 @@ home = { packages = with pkgs; [ playerctl brightnessctl - networkmanagerapplet + networkmanagerapplet tailscale-systray qt6Packages.qt6ct kdePackages.qtstyleplugin-kvantum nwg-displays lxqt.pcmanfm-qt diff --git a/modules/home/rice/bar.nix b/modules/home/rice/bar.nix index cc6b175..27a04dd 100644 --- a/modules/home/rice/bar.nix +++ b/modules/home/rice/bar.nix @@ -12,14 +12,15 @@ modules-left = [ "custom/start" - "niri/workspaces" - "niri/window" + "hyprland/workspaces" + "hyprland/window" "mpris" ]; modules-center = if rice.bar.minimal then [] else [ "custom/dunst" "clock" "tray" + "hyprland/submap" ]; modules-right = if rice.bar.minimal then [ "tray" @@ -53,7 +54,7 @@ }; interval = 1; format = " {used:0.1f}GiB"; - on-click = "kitty btop"; + on-click = "hyprctl dispatch exec '[float; size 75%]' kitty btop"; }; "disk" = { states = { @@ -61,7 +62,7 @@ }; interval = 5; format = " {used}"; - on-click = "kitty btop"; + on-click = "hyprctl dispatch exec '[float; size 75%]' kitty btop"; on-click-right = "kitty sh -c 'sudo nix-collect-garbage -d; nix-collect-garbage -d; nix store optimise; sudo journalctl --rotate --vacuum-time=1s --vacuum-files=1; read'"; }; "network" = { @@ -80,7 +81,7 @@ critical-threshold = 80; format = " {temperatureC}°C"; interval = 1; - on-click = "kitty btop"; + on-click = "hyprctl dispatch exec '[float; size 75%]' kitty btop"; }; "power-profiles-daemon" = { format = "{icon} {profile}"; @@ -90,10 +91,15 @@ balanced = ""; }; }; - "niri/workspaces" = { - format = "{value}"; - on-scroll-down = "niri msg action focus-workspace-down"; - on-scroll-up = "niri msg action focus-workspace-up"; + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-down = "hyprctl dispatch workspace e+1"; + on-scroll-up = "hyprctl dispatch workspace e-1"; }; "custom/dunst" = { format = "{}"; @@ -113,7 +119,7 @@ on-click-right = "playerctl next"; on-click = "playerctl previous"; }; - "niri/window" = { + "hyprland/window" = { icon = true; max-length = 35; separate-outputs = false; @@ -122,9 +128,15 @@ "~" = "${username}@${hostname}"; "btop" = "${username}@${hostname}"; }; - on-click-right = "niri msg action fullscreen-window"; - on-click-middle = "niri msg action close-window"; - on-click = "niri msg action maximize-column"; + on-click-right = "hyprctl dispatch fullscreen 0"; + on-click-middle = "hyprctl dispatch killactive"; + on-click = "hyprctl dispatch fullscreen 1"; + on-scroll-up = "hyprctl dispatch cyclenext"; + on-scroll-down = "hyprctl dispatch cyclenext prev"; + }; + "hyprland/submap" = { + format = " {}"; + on-click = "hyprctl dispatch submap reset"; }; "clock" = { format = "{:%b %d, %I:%M:%S %p}"; @@ -172,7 +184,8 @@ }; "custom/start" = { format = ""; - on-click-right = "wlogout"; + on-click-middle = "wlogout"; + on-click-right = "hyprctl dispatch togglespecialworkspace hidden"; on-click = "rofi -show drun -show-icons -display-drun '' -run-command \"uwsm app -- {cmd}\""; }; } @@ -180,7 +193,7 @@ style = '' * { font-size: 12px; - font-family: ${rice.font}; + font-family: Font Awesome, ${rice.font}; font-weight: bold; color: @text; transition: none; @@ -215,13 +228,12 @@ border: ${toString rice.borders.size}px solid transparent; } - #window { padding: 0px 5px; } - #workspaces, #cpu, #memory, #disk, #clock, #window, #tray, #pulseaudio, #battery, #network, #temperature, #power-profiles-daemon, #custom-exit, #custom-start, #custom-dunst, #mpris { padding: 0px 5px; margin: 0px 5px; } + #window, #submap { padding: 0px 5px; } + #submap, #workspaces, #cpu, #memory, #disk, #clock, #window, #tray, #pulseaudio, #battery, #network, #temperature, #power-profiles-daemon, #custom-exit, #custom-start, #custom-dunst, #mpris { padding: 0px 5px; margin: 0px 5px; } #workspaces button { border-radius: 0px; margin: 0px; - padding: 4px; background: none; border: none; } @@ -235,7 +247,7 @@ background: @base; } - #workspaces button.active { + #workspaces button.active, #submap { background: @surface0; } diff --git a/modules/home/rice/compositor.nix b/modules/home/rice/compositor.nix index cca6797..00f19e0 100644 --- a/modules/home/rice/compositor.nix +++ b/modules/home/rice/compositor.nix @@ -1,83 +1,23 @@ -{ lib, pkgs, rice, ctp-opt, ... }: { +{ pkgs, rice, ctp-opt, ... }: { imports = [ ./keybinds.nix ]; - # TODO: https://github.com/sodiboo/niri-flake/issues/1393 for nwg-displays monitor dynamic config - - programs.niri = { - settings = { - outputs."eDP-1" = { - mode = { width=1920; height=1080; refresh=60.006; }; - position = { x=0; y=0; }; - scale = 1.0; - }; - input = { - warp-mouse-to-focus.enable = true; - focus-follows-mouse = { - max-scroll-amount = "35%"; - enable = true; - }; - keyboard.xkb.options = "caps:none"; - }; - - environment = { - XCURSOR_SIZE = "24"; - XCURSOR_THEME = "catppuccin-${ctp-opt.flavor}-light-cursors"; - - CLIPHIST_MAX_ITEMS = "90"; - - GTK_APPLICATION_PREFER_DARK_THEME = "1"; - GTK_THEME = "Adwaita:dark"; - QT_QPA_PLATFORMTHEME = "kvantum"; - QT_STYLE_OVERRIDE = "kvantum"; - }; - spawn-at-startup = map (sh: { inherit sh; }) [ - "wl-paste --type text --watch cliphist store" - "wl-paste --type image --watch cliphist store" - - "waybar &" - "sunshine &" - "blueman-applet &" - "nm-applet &" - "tailscale systray &" - ]; - - xwayland-satellite = { - enable = true; - path = lib.getExe pkgs.xwayland-satellite; - }; - - prefer-no-csd = true; - layout = { - tab-indicator.enable = false; - gaps = rice.gap.outer; - focus-ring = { - enable = true; - width = rice.borders.size; - }; - border.enable = false; - }; - }; - }; - - catppuccin.hyprland.enable = false; # temp fix until i get things migrated to lua - wayland.windowManager.hyprland = { enable = true; package = pkgs.hyprland; # inputs.hl.packages."${pkgs.system}".hyprland; - configType = "hyprlang"; # keep legacy config format (home.stateVersion < 26.05) systemd.enable = false; xwayland.enable = true; settings = { - dwindle.preserve_split = true; - debug = { error_position = 1; disable_logs = true; - vfr = true; }; + # monitor = [ + # "eDP-1,preferred,auto,1" + # ",preferred,auto,1" + # ]; source = [ "~/.config/hypr/monitors.conf" "~/.config/hypr/workspaces.conf" @@ -88,10 +28,16 @@ "wl-paste --type text --watch cliphist store" "wl-paste --type image --watch cliphist store" + #"dunst &" + #"hypridle &" + #"awww-daemon &" "uwsm app -s s -- waybar &" + "uwsm app -s b -- sunshine &" + "uwsm app -s b -- blueman-applet &" "uwsm app -s b -- nm-applet &" - "uwsm app -s b -- tailscale systray &" + "uwsm app -s b -- tailscale-systray &" + #"keepassxc &" ]; env = [ @@ -116,8 +62,13 @@ allow_tearing = false; layout = "dwindle"; - "col.active_border" = if rice.borders.colored then "$accent" else "rgb(108,112,134)"; # accent overlay0 - "col.inactive_border" = if rice.borders.colored then "rgb(147,153,178)" else "rgb(17,17,27)"; # overlay2 crust + "col.active_border" = if rice.borders.colored then "$accent" else "$overlay0"; + "col.inactive_border" = if rice.borders.colored then "$overlay2" else "$crust"; + }; + + dwindle = { + preserve_split = true; + pseudotile = true; }; decoration = { @@ -130,21 +81,15 @@ enabled = true; range = 6; render_power = 3; - color_inactive = "rgba(17,17,27,99)"; # crust alpha 99 - color = "rgba(17,17,27,238)"; # crust alpha ee + color_inactive = "rgba($crustAlpha99)"; + color = "rgba($crustAlphaee)"; }; blur = { enabled = true; - size = 7; - passes = 3; - ignore_opacity = true; - - noise = 0.05; - contrast = 1.5; - - xray = false; - new_optimizations = true; + size = 3; + passes = 1; + vibrancy = 0.1696; }; }; @@ -178,7 +123,8 @@ middle_click_paste = false; exit_window_retains_fullscreen = true; on_focus_under_fullscreen = 1; - background_color = "rgb(17, 17, 27)"; # crust + background_color = "$base"; + vfr = true; }; input = { diff --git a/modules/home/rice/cursor.nix b/modules/home/rice/cursor.nix index 293907a..9a193c5 100644 --- a/modules/home/rice/cursor.nix +++ b/modules/home/rice/cursor.nix @@ -1,11 +1,8 @@ -{ lib, pkgs, ctp-opt, ... }: { - catppuccin.cursors.enable = false; # managed manually below to use the "Light" cursor variant - +{ pkgs, ctp-opt, ... }: { home.pointerCursor = { - enable = true; gtk.enable = true; package = pkgs.catppuccin-cursors."${ctp-opt.flavor}Light"; - name = lib.mkOverride 30 "catppuccin-${ctp-opt.flavor}-light-cursors"; + name = "catppuccin-${ctp-opt.flavor}-light-cursors"; size = 24; }; -} +} \ No newline at end of file diff --git a/modules/home/rice/idle.nix b/modules/home/rice/idle.nix index 4b2d029..80434de 100644 --- a/modules/home/rice/idle.nix +++ b/modules/home/rice/idle.nix @@ -5,8 +5,8 @@ general = { lock_cmd = "hyprlock"; unlock_cmd = "pkill -USR1 hyprlock"; - before_sleep_cmd = "niri msg action power-off-monitors && hyprlock"; - after_sleep_cmd = "niri msg action power-on-monitors"; + before_sleep_cmd = "hyprctl dispatch dpms off && hyprlock"; + after_sleep_cmd = "hyprctl dispatch dpms on"; }; listener = [ { @@ -21,8 +21,8 @@ } { timeout = 420; - on-timeout = "niri msg action power-off-monitors"; - on-resume = "niri msg action power-on-monitors"; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; } { timeout = 600; diff --git a/modules/home/rice/keybinds.nix b/modules/home/rice/keybinds.nix index d63a7d3..c0d4634 100644 --- a/modules/home/rice/keybinds.nix +++ b/modules/home/rice/keybinds.nix @@ -1,74 +1,23 @@ -{ pkgs, lib, hostname, ... }: { - programs.niri.settings.binds = { - "XF86AudioRaiseVolume" = { action.spawn = [ "wpctl" "set-volume" "-l" "1" "@DEFAULT_AUDIO_SINK@" "2%+" ]; allow-when-locked = true; }; - "XF86AudioLowerVolume" = { action.spawn = [ "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "2%-" ]; allow-when-locked = true; }; - "XF86AudioMute" = { action.spawn = [ "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle" ]; allow-when-locked = true; }; - "XF86AudioMicMute" = { action.spawn = [ "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle" ]; allow-when-locked = true; }; - "XF86MonBrightnessUp" = { action.spawn = [ "brightnessctl" "s" "10%+" ]; allow-when-locked = true; }; - "XF86MonBrightnessDown" = { action.spawn = [ "brightnessctl" "s" "10%-" ]; allow-when-locked = true; }; - - "Mod+Q".action.close-window = {}; - "Mod+W".action.maximize-column = {}; - "Mod+S".action.fullscreen-window = {}; - "Ctrl+Print".action.screenshot-window = {}; - "Alt+Print".action.screenshot-screen = {}; - "Print".action.screenshot = {}; - - "Mod+Up".action.focus-workspace-up = {}; - "Mod+Down".action.focus-workspace-down = {}; - "Mod+Left".action.focus-column-left = {}; - "Mod+Right".action.focus-column-right = {}; - - "Mod+Shift+Up".action.move-window-up-or-to-workspace-up = {}; - "Mod+Shift+Down".action.move-window-down-or-to-workspace-down = {}; - "Mod+Shift+Left".action.move-column-left = {}; - "Mod+Shift+Right".action.move-column-right = {}; - "Mod+Ctrl+Left".action.set-window-width = [ "-2%" ]; - "Mod+Ctrl+Right".action.set-window-width = [ "+2%" ]; - "Mod+Ctrl+Down".action.set-window-height = [ "+2%" ]; - "Mod+Ctrl+Up".action.set-window-height = [ "-2%" ]; - - "Mod+G".action.center-column = {}; - "Mod+F".action.toggle-window-floating = {}; - "Alt+Space".action.toggle-overview = {}; - - "Mod+Space" = { action.spawn = [ "playerctl" "play-pause" ]; allow-when-locked = true; }; - "Mod+R".action.spawn = [ "rofi" "-show" "drun" "-show-icons" "-display-drun" "" "-run-command" "{cmd}" ]; - "Mod+Shift+R".action.spawn = [ "rofi" "-show" "drun" "-show-icons" "-display-drun" "wayland-0" "-run-command" "sh -c 'WAYLAND_DISPLAY=wayland-0 DISPLAY=:1 exec {cmd}'" ]; - - "Mod+E".action.spawn = [ "pcmanfm-qt" ]; - "Mod+T".action.spawn = [ "kitty" ]; - "Mod+Y".action.spawn = [ "brave" "--restore-last-session" ]; - "Mod+Return".action.spawn-sh = "ls ~/Projects | rofi -dmenu -p \"Open Project\" | xargs -I {} sh -c 'mkdir -p ~/Projects/\"{}\" && zeditor ~/Projects/\"{}\"'"; - - "Mod+M".action.spawn = [ "wlogout" ]; - "Mod+Tab".action.spawn = [ "pkill" "-SIGUSR1" "waybar" ]; - "Mod+H".action.show-hotkey-overlay = {}; - - "XF86Bluetooth".action.spawn = [ "blueman-manager" ]; - "XF86Display".action.spawn = [ "nwg-displays" ]; - "Ctrl+Alt+Delete".action.spawn = [ "wlogout" ]; - "Ctrl+Shift+Escape".action.spawn = [ "kitty" "btop" ]; - "Mod+Grave".action.spawn = [ "dunstctl" "set-paused" "toggle" ]; - - "Mod+N".action.spawn = [ "rofi-network-manager" ]; - "Mod+J".action.spawn-sh = "notify-send -u critical ${hostname} 'Caffein Mode' && notify-send '(SUPER+X to reset)' && systemctl --user stop hypridle"; - "Mod+Z".action.spawn = [ "dunstctl" "close-all" ]; - - "Mod+V".action.spawn = [ "rofi" "-modi" "clipboard:cliphist-rofi-img" "-show" "clipboard" "-show-icons" ]; - "Mod+A".action.spawn = [ "zeditor" ]; - "Mod+C".action.spawn = [ "kitty" "btop" ]; - "Mod+Shift+T".action.spawn-sh = "WAYLAND_DISPLAY=wayland-0 ${lib.getExe pkgs.kitty}"; - "Mod+Shift+F".action.spawn = [ (lib.getExe pkgs.labwc) ]; - "Mod+Shift+C".action.spawn = [ "kitty" "zsh" "-c" "fastfetch; exec zsh -i" ]; - "Mod+Shift+D".action.spawn = [ "steam" "-system-composer" "steam://open/bigpicture" ]; - "Mod+D".action.spawn = [ "prismlauncher" ]; - - "Mod+X".action.spawn-sh = "dunstctl close-all && pkill -SIGUSR2 waybar && systemctl --user restart awww hypridle"; - "Mod+K".action.spawn-sh = "notify-send -u critical ${hostname} 'Focus Mode' && notify-send '(SUPER+X to reset)' && systemctl --user stop awww && pkill -SIGUSR1 waybar"; - "Mod+L".action.spawn = [ "loginctl" "lock-session" ]; - }; +{ pkgs, hostname, ... }: { + services.fusuma = { + extraPackages = with pkgs; [ systemd coreutils-full xprop ]; + enable = true; + settings = { + swipe = { + "4".down.sendkey = "LEFTMETA+L"; + "4".up.sendkey = "LEFTMETA+M"; + "3".up.sendkey = "LEFTMETA+W"; + "3".down.sendkey = "LEFTMETA+DOWN"; + "3".right.sendkey = "LEFTMETA+LEFT"; + "3".left.sendkey = "LEFTMETA+RIGHT"; + }; + hold = { + "3".sendkey = "LEFTMETA+TAB"; + "4".sendkey = "LEFTMETA+SPACE"; + }; + }; + }; wayland.windowManager.hyprland = { settings = { gestures = { diff --git a/modules/home/rice/logout.nix b/modules/home/rice/logout.nix index cad5b72..da57d5a 100644 --- a/modules/home/rice/logout.nix +++ b/modules/home/rice/logout.nix @@ -4,13 +4,13 @@ layout = [ { label = "shutdown"; - action = "systemctl poweroff"; + action = "hyprshutdown -t 'Shutting down...' --post-cmd 'systemctl poweroff'"; text = "(S)hutdown"; keybind = "s"; } { label = "reboot"; - action = "systemctl reboot"; + action = "hyprshutdown -t 'Rebooting...' --post-cmd 'systemctl reboot'"; text = "(R)eboot"; keybind = "r"; } @@ -28,7 +28,7 @@ } { label = "logout"; - action = "niri msg action quit"; + action = "hyprshutdown -t 'Logging Out...' --post-cmd 'uwsm stop'"; text = "L(o)gout"; keybind = "o"; } diff --git a/modules/system/base.nix b/modules/system/base.nix index d62b589..2cdea36 100644 --- a/modules/system/base.nix +++ b/modules/system/base.nix @@ -16,14 +16,7 @@ i18n.defaultLocale = locale; environment.localBinInPath = true; - powerManagement.cpuFreqGovernor = "powersave"; - boot.kernel.sysctl."vm.swappiness" = 10; # only swap when necessary - security = { - polkit = { - enable = true; - enablePkexecWrapper = true; - }; sudo.configFile = '' Defaults insults Defaults passwd_tries = 5 diff --git a/modules/system/core/bootloader.nix b/modules/system/core/bootloader.nix index 20d65ec..cca3d3f 100644 --- a/modules/system/core/bootloader.nix +++ b/modules/system/core/bootloader.nix @@ -1,11 +1,12 @@ { pkgs, legacy-boot, ... }: { boot = { + plymouth.enable = true; loader = { efi.canTouchEfiVariables = true; systemd-boot = { enable = !legacy-boot; configurationLimit = 3; - sortKey = "nixos"; + sortKey = "z-nixos"; editor = false; }; grub = { diff --git a/modules/system/desktop.nix b/modules/system/desktop.nix index 0aeb936..9f31a27 100644 --- a/modules/system/desktop.nix +++ b/modules/system/desktop.nix @@ -1,8 +1,5 @@ -{ inputs, pkgs, enable-dm, ... }: { - nixpkgs.overlays = [ inputs.niri.overlays.niri ]; +{ pkgs, enable-dm, ... }: { imports = [ - inputs.niri.nixosModules.niri - ./misc/programs.nix ./misc/graphics.nix ./misc/theme.nix @@ -10,30 +7,18 @@ ./base.nix ]; - programs = { - nix-ld = { - enable = true; - libraries = with pkgs; [ - libxcursor libx11 libxi libxkbcommon - ]; - }; - niri = { - enable = true; - package = pkgs.niri-unstable; - }; - hyprland = { - enable = false; - withUWSM = true; - xwayland.enable = true; - package = pkgs.hyprland; # if rice.enable then inputs.hl.packages."${pkgs.system}".hyprland else pkgs.hyprland; - portalPackage = pkgs.xdg-desktop-portal-hyprland; # inputs.hl.packages.${pkgs.system}.xdg-desktop-portal-hyprland; - }; + programs.hyprland = { + enable = true; + withUWSM = true; + xwayland.enable = true; + package = pkgs.hyprland; # if rice.enable then inputs.hl.packages."${pkgs.system}".hyprland else pkgs.hyprland; + portalPackage = pkgs.xdg-desktop-portal-hyprland; # inputs.hl.packages.${pkgs.system}.xdg-desktop-portal-hyprland; }; xdg.portal = { enable = true; extraPortals = [ - pkgs.xdg-desktop-portal-luminous + pkgs.xdg-desktop-portal-hyprland #inputs.hl.packages.${pkgs.system}.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-gtk ]; }; diff --git a/modules/system/homelab/cdn.nix b/modules/system/homelab/cdn.nix index 28925f5..a2bd042 100644 --- a/modules/system/homelab/cdn.nix +++ b/modules/system/homelab/cdn.nix @@ -1,25 +1,13 @@ -{ pkgs, ... }: let - python = pkgs.python3.withPackages (ps: with ps; [ pillow argon2-cffi ]); - script = let - version = "v1.20.18"; - in pkgs.fetchurl { - url = "https://github.com/9001/copyparty/releases/download/${version}/copyparty-en.py"; - hash = "sha256-8SBrKaLPat80n8sONKQYFeFSQXUnCYtwcOU7SR52h7E="; - }; - executable = pkgs.writeShellScriptBin "copyparty" '' - exec ${python}/bin/python3 ${script} "$@" - ''; -in { - environment.systemPackages = [ executable ]; +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ copyparty-most ]; + systemd.services.copyparty = { description = "File Sharing Service"; enable = true; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; - path = [ pkgs.ffmpeg ]; serviceConfig = { - # ExecStart = "${pkgs.copyparty-most}/bin/copyparty -c /mnt/share/cfg/files.conf"; - ExecStart = "${python}/bin/python3 ${script} --ah-alg argon2 -c /mnt/share/cfg/files.conf"; + ExecStart = "${pkgs.copyparty-most}/bin/copyparty -c /mnt/share/cfg/files.conf"; Restart = "on-failure"; }; }; diff --git a/modules/system/homelab/containers.nix b/modules/system/homelab/containers.nix index 44bec89..2ca748c 100644 --- a/modules/system/homelab/containers.nix +++ b/modules/system/homelab/containers.nix @@ -32,8 +32,10 @@ in { RestartSec = lib.mkOverride 500 "100ms"; RestartSteps = lib.mkOverride 500 9; }; - after = [ "docker.service" "docker.socket" ]; - requires = [ "docker.service" "docker.socket" ]; - wantedBy = [ "multi-user.target" ]; + wantedBy = [ + "multi-user.target" + "network.target" + "docker.service" + ]; }; } diff --git a/modules/system/homelab/control.nix b/modules/system/homelab/control.nix deleted file mode 100644 index 9522910..0000000 --- a/modules/system/homelab/control.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ homelab, pkgs, ... }: { - services.cockpit = { - enable = true; - allowed-origins = [ "https://control.proxy.${homelab.domain}" ]; - plugins = with pkgs; [ - cockpit-files cockpit-machines - ]; - }; -} \ No newline at end of file diff --git a/modules/system/homelab/dash.nix b/modules/system/homelab/dash.nix index c6c14bb..d973699 100644 --- a/modules/system/homelab/dash.nix +++ b/modules/system/homelab/dash.nix @@ -1,4 +1,18 @@ { timezone, homelab, ... }: let + rss = [ + "https://www.raspberrypi.com/news/feed/" + "https://www.jeffgeerling.com/blog.xml" + "https://www.howtogeek.com/feed/" + "https://hackaday.com/feed/rss" + "https://www.xda-developers.com/feed/" + "https://9to5mac.com/feed/" + "https://9to5google.com/feed/" + "https://www.cnx-software.com/feed/" + "https://selfh.st/rss/" + "https://www.joshwcomeau.com/rss.xml" + "https://samwho.dev/rss.xml" + "https://ishadeed.com/feed.xml" + ]; yt = [ "UCXuqSBlHAE6Xw-yeJA0Tunw" # LinusTechTips "UCsBjURrPoezykLs9EqgamOA" # Fireship @@ -20,6 +34,24 @@ "UCGKEMK3s-ZPbjVOIuAV8clQ" # CoreDumped "UCWQaM7SpSECp9FELz-cHzuQ" # DreamsOfCode ]; + gh = [ + "tailscale/tailscale" + "glanceapp/glance" + "nixos/nixpkgs" + "ollama/ollama" + "nginx/nginx" + "oven-sh/bun" + ]; + search = [ + [ "Website" "!!" "https://{QUERY}" ] + [ "CVE" "!cve" "https://securityvulnerability.io/vulnerability/CVE-{QUERY}" ] + [ "YouTube" "!yt" "https://www.youtube.com/results?search_query={QUERY}" ] + [ "GitHub" "!gh" "https://github.com/search?q={QUERY}" ] + [ "Nix Packages" "!nix" "https://search.nixos.org/packages?channel=unstable&type=packages&query={QUERY}" ] + [ "Nix Options" "!opt" "https://mynixos.com/search?q={QUERY}" ] + [ "Flight Radar 24" "!f" "https://www.flightradar24.com/data/flights/{QUERY}" ] + [ "Google Web Results Only" "!s" "https://google.com/search?udm=14&q={QUERY}" ] + ]; monitor = [ [ "DNS" "http://localhost:8088/" ] [ "Proxy" "https://proxy.${homelab.domain}/" ] @@ -57,6 +89,104 @@ in { }; pages = [ + { + name = "Home"; + show-mobile-header = true; + columns = [ + { + size = "small"; + widgets = [ + { + type = "clock"; + hide-header = true; + hour-format = "12h"; + timezone = timezone; + } + { + type = "calendar"; + hide-header = true; + first-day-of-week = "monday"; + } + { + type = "rss"; + hide-header = true; + title = "rss"; + limit = 12; + cache = "12h"; + feeds = map (e: { url = e; }) rss; + } + ]; + } + { + size = "full"; + widgets = [ + { + type = "search"; + hide-header = true; + autofocus = true; + search-engine = "google"; + bangs = map (e: { + title = builtins.elemAt e 0; + shortcut = builtins.elemAt e 1; + url = builtins.elemAt e 2; + }) search; + } + { + type = "hacker-news"; + hide-header = true; + limit = 5; + cache = "1h"; + } + { + type = "videos"; + hide-header = true; + style = "grid-cards"; + limit = 18; + channels = yt; + } + ]; + } + { + size = "small"; + widgets = [ + { + type = "weather"; + hide-header = true; + location = "Jakarta, Indonesia"; + units = "metric"; + hour-format = "12h"; + } + { + type = "to-do"; + id = "tasks"; + hide-header = true; + } + { + type = "repository"; + repository = "is-a-dev/register"; + pull-requests-limit = 5; + issues-limit = 3; + commits-limit = 0; + hide-header = true; + } + { + type = "repository"; + repository = "partofmyid/register"; + pull-requests-limit = 5; + issues-limit = 3; + commits-limit = 0; + hide-header = true; + } + { + type = "releases"; + cache = "1d"; + hide-header = true; + repositories = gh; + } + ]; + } + ]; + } { name = "Dashboard"; show-mobile-header = true; @@ -152,74 +282,6 @@ in { } ]; } - { - name = "Home"; - show-mobile-header = true; - columns = [ - { - size = "small"; - widgets = [ - { - type = "clock"; - hide-header = true; - hour-format = "12h"; - timezone = timezone; - } - { - type = "calendar"; - hide-header = true; - first-day-of-week = "monday"; - } - ]; - } - { - size = "full"; - widgets = [ - { - type = "hacker-news"; - hide-header = true; - limit = 5; - cache = "1h"; - } - { - type = "videos"; - hide-header = true; - style = "grid-cards"; - limit = 18; - channels = yt; - } - ]; - } - { - size = "small"; - widgets = [ - { - type = "weather"; - hide-header = true; - location = "Jakarta, Indonesia"; - units = "metric"; - hour-format = "12h"; - } - { - type = "repository"; - repository = "is-a-dev/register"; - pull-requests-limit = 5; - issues-limit = 3; - commits-limit = 0; - hide-header = true; - } - { - type = "repository"; - repository = "partofmyid/register"; - pull-requests-limit = 5; - issues-limit = 3; - commits-limit = 0; - hide-header = true; - } - ]; - } - ]; - } ]; }; }; diff --git a/modules/system/homelab/dns.nix b/modules/system/homelab/dns.nix index ee7e512..a1ddbb3 100644 --- a/modules/system/homelab/dns.nix +++ b/modules/system/homelab/dns.nix @@ -21,13 +21,6 @@ whitelist = [ "https://gist.githubusercontent.com/mul14/eb05e88fcec5bb195cbb/raw/75a1fe122a4502e8d5a5268c9d0ec28332b19d5d/hosts" ]; - blocked = [ - # LOCK IN - "instagram" - "youtube" - "minecraft" - "steam" - ]; in { services.adguardhome = { enable = true; @@ -44,7 +37,6 @@ in { enabled = true; }; filtering = { - blocked_services.ids = blocked; blocking_mode = "null_ip"; protection_enabled = true; safebrowsing_enabled = true; diff --git a/modules/system/homelab/docs.nix b/modules/system/homelab/docs.nix new file mode 100644 index 0000000..58d6738 --- /dev/null +++ b/modules/system/homelab/docs.nix @@ -0,0 +1,46 @@ +{ lib, pkgs, homelab, ... }: let + domain = "docs.${homelab.domain}"; + sandbox = "docs-sandbox.${homelab.domain}"; +in { + services.cryptpad = { + enable = true; + settings = { + websocketPort = 7091; + httpPort = 7090; + httpAddress = "127.0.0.1"; + httpUnsafeOrigin = "https://${domain}"; + httpSafeOrigin = "https://${sandbox}"; + blockDailyCheck = true; + disableIntegratedEviction = true; + adminKeys = [ + "[satr14@docs.satr14.my.id/f1A82fmBuqQka2bNqrCb1WbB9r2ex5A3rdys5xLX3Hc=]" + ]; + }; + }; + + systemd.tmpfiles.rules = lib.singleton "L+ /var/lib/cryptpad/customize/application_config.js - - - - ${pkgs.writeText "cryptpad-application-config.js" '' + (() => { + const factory = (AppConfig) => { + AppConfig.disableAnonymousPadCreation = true; + AppConfig.disableAnonymousStore = true; + AppConfig.defaultDarkTheme = true; + return AppConfig; + }; + + if (typeof(module) !== 'undefined' && module.exports) { + module.exports = factory( + require('../www/common/application_config_internal.js') + ); + } else if ((typeof(define) !== 'undefined' && define !== null) && (define.amd !== null)) { + define(['/common/application_config_internal.js'], factory); + } + })(); + ''}"; + + fileSystems."/var/lib/private/cryptpad" = { + device = "/mnt/data/apps/cryptpad"; + depends = [ "/mnt/data" ]; + options = [ "bind" "nofail" ]; + fsType = "none"; + }; +} diff --git a/modules/system/homelab/gallery.nix b/modules/system/homelab/gallery.nix index 74d2ea2..1b52208 100644 --- a/modules/system/homelab/gallery.nix +++ b/modules/system/homelab/gallery.nix @@ -1,10 +1,4 @@ -{ pkgs, lib, ... }: { - # fix every update causing error: - # > microservices worker error: PostgresError: must be owner of function album_user_after_insert, stack: PostgresError: must be owner of function album_user_after_insert - systemd.services.postgresql.postStart = pkgs.lib.mkAfter '' - $PSQL -d immich -c "ALTER FUNCTION album_user_after_insert() OWNER TO immich;" || true - ''; - +{ lib, ... }: { users.users.immich.extraGroups = [ "video" "render" ]; services = { diff --git a/modules/system/homelab/git.nix b/modules/system/homelab/git.nix index e2a2c2e..db30c7a 100644 --- a/modules/system/homelab/git.nix +++ b/modules/system/homelab/git.nix @@ -20,8 +20,7 @@ ROOT_URL = "https://git.${homelab.domain}"; LANDING_PAGE = "explore"; }; - actions.DEFAULT_ACTIONS_URL = "https://git.satr14.my.id"; - oauth2_client.ENABLE_AUTO_REGISTRATION = true; + oauth2_client.ENABLE_AUTO_REGISTRATION=true; service = { DISABLE_REGISTRATION = true; ENABLE_OPENID_SIGNIN = false; @@ -32,10 +31,6 @@ ALLOW_ONLY_INTERNAL_REGISTRATION = false; REQUIRE_EXTERNAL_REGISTRATION_PASSWORD = true; }; - "service.explore" = { - DISABLE_USERS_PAGE = true; - DISABLE_ORGANIZATIONS_PAGE = true; - }; user.ENABLE_FOLLOWING = false; repository = { DISABLE_STARS = true; @@ -49,31 +44,8 @@ name = "nixos-server-runner"; url = "http://localhost:5080"; #"https://git.proxy.${homelab.domain}"; tokenFile = "/mnt/data/apps/forgejo/token-runner"; - labels = [ - "self-hosted:host" - "bun:docker://docker.io/oven/bun" - "debian:docker://docker.io/library/node:26-trixie-slim" - "aio:docker://git.satr14.my.id/satr14/aio-container:latest" - ]; - hostPackages = with pkgs; [ bash coreutils git nix openssh bun ]; - }; - renovate = { - enable = true; - schedule = "*:0"; # every hour - credentials.RENOVATE_TOKEN = "/mnt/data/apps/renovate/token.env"; - settings = { - platform = "forgejo"; - endpoint = "https://git.${homelab.domain}"; - gitAuthor = "renovate "; - autodiscover = true; - nix.enabled = true; - lockFileMaintenance = { - enabled = true; - commitMessageAction = "update lock file(s)"; - schedule = [ "* 0 * * 6" ]; # weekly, midnight Saturday - }; - }; - runtimePackages = with pkgs; [ bun nix ]; + labels = [ "self-hosted:host" ]; + hostPackages = with pkgs; [ bash coreutils git nix openssh nodejs ]; }; }; systemd.services = { diff --git a/modules/system/homelab/mc-backup.nix b/modules/system/homelab/mc-backup.nix new file mode 100644 index 0000000..1a2cb96 --- /dev/null +++ b/modules/system/homelab/mc-backup.nix @@ -0,0 +1,103 @@ +{ pkgs, ... }: let + serverName = "mc0-explorers-creativity"; + serviceName = "minecraft-server-${serverName}"; + backupDir = "/mnt/data/backups/mc"; + keepBackups = 7; # number of backups to retain + rconHost = "localhost"; + rconPort = "25575"; + rconPassword = "howdy"; + ntfyUrl = "http://127.0.0.1:8067"; + ntfyTopic = "mc-backup"; + + backupScript = pkgs.writeShellScriptBin "mc-backup" '' + set -euo pipefail + + rcon() { + ${pkgs.rcon-cli}/bin/rcon-cli --address "${rconHost}:${rconPort}" --password "${rconPassword}" "$@" || true + } + + BACKUP_OK=false + + on_exit() { + # Always restart the server first + echo "[mc-backup] Restarting server..." + systemctl start ${serviceName}.service + + # Notify via ntfy only on failure + if [ "$BACKUP_OK" != "true" ]; then + echo "[mc-backup] Sending failure notification..." + ${pkgs.curl}/bin/curl -s -o /dev/null \ + -H "Title: Minecraft Backup Failed" \ + -H "Priority: high" \ + -H "Tags: warning" \ + -d "Nightly backup failed at $(date '+%Y-%m-%d %H:%M:%S'). Check logs with: journalctl -u mc-backup -n 50" \ + "${ntfyUrl}/${ntfyTopic}" + fi + } + + # Always restart the server on exit, even if the script fails mid-backup + trap on_exit EXIT + + # --- Countdown warnings via RCON --- + echo "[mc-backup] Sending 5-minute warning..." + rcon "say §c[Backup] §fServer will restart in §e5 minutes §ffor a scheduled backup." + + sleep 240 + + echo "[mc-backup] Sending 1-minute warning..." + rcon "say §c[Backup] §fServer restarting in §e1 minute§f." + + sleep 50 + + echo "[mc-backup] Sending 10-second warning..." + rcon "say §c[Backup] §fServer restarting in §e10 seconds§f." + + sleep 10 + + rcon "say §c[Backup] §fShutting down now. Back shortly!" + + # --- Save world & stop --- + echo "[mc-backup] Saving world..." + rcon "save-all" + sleep 5 + + echo "[mc-backup] Stopping ${serviceName}..." + systemctl stop ${serviceName}.service + + # --- Backup --- + echo "[mc-backup] Backing up to ${backupDir}..." + mkdir -p "${backupDir}" + TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S) + XZ_OPT="-9e" tar -cJf "${backupDir}/mc-backup-$TIMESTAMP.tar.xz" \ + -C /srv/minecraft ${serverName} + + # Prune old backups, keeping the last ${toString keepBackups} + ls -t "${backupDir}"/mc-backup-*.tar.xz | tail -n +${toString (keepBackups + 1)} | xargs -r rm -- + + echo "[mc-backup] Backup complete: mc-backup-$TIMESTAMP.tar.xz" + BACKUP_OK=true + # Server restart is handled by the EXIT trap above + ''; +in { + environment.systemPackages = [ backupScript ]; + + systemd.services.mc-backup = { + description = "Nightly Minecraft server backup"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${backupScript}/bin/mc-backup"; + User = "root"; + StandardOutput = "journal"; + StandardError = "journal"; + }; + }; + + systemd.timers.mc-backup = { + description = "Nightly Minecraft backup timer"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "daily"; # fires at 00:00:00 every day + Persistent = true; # catch up if the machine was off at midnight + }; + }; +} diff --git a/modules/system/homelab/mc.nix b/modules/system/homelab/mc.nix new file mode 100644 index 0000000..276ab69 --- /dev/null +++ b/modules/system/homelab/mc.nix @@ -0,0 +1,109 @@ +{ inputs, lib, pkgs, ... }: let + ram-allocation = "10240M"; + # auth-server = "https://mc.satr14.my.id"; # TODO: self hosted drasl server + modpack = let + commit = "667aadf36aac9b0689289f4988a76b924bbb9cbc"; + in pkgs.fetchPackwizModpack { + packHash = "sha256-sNWuqTIpqnwxhoof5PkJXrvVE5x/wnhc3LoqomjYBNs="; + url = "https://git.satr14.my.id/satr14/server-modpack/raw/commit/${commit}/pack.toml"; + }; +in { + imports = [ inputs.mc.nixosModules.minecraft-servers ]; + nixpkgs.overlays = [ inputs.mc.overlay ]; + + services.minecraft-servers = { + enable = true; + eula = true; + managementSystem.systemd-socket.enable = true; # Referenced but unset environment variable evaluates to an empty string: MAINPID + # ^^^ https://github.com/Infinidoge/nix-minecraft/issues/119 + + servers.mc0-explorers-creativity = { + enable = true; + autoStart = true; + restart = "always"; + enableReload = false; # NOTE: development phase, disable in production + + package = pkgs.fabricServers.fabric-1_21_11.override { + jre_headless = pkgs.javaPackages.compiler.temurin-bin.jre-25; + loaderVersion = "0.19.2"; + }; + + jvmOpts = let + flags = [ + "-Xms${ram-allocation}" + "-Xmx${ram-allocation}" + "--add-modules=jdk.incubator.vector" + + # Custom auth server + # "-Dminecraft.api.env=custom" + # "-Dminecraft.api.auth.host=${auth-server}/auth" + # "-Dminecraft.api.account.host=${auth-server}/account" + # "-Dminecraft.api.profiles.host=${auth-server}/account" + # "-Dminecraft.api.session.host=${auth-server}/session" + # "-Dminecraft.api.services.host=${auth-server}/services" + + # Aikar's GC flags (tuned for 10GB) + "-XX:+UseG1GC" + "-XX:+ParallelRefProcEnabled" + "-XX:MaxGCPauseMillis=200" + "-XX:+UnlockExperimentalVMOptions" + "-XX:+DisableExplicitGC" + "-XX:+AlwaysPreTouch" + "-XX:G1HeapWastePercent=5" + "-XX:G1MixedGCCountTarget=4" + "-XX:InitiatingHeapOccupancyPercent=15" + "-XX:G1MixedGCLiveThresholdPercent=90" + "-XX:G1RSetUpdatingPauseTimePercent=5" + "-XX:SurvivorRatio=32" + "-XX:+PerfDisableSharedMem" + "-XX:MaxTenuringThreshold=1" + "-Dusing.aikars.flags=https://mcflags.emc.gs" + "-Daikars.new.flags=true" + "-XX:G1NewSizePercent=30" + "-XX:G1MaxNewSizePercent=40" + "-XX:G1HeapRegionSize=8M" + "-XX:G1ReservePercent=20" + ]; + in lib.concatStringsSep " " flags; + + serverProperties = { + server-port = 25565; + server-name = "Digit Association"; + motd = "§lSeason 3 TESTING§r - §dExplorers Creativity 🔥"; + + difficulty = "normal"; + gamemode = "survival"; + max-world-size = 25000; + spawn-protection = 0; + pvp = true; + + online-mode = true; + enable-query = true; + enforce-secure-profile = false; + pevent-proxy-connections = false; + allow-flight = false; + player-idle-timeout = 0; + + # resource-pack = "https://cdn.satr14.my.id/public/fullslide-1.21.11.zip"; + # resource-pack-sha1 = "e0958dcef5755286f390c22280700c471ec34a65"; + # resource-pack-enforce = false; + + simulation-distance = 16; + view-distance = 4; + + enable-rcon = true; + sync-chunk-writes = false; + "rcon.password" = "howdy"; + "rcon.port" = 25575; + }; + + symlinks = { + # "resources/datapack/required" = "${modpack}/datapacks"; + "mods" = "${modpack}/mods"; + + # "server-icon.png" = "${modpack}/server-icon.png"; + # "config" = ""; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/system/homelab/mc/default.nix b/modules/system/homelab/mc/default.nix deleted file mode 100644 index a452cfd..0000000 --- a/modules/system/homelab/mc/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ inputs, ... }: { - imports = [ - ./mc0-vanilla-plus.nix - ./mc1-pure-vanilla.nix - inputs.mc.nixosModules.minecraft-servers - ]; - nixpkgs.overlays = [ inputs.mc.overlay ]; - - services.minecraft-servers = { - # LOCK IN - enable = false; - eula = true; - managementSystem.systemd-socket.enable = true; - # ^^^ https://github.com/Infinidoge/nix-minecraft/issues/119 - }; -} \ No newline at end of file diff --git a/modules/system/homelab/mc/mc0-vanilla-plus.nix b/modules/system/homelab/mc/mc0-vanilla-plus.nix deleted file mode 100644 index 5240835..0000000 --- a/modules/system/homelab/mc/mc0-vanilla-plus.nix +++ /dev/null @@ -1,120 +0,0 @@ -{ inputs, lib, pkgs, ... }: let - name = "mc0-vanilla-plus"; - ram-allocation-mb = 8192; - headroom-allocation-mb = 1024; - rcon-pass = "howdy"; - ports = { - minecraft = 25565; - rcon = 25575; - }; - - modpack = let - useLatest = false; - commit = "86bf13316ed1352a676d9056d284448ea5e5a079"; - path = if !useLatest then "commit/${commit}" else "branch/main"; - in pkgs.fetchPackwizModpack { - packHash = "sha256-sc6vekjddYpwY2Hp3uZ/xFiXyPd4kfwcZVO/pKRRBwQ="; - url = "https://git.satr14.my.id/satr14/server-modpack/raw/${path}/pack.toml"; - }; -in { - systemd.services."minecraft-server-${name}" = { - environment.LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib"; # physics toys mod fix - # serviceConfig.Nice = -5; # higher scheduling priority (causes fan noise even when idle) - }; - - services.minecraft-servers.servers.${name} = { - enable = false; - autoStart = true; - restart = "always"; - - serverProperties = { - server-ip = "0.0.0.0"; - server-port = ports.minecraft; - server-name = name; - motd = "§cCan't connect to server"; - log-ips = false; - hide-online-players = true; - - difficulty = "normal"; - gamemode = "survival"; - max-world-size = 25000; - spawn-protection = 0; - pvp = true; - - online-mode = true; - enable-query = true; - enforce-secure-profile = false; - pevent-proxy-connections = false; - allow-flight = false; - player-idle-timeout = 0; - - view-distance = 12; - simulation-distance = 6; - - enable-rcon = true; - sync-chunk-writes = false; - "rcon.password" = rcon-pass; - "rcon.port" = ports.rcon; - }; - - symlinks = inputs.mc.lib.collectFilesAt modpack "mods" // { - "polymer/packsquash" = let packsquash-binary = pkgs.runCommand "packsquash" { - src = pkgs.fetchurl { - url = "https://github.com/ComunidadAylas/PackSquash/releases/download/v0.4.1/packsquash-x86_64-unknown-linux-gnu.zip"; - sha256 = "sha256-VsGZewoiO5MjhIhwjlLO5d5uHynlAK5Jh16jH2k2rPs="; - }; - nativeBuildInputs = [ pkgs.unzip ]; - } '' - mkdir -p $out/bin - unzip $src -d $out/bin - chmod +x $out/bin/packsquash - ''; in "${packsquash-binary}/bin/packsquash"; - }; - - files = inputs.mc.lib.collectFilesAt modpack "config" // { - "config/proxy_protocol_support.json".value = { - enableProxyProtocol = false; # polymer auto host has issues with proxy protocol - whitelistTCPShieldServers = false; - proxyServerIPs = [ "127.0.0.1" "::1" ]; - directAccessIPs = [ "127.0.0.0/8" "::1/128" ]; - }; - }; - - extraStartPre = let sed-commands = lib.concatStringsSep "\n" ( - lib.mapAttrsToList (substitution: file: - ''sed -i "s|${substitution}|''${${substitution}}|g" ${file}'' - ) { - "REPLACE_SVC_HOST" = "config/voicechat/voicechat-server.properties"; - "REPLACE_RP_LINK" = "config/welcomemessage.json5"; - "REPLACE_DC_BOT_TOKEN" = "config/simple-discord-link/simple-discord-link.toml"; - "REPLACE_DC_OWNER_ROLE" = "config/simple-discord-link/simple-discord-link.toml"; - } - ); in '' - # shellcheck disable=SC1091 - if [ -f modpack-config.env ]; then - source modpack-config.env - ${sed-commands} - fi - ''; - - package = pkgs.fabricServers.fabric-1_21_11.override { - jre_headless = pkgs.javaPackages.compiler.temurin-bin.jdk-25; - loaderVersion = "0.19.2"; - }; - - jvmOpts = let flags = [ - "-Xms${toString ram-allocation-mb}M" - "-Xmx${toString ram-allocation-mb}M" - - "-XX:+UseZGC" # Use ZGC (requires Java v25+, 8+ CPU cores, 10GB+ RAM) - "-XX:+ZGenerational" # Use generational ZGC (newer and better ZGC, requires Java v21+) - "-XX:+UseCompactObjectHeaders" # Use compact object headers (requires Java v16+, saves a couple of bits per object) - - "--add-modules=jdk.incubator.vector" # Exposes SIMD instructions (requires full JDK, useful with performance mods like C2ME) - "-XX:+AlwaysPreTouch" # Pre-allocates memory on startup, OS claims it immediately for JVM instead of negotiating it - "-XX:+DisableExplicitGC" # Disables mods from manually invoking the GC - "-XX:+PerfDisableSharedMem" # Disables constant /tmp writes for JVM metrics - "-XX:SoftMaxHeapSize=${toString (ram-allocation-mb - headroom-allocation-mb)}M" # Leave 2GB headroom - ]; in lib.concatStringsSep " " flags; - }; -} \ No newline at end of file diff --git a/modules/system/homelab/mc/mc1-pure-vanilla.nix b/modules/system/homelab/mc/mc1-pure-vanilla.nix deleted file mode 100644 index 9268e35..0000000 --- a/modules/system/homelab/mc/mc1-pure-vanilla.nix +++ /dev/null @@ -1,81 +0,0 @@ -{ inputs, lib, pkgs, ... }: let - name = "mc1-pure-vanilla"; - ram-allocation-mb = 8192; - headroom-allocation-mb = 1024; - rcon-pass = "howdy"; - ports = { - minecraft = 25566; - rcon = 25576; - }; - - modpack = pkgs.fetchModrinthModpack { - url = "https://cdn.modrinth.com/data/2wkV8mHp/versions/mFGJP1Ye/Server%20Optimization%201.21.11-2.1.mrpack"; - packHash = "sha256-odvJs6s1/T13RQhE3NnpCIrulc98nd9vo9Alg/aU404="; - side = "server"; - }; -in { - services.minecraft-servers.servers.${name} = { - enable = false; - autoStart = true; - restart = "always"; - - serverProperties = { - server-ip = "0.0.0.0"; - server-port = ports.minecraft; - server-name = name; - motd = "§cCan't connect to server"; - log-ips = false; - hide-online-players = true; - - difficulty = "normal"; - gamemode = "survival"; - max-world-size = 25000; - spawn-protection = 0; - pvp = true; - - online-mode = true; - enable-query = true; - enforce-secure-profile = false; - pevent-proxy-connections = false; - allow-flight = false; - player-idle-timeout = 0; - - view-distance = 10; - simulation-distance = 4; - - enable-rcon = true; - sync-chunk-writes = false; - "rcon.password" = rcon-pass; - "rcon.port" = ports.rcon; - }; - - files = inputs.mc.lib.collectFilesAt modpack "config"; - symlinks = inputs.mc.lib.collectFilesAt modpack "mods" // { - mods = pkgs.linkFarmFromDrvs "mods" (builtins.attrValues { - EasyAuth = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/aZj58GfX/versions/R4EX0C3V/easyauth-mc1.21.11-3.4.3.jar"; hash = "sha256-T1PfPlyfkieOCsfoab+BpW8pB/CSDKlxGrS5FMgSMEU="; }; - Floodgate = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/bWrNNfkb/versions/81EuNxeZ/Floodgate-Fabric-2.2.6-b60.jar"; hash = "sha256-voH1QWv5GVm6EziJ3ERPjn5cx09/et73QiZlJ7l3foM="; }; - Geyser = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/wKkoqHrH/versions/6uw7I3Qj/geyser-fabric-Geyser-Fabric-2.9.6-b1133.jar"; hash = "sha256-aWMlDdHvNz6VaLVPdmO01YBAlQ7m4w8aUe47TbXxM60="; }; - }); - }; - - package = pkgs.fabricServers.fabric-1_21_11.override { - jre_headless = pkgs.javaPackages.compiler.temurin-bin.jdk-25; - loaderVersion = "0.19.2"; - }; - - jvmOpts = let flags = [ - "-Xms${toString ram-allocation-mb}M" - "-Xmx${toString ram-allocation-mb}M" - - "-XX:+UseZGC" # Use ZGC (requires Java v25+, 8+ CPU cores, 10GB+ RAM) - "-XX:+ZGenerational" # Use generational ZGC (newer and better ZGC, requires Java v21+) - "-XX:+UseCompactObjectHeaders" # Use compact object headers (requires Java v16+, saves a couple of bits per object) - - "--add-modules=jdk.incubator.vector" # Exposes SIMD instructions (requires full JDK, useful with performance mods like C2ME) - "-XX:+AlwaysPreTouch" # Pre-allocates memory on startup, OS claims it immediately for JVM instead of negotiating it - "-XX:+DisableExplicitGC" # Disables mods from manually invoking the GC - "-XX:+PerfDisableSharedMem" # Disables constant /tmp writes for JVM metrics - "-XX:SoftMaxHeapSize=${toString (ram-allocation-mb - headroom-allocation-mb)}M" # Leave 2GB headroom - ]; in lib.concatStringsSep " " flags; - }; -} \ No newline at end of file diff --git a/modules/system/homelab/mc/mc2-create-aeronautics.nix b/modules/system/homelab/mc/mc2-create-aeronautics.nix deleted file mode 100644 index 03f96f8..0000000 --- a/modules/system/homelab/mc/mc2-create-aeronautics.nix +++ /dev/null @@ -1,120 +0,0 @@ -{ inputs, lib, pkgs, ... }: let - name = "mc2-create-aeronautics"; - ram-allocation-mb = 12288; - headroom-allocation-mb = 2048; - rcon-pass = "howdy"; - ports = { - minecraft = 25567; - rcon = 25577; - }; - - modpack = let - useLatest = true; - commit = ""; - path = if !useLatest then "commit/${commit}" else "branch/main"; - in pkgs.fetchPackwizModpack { - packHash = ""; - url = "https://git.satr14.my.id/satr14/create-modpack/raw/${path}/pack.toml"; - }; -in { - systemd.services."minecraft-server-${name}" = { - environment.LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib"; # physics toys mod fix - # serviceConfig.Nice = -5; # higher scheduling priority (causes fan noise even when idle) - }; - - services.minecraft-servers.servers.${name} = { - enable = false; - autoStart = true; - restart = "always"; - - serverProperties = { - server-ip = "0.0.0.0"; - server-port = ports.minecraft; - server-name = name; - motd = "§cCan't connect to server"; - log-ips = false; - hide-online-players = true; - - difficulty = "normal"; - gamemode = "survival"; - max-world-size = 25000; - spawn-protection = 0; - pvp = true; - - online-mode = true; - enable-query = true; - enforce-secure-profile = false; - pevent-proxy-connections = false; - allow-flight = false; - player-idle-timeout = 0; - - view-distance = 12; - simulation-distance = 6; - - enable-rcon = true; - sync-chunk-writes = false; - "rcon.password" = rcon-pass; - "rcon.port" = ports.rcon; - }; - - symlinks = inputs.mc.lib.collectFilesAt modpack "mods" // { - "polymer/packsquash" = let packsquash-binary = pkgs.runCommand "packsquash" { - src = pkgs.fetchurl { - url = "https://github.com/ComunidadAylas/PackSquash/releases/download/v0.4.1/packsquash-x86_64-unknown-linux-gnu.zip"; - sha256 = "sha256-VsGZewoiO5MjhIhwjlLO5d5uHynlAK5Jh16jH2k2rPs="; - }; - nativeBuildInputs = [ pkgs.unzip ]; - } '' - mkdir -p $out/bin - unzip $src -d $out/bin - chmod +x $out/bin/packsquash - ''; in "${packsquash-binary}/bin/packsquash"; - }; - - files = inputs.mc.lib.collectFilesAt modpack "config" // { - "config/proxy_protocol_support.json".value = { - enableProxyProtocol = false; # polymer auto host has issues with proxy protocol - whitelistTCPShieldServers = false; - proxyServerIPs = [ "127.0.0.1" "::1" ]; - directAccessIPs = [ "127.0.0.0/8" "::1/128" ]; - }; - }; - - extraStartPre = let sed-commands = lib.concatStringsSep "\n" ( - lib.mapAttrsToList (substitution: file: - ''sed -i "s|${substitution}|''${${substitution}}|g" ${file}'' - ) { - "REPLACE_SVC_HOST" = "config/voicechat/voicechat-server.properties"; - "REPLACE_RP_LINK" = "config/welcomemessage.json5"; - "REPLACE_DC_BOT_TOKEN" = "config/simple-discord-link/simple-discord-link.toml"; - "REPLACE_DC_OWNER_ROLE" = "config/simple-discord-link/simple-discord-link.toml"; - } - ); in '' - # shellcheck disable=SC1091 - if [ -f modpack-config.env ]; then - source modpack-config.env - ${sed-commands} - fi - ''; - - package = pkgs.fabricServers.fabric-1_21_11.override { - jre_headless = pkgs.javaPackages.compiler.temurin-bin.jdk-25; - loaderVersion = "0.19.2"; - }; - - jvmOpts = let flags = [ - "-Xms${toString ram-allocation-mb}M" - "-Xmx${toString ram-allocation-mb}M" - - "-XX:+UseZGC" # Use ZGC (requires Java v25+, 8+ CPU cores, 10GB+ RAM) - "-XX:+ZGenerational" # Use generational ZGC (newer and better ZGC, requires Java v21+) - "-XX:+UseCompactObjectHeaders" # Use compact object headers (requires Java v16+, saves a couple of bits per object) - - "--add-modules=jdk.incubator.vector" # Exposes SIMD instructions (requires full JDK, useful with performance mods like C2ME) - "-XX:+AlwaysPreTouch" # Pre-allocates memory on startup, OS claims it immediately for JVM instead of negotiating it - "-XX:+DisableExplicitGC" # Disables mods from manually invoking the GC - "-XX:+PerfDisableSharedMem" # Disables constant /tmp writes for JVM metrics - "-XX:SoftMaxHeapSize=${toString (ram-allocation-mb - headroom-allocation-mb)}M" # Leave 2GB headroom - ]; in lib.concatStringsSep " " flags; - }; -} \ No newline at end of file diff --git a/modules/system/homelab/proxy.nix b/modules/system/homelab/proxy.nix index 5a03057..d977892 100644 --- a/modules/system/homelab/proxy.nix +++ b/modules/system/homelab/proxy.nix @@ -8,7 +8,6 @@ proxy_cache off; send_timeout 600s; client_max_body_size 50000M; - proxy_ssl_session_reuse off; ''; in { users.users = { diff --git a/modules/system/misc/programs.nix b/modules/system/misc/programs.nix index acc3a7e..778858b 100644 --- a/modules/system/misc/programs.nix +++ b/modules/system/misc/programs.nix @@ -16,8 +16,7 @@ }; programs = { - # LOCK IN - # steam.enable = true; + steam.enable = true; gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; appimage = { enable = true; diff --git a/modules/system/misc/theme.nix b/modules/system/misc/theme.nix index 2c588fd..e0754ff 100644 --- a/modules/system/misc/theme.nix +++ b/modules/system/misc/theme.nix @@ -7,7 +7,6 @@ catppuccin = { enable = true; - autoEnable = true; flavor = ctp-opt.flavor; accent = ctp-opt.accent; }; diff --git a/modules/system/misc/utilities.nix b/modules/system/misc/utilities.nix index a637e8d..de5d35e 100644 --- a/modules/system/misc/utilities.nix +++ b/modules/system/misc/utilities.nix @@ -8,7 +8,6 @@ ntfs3g exfatprogs smartmontools - rclone ncdu ventoy-full-qt diff --git a/modules/system/server.nix b/modules/system/server.nix index 7213cdc..0916649 100644 --- a/modules/system/server.nix +++ b/modules/system/server.nix @@ -11,7 +11,6 @@ in { ./homelab/containers.nix ./homelab/gallery.nix ./homelab/tunnels.nix - ./homelab/control.nix ./homelab/notify.nix ./homelab/search.nix ./homelab/media.nix @@ -20,12 +19,14 @@ in { ./homelab/pass.nix ./homelab/dash.nix ./homelab/code.nix + ./homelab/docs.nix ./homelab/dns.nix ./homelab/git.nix ./homelab/cdn.nix ./homelab/ai.nix ./homelab/db.nix - ./homelab/mc + ./homelab/mc.nix + ./homelab/mc-backup.nix ./core/swapfile.nix ./core/oom.nix @@ -35,17 +36,14 @@ in { users.users.root.openssh.authorizedKeys.keys = homelab.ssh-keys; - services = { - netbird.enable = true; - tailscale = { - enable = true; - authKeyFile = "/mnt/data/apps/tailscale/authkey"; - useRoutingFeatures = "server"; - extraUpFlags = ts-flags; - extraSetFlags = ts-flags; - }; + services.tailscale = { + enable = true; + authKeyFile = "/mnt/data/apps/tailscale/authkey"; + useRoutingFeatures = "server"; + extraUpFlags = ts-flags; + extraSetFlags = ts-flags; }; - + virtualisation = { oci-containers.backend = "docker"; docker = { diff --git a/modules/system/user.nix b/modules/system/user.nix index 74a8b45..44910e9 100644 --- a/modules/system/user.nix +++ b/modules/system/user.nix @@ -7,7 +7,6 @@ shell = pkgs.zsh; extraGroups = [ "networkmanager" - "minecraft" "wheel" "dialout" "libvirtd" @@ -17,8 +16,6 @@ "plugdev" "adbusers" "kvm" - "video" - "render" ]; }; } diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 7190a60..0000000 --- a/renovate.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json" -}