diff --git a/README.md b/README.md index 608b9c6..cbecb51 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ include_toc: true ### 🐬 Totsugeki | Desktop -Main desktop configuration +Desktop with NixOS as a primary system and Windows 11 N as secondary. Has secure boot support. #### Programs @@ -49,24 +49,21 @@ Main desktop configuration #### Services +**Still a WIP** + | Name | Type | Public-facing | | -----------: | :----------------------------- | :-----------: | | Nginx | Web server and reverse proxy | x | -| ACME | Automatic SSL cert renew | | -| Inadyn | Automatic DDNS updates | | -| PostgreSQL | Database engine | | -| PgAdmin4 | PostgreSQL management tool | | +| PostgreSQL | Database engine | | Forgejo | Git repository | x | -| Fabric | Minecraft server | x | +| PaperMC | Minecraft server | x | | AdGuard Home | DNS server and content blocker | | +| Invidious | YouTube proxy | | | SearXNG | Metasearch engine | | | Radicale | CalDAV / CardDAV server | | -| Jellyfin | Media server | x | -| Koito | Scrobbler | x | -| Vaultwarden | Password manager | | -### 🎀 Mizuki | Development on WSL +### 🎀 Mizuki | WSL development setup -Windows Subsystem for Linux configuration +An experimental configuration for software development inside Windows Subsystem for Linux. -Uses the common Neovim and zsh config +Inherits the Nixvim configuration from totsugeki diff --git a/flake.lock b/flake.lock index d4c6f88..6442bd2 100644 --- a/flake.lock +++ b/flake.lock @@ -128,22 +128,6 @@ "type": "github" } }, - "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1747046372, - "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -225,24 +209,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -396,26 +362,6 @@ "type": "github" } }, - "nix-minecraft": { - "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1750823009, - "narHash": "sha256-cawpGKdtw+2ai/fqvz+B8ge/iaX2CzbcDb39GiW5gt4=", - "owner": "Infinidoge", - "repo": "nix-minecraft", - "rev": "67cc1a9c77957e6749f38851c04ffbee6e0d4a4d", - "type": "github" - }, - "original": { - "owner": "Infinidoge", - "repo": "nix-minecraft", - "type": "github" - } - }, "nix-unit": { "inputs": { "flake-parts": [ @@ -445,7 +391,7 @@ }, "nixos-wsl": { "inputs": { - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_2", "nixpkgs": [ "nixpkgs" ] @@ -498,22 +444,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1748929857, - "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1750741721, "narHash": "sha256-Z0djmTa1YmnGMfE9jEe05oO4zggjDmxOGKwt844bUhE=", @@ -529,7 +459,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { "lastModified": 1750731501, "narHash": "sha256-Ah4qq+SbwMaGkuXCibyg+Fwn00el4KmI3XFX6htfDuk=", @@ -548,9 +478,9 @@ "nixvim": { "inputs": { "flake-parts": "flake-parts_3", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_3", "nuschtosSearch": "nuschtosSearch", - "systems": "systems_4" + "systems": "systems_3" }, "locked": { "lastModified": 1750788551, @@ -568,7 +498,7 @@ }, "nuschtosSearch": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "ixx": "ixx", "nixpkgs": [ "nixvim", @@ -622,9 +552,8 @@ "autofirma-nix": "autofirma-nix", "home-manager": "home-manager_2", "lanzaboote": "lanzaboote", - "nix-minecraft": "nix-minecraft", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "nixvim": "nixvim", "sops-nix": "sops-nix" } @@ -715,21 +644,6 @@ "type": "github" } }, - "systems_4": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 5e58077..ae2ed87 100644 --- a/flake.nix +++ b/flake.nix @@ -29,11 +29,9 @@ url = "github:nix-community/NixOS-WSL/main"; inputs.nixpkgs.follows = "nixpkgs"; }; - nix-minecraft.url = "github:Infinidoge/nix-minecraft"; }; nixConfig = { - download-buffer-size = 524288000; # 500 MB extra-substituters = [ "https://nix-community.cachix.org" ]; extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" @@ -45,7 +43,6 @@ # Desktop computer totsugeki = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit inputs; }; modules = [ ./common/nixos.nix ./hosts/totsugeki/nixos @@ -72,14 +69,12 @@ # Home server greatyamada = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit inputs; }; modules = [ ./common/nixos.nix ./hosts/greatyamada/nixos ./hosts/greatyamada/services inputs.sops-nix.nixosModules.sops inputs.home-manager.nixosModules.home-manager - inputs.nix-minecraft.nixosModules.minecraft-servers { home-manager = { backupFileExtension = "bak"; @@ -98,7 +93,6 @@ # WSL development system mizuki = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit inputs; }; modules = [ ./hosts/mizuki/nixos.nix inputs.nixos-wsl.nixosModules.default diff --git a/hosts/greatyamada/services/_port-definitions.nix b/hosts/greatyamada/services/_port-definitions.nix index d4a310b..564e7e8 100644 --- a/hosts/greatyamada/services/_port-definitions.nix +++ b/hosts/greatyamada/services/_port-definitions.nix @@ -1,14 +1,11 @@ { - tcp = { - minecraft = 13914; - - }; adguardhome-dns = 53; adguardhome-http = 3001; adguardhome-dhcp-udp = 67; forgejo-http = 3000; jellyfin-http = 8096; koito = 4110; + minecraft = 13914; navidrome-https = 4533; nginx-https = 443; ntfy-http = 2586; diff --git a/hosts/greatyamada/services/minecraft/bukkit.yml b/hosts/greatyamada/services/minecraft/bukkit.yml new file mode 100644 index 0000000..c3528dc --- /dev/null +++ b/hosts/greatyamada/services/minecraft/bukkit.yml @@ -0,0 +1,33 @@ +# Managed by NixOS configuration +settings: + use-map-color-cache: true + allow-end: true + warn-on-overload: true + permissions-file: permissions.yml + update-folder: update + plugin-profiling: false + connection-throttle: 4000 + query-plugins: true + deprecated-verbose: default + shutdown-message: Servidor cerrado + minimum-api: none +spawn-limits: + axolotls: 5 + water-underground-creature: 5 + monsters: 120 + animals: 20 + water-animals: 5 + water-ambient: 20 + ambient: 15 +chunk-gc: + period-in-ticks: 600 +ticks-per: + axolotl-spawns: 1 + water-underground-creature-spawns: 1 + animal-spawns: 400 + monster-spawns: 1 + water-spawns: 1 + water-ambient-spawns: 1 + ambient-spawns: 1 + autosave: 6000 +aliases: now-in-commands.yml diff --git a/hosts/greatyamada/services/minecraft/default.nix b/hosts/greatyamada/services/minecraft/default.nix index 868df3c..485a6af 100644 --- a/hosts/greatyamada/services/minecraft/default.nix +++ b/hosts/greatyamada/services/minecraft/default.nix @@ -1,116 +1,78 @@ -{ config, lib, pkgs, inputs, ... }: +{ config, lib, pkgs, ... }: let + cfg = config.services.minecraft-server; + + bukkitConfigFile = ./bukkit.yml; + + spigotConfigFile = ./spigot.yml; + + cfgToString = v: if builtins.isBool v then lib.boolToString v else toString v; + + eulaFile = builtins.toFile "eula.txt" '' + # eula.txt managed by NixOS configuration + eula=true + ''; + + opsFile = builtins.toFile "ops.json" (builtins.toJSON [{ + name = "aveeeeryy"; + uuid = "b65a1bc3-c6a0-4e8c-99b8-3538cfec0cfc"; + level = 4; + bypassesPlayerLimit = true; + }]); + + serverPropertiesFile = pkgs.writeText "server.properties" ('' + # server.properties managed by NixOS configuration + '' + lib.concatStringsSep "\n" + (lib.mapAttrsToList (n: v: "${n}=${cfgToString v}") cfg.serverProperties)); + serverIcon = ./server-icon.png; - players = import ./players.nix; - ports = import ../_port-definitions.nix; - packageNameToHumanString = packageName: - (let - getSections = packageName: - # Probably only matches Fabric servers, change as needed - builtins.match - "^minecraft-server-([0-9a-zA-Z.]*)-([a-zA-Z-]*)-([0-9a-zA-Z.]*)$" - packageName; - sections = (getSections packageName); - getSection = idx: - if sections == null then "Unknown" else builtins.elemAt sections idx; - in "Minecraft ${getSection 0} with ${ - lib.strings.toSentenceCase (getSection 1) - } ${getSection 2}"); - playersToOps = players: - map (player: { - name = player.name; - uuid = player.uuid; - level = 4; - bypassesPlayerLimit = true; - }) players; + in { - environment.systemPackages = with pkgs; [ mcrcon ]; - networking.firewall.allowedTCPPorts = with ports.tcp; [ minecraft ]; - nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; - services.minecraft-servers = { - enable = true; + services.minecraft-server = { + enable = false; + package = pkgs.papermc; + declarative = true; eula = true; - environmentFile = config.sops.templates."minecraft.env".path; - managementSystem = { - tmux.enable = false; - systemd-socket.enable = true; - }; - servers.fabric_prod = { - enable = true; - package = pkgs.fabricServers.fabric-1_21_6; - enableReload = true; - autoStart = false; - jvmOpts = - "-Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -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"; - serverProperties = { - difficulty = "hard"; - enable-rcon = true; - enable-query = false; - enforce-secure-profile = false; - enforce-whitelist = true; - hide-online-players = true; - max-players = 10; - motd = "${ - packageNameToHumanString - config.services.minecraft-servers.servers.fabric_prod.package.name - } on ${config.networking.hostName}"; - online-mode = true; - pause-when-empty-seconds = 60; - pvp = true; - "rcon.password" = "@MINECRAFT_RCON_PASSWORD@"; - server-port = ports.tcp.minecraft; - simulation-distance = 10; - spawn-protection = 0; - view-distance = 10; - white-list = true; - }; - symlinks = { - "server-icon.png" = serverIcon; - "mods/Fabric-API.jar" = pkgs.fetchurl { - url = - "https://cdn.modrinth.com/data/P7dR8mSH/versions/b2dnY6PN/fabric-api-0.128.0%2B1.21.6.jar"; - sha512 = - "c668402e1a877c2d572d16e31e6d2783be27a80993fa83bf040ea2007994518786bd3140dcea15334f8ee1630836292b8ae4d41444e47cba0ac43d05f1eb1e78"; - }; - "mods/Ferrite-Core.jar" = pkgs.fetchurl { - url = - "https://cdn.modrinth.com/data/uXXizFIs/versions/CtMpt7Jr/ferritecore-8.0.0-fabric.jar"; - sha512 = - "131b82d1d366f0966435bfcb38c362d604d68ecf30c106d31a6261bfc868ca3a82425bb3faebaa2e5ea17d8eed5c92843810eb2df4790f2f8b1e6c1bdc9b7745"; - }; - "mods/Lithium.jar" = pkgs.fetchurl { - url = - "https://cdn.modrinth.com/data/gvQqBUqZ/versions/XWGBHYcB/lithium-fabric-0.17.0%2Bmc1.21.6.jar"; - sha512 = - "a8d6a8b69ae2b10dd0cf8f8149260d5bdbd2583147462bad03380014edd857852972b967d97df69728333d8836b1e9db8997712ea26365ddb8a05b8c845c6534"; - }; - "mods/Krypton.jar" = pkgs.fetchurl { - url = - "https://cdn.modrinth.com/data/fQEb0iXm/versions/neW85eWt/krypton-0.2.9.jar"; - sha512 = - "2e2304b1b17ecf95783aee92e26e54c9bfad325c7dfcd14deebf9891266eb2933db00ff77885caa083faa96f09c551eb56f93cf73b357789cb31edad4939ffeb"; - }; - "mods/spark.jar" = pkgs.fetchurl { - url = - "https://cdn.modrinth.com/data/l6YH9Als/versions/qW2mPW6y/spark-1.10.139-fabric.jar"; - sha512 = - "cd991acee93c074912f2934b5a9c3967be2f1e9157ca5a7254fd3fce8d280c5aa9a3ab06d3ee19f06c5111181853cf12048d000bf8b9f722c902c080fe258a97"; - }; - }; - files = { - "ops.json".value = playersToOps (with players; [ engullejamones ]); - "whitelist.json".value = with players; [ engullejamones dankoszz ]; - }; + openFirewall = true; + jvmOpts = + "-Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -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"; + serverProperties = { + difficulty = "hard"; + enable-rcon = false; + enforce-secure-profile = false; + enforce-whitelist = true; + hide-online-players = true; + motd = "NixOS server"; + online-mode = true; + pvp = true; + server-port = 13914; + spawn-protection = 0; + white-list = true; }; + dataDir = "/minecraft"; }; - sops = { - secrets."minecraft_rcon".owner = "minecraft"; - templates."minecraft.env" = { - content = '' - MINECRAFT_RCON_PASSWORD=${config.sops.placeholder."minecraft_rcon"} - ''; - owner = "minecraft"; - }; - }; - users.groups.minecraft.members = [ "avery" ]; + # Overriden to have a non-declarative whitelist + systemd.services.minecraft-server.preStart = lib.mkForce '' + ln -sf ${eulaFile} eula.txt + cp -f ${bukkitConfigFile} bukkit.yml + chmod +w bukkit.yml + cp -f ${spigotConfigFile} spigot.yml + chmod +w spigot.yml + cp -f ${opsFile} ops.json + chmod +w ops.json + ln -sf ${serverIcon} server-icon.png + if [ -e .declarative ]; then + # Was declarative before, no need to back up anything + cp -f ${serverPropertiesFile} server.properties + else + # Declarative for the first time, backup stateful files + cp -b --suffix=.stateful ${serverPropertiesFile} server.properties + + # server.properties must have write permissions, because every time + # the server starts it first parses the file and then regenerates it.. + chmod +w server.properties + echo "Autogenerated file that signifies that this server configuration is managed declaratively by NixOS" \ + > .declarative + fi + ''; } diff --git a/hosts/greatyamada/services/minecraft/players.nix b/hosts/greatyamada/services/minecraft/players.nix deleted file mode 100644 index 1d8d565..0000000 --- a/hosts/greatyamada/services/minecraft/players.nix +++ /dev/null @@ -1,11 +0,0 @@ -builtins.listToAttrs (map (player: { - name = builtins.elemAt player 0; - value = { - name = builtins.elemAt player 0; - uuid = builtins.elemAt player 1; - }; -}) [ - - [ "engullejamones" "b65a1bc3-c6a0-4e8c-99b8-3538cfec0cfc" ] - [ "dankoszz" "87b47db0-4dd3-469c-8dfd-c21095dadd93" ] -]) diff --git a/hosts/greatyamada/services/minecraft/spigot.yml b/hosts/greatyamada/services/minecraft/spigot.yml new file mode 100644 index 0000000..c2cf297 --- /dev/null +++ b/hosts/greatyamada/services/minecraft/spigot.yml @@ -0,0 +1,169 @@ +# Managed by NixOS configuration +config-version: 12 +settings: + debug: false + bungeecord: false + sample-count: 12 + player-shuffle: 0 + user-cache-size: 1000 + save-user-cache-on-stop-only: false + moved-wrongly-threshold: 0.0625 + moved-too-quickly-multiplier: 10.0 + timeout-time: 60 + restart-on-crash: false + restart-script: ./start.sh + netty-threads: 4 + log-villager-deaths: true + log-named-deaths: true + attribute: + maxHealth: + max: 2048.0 + movementSpeed: + max: 2048.0 + attackDamage: + max: 2048.0 +messages: + whitelist: No estas en la whitelist + unknown-command: + Comando desconocido. Escribe "/help" para ver una lista con todos + los comandos. + server-full: El servidor esta lleno + outdated-client: Tu cliente de Minecraft está desactualizado, actualiza a la version {0} + outdated-server: El servidor está desactualizado, utiliza la version {0} + restart: El servidor se esta reiniciando +advancements: + disable-saving: false + disabled: + - minecraft:story/disabled +commands: + replace-commands: + - setblock + - summon + - testforblock + - tellraw + log: true + tab-complete: 0 + send-namespaced: true + spam-exclusions: + - /skill + silent-commandblock-console: false +players: + disable-saving: false +stats: + disable-saving: false + forced-stats: {} +world-settings: + default: + seed-ancientcity: 20083232 + seed-buriedtreasure: 10387320 + seed-mineshaft: default + below-zero-generation-in-existing-chunks: true + simulation-distance: default + hopper-can-load-chunks: false + seed-nether: 30084232 + seed-stronghold: default + thunder-chance: 100000 + verbose: false + hopper-amount: 1 + dragon-death-sound-radius: 0 + seed-village: 10387312 + seed-desert: 14357617 + seed-igloo: 14357618 + seed-jungle: 14357619 + seed-swamp: 14357620 + seed-monument: 10387313 + seed-shipwreck: 165745295 + seed-ocean: 14357621 + seed-outpost: 165745296 + seed-endcity: 10387313 + seed-slime: 987234911 + seed-bastion: 30084232 + seed-fortress: 30084232 + seed-mansion: 10387319 + seed-fossil: 14357921 + seed-portal: 34222645 + max-tnt-per-tick: 100 + hanging-tick-frequency: 100 + zombie-aggressive-towards-villager: true + enable-zombie-pigmen-portal-spawns: true + item-despawn-rate: 6000 + view-distance: default + arrow-despawn-rate: 1200 + trident-despawn-rate: 1200 + wither-spawn-sound-radius: 0 + mob-spawn-range: 8 + end-portal-sound-radius: 0 + nerf-spawner-mobs: false + max-entity-collisions: 8 + growth: + twistingvines-modifier: 100 + weepingvines-modifier: 100 + cavevines-modifier: 100 + glowberry-modifier: 100 + cactus-modifier: 100 + cane-modifier: 100 + melon-modifier: 100 + mushroom-modifier: 100 + pumpkin-modifier: 100 + sapling-modifier: 100 + beetroot-modifier: 100 + carrot-modifier: 100 + potato-modifier: 100 + wheat-modifier: 100 + netherwart-modifier: 100 + vine-modifier: 100 + cocoa-modifier: 100 + bamboo-modifier: 100 + sweetberry-modifier: 100 + kelp-modifier: 100 + entity-activation-range: + ignore-spectators: false + animals: 32 + monsters: 32 + raiders: 48 + misc: 16 + water: 16 + villagers: 32 + flying-monsters: 32 + villagers-work-immunity-after: 100 + villagers-work-immunity-for: 20 + villagers-active-for-panic: true + tick-inactive-villagers: true + wake-up-inactive: + animals-max-per-tick: 4 + animals-every: 1200 + animals-for: 100 + monsters-max-per-tick: 8 + monsters-every: 400 + monsters-for: 100 + villagers-max-per-tick: 4 + villagers-every: 600 + villagers-for: 100 + flying-monsters-max-per-tick: 8 + flying-monsters-every: 200 + flying-monsters-for: 100 + ticks-per: + hopper-transfer: 8 + hopper-check: 1 + hunger: + jump-walk-exhaustion: 0.05 + jump-sprint-exhaustion: 0.2 + combat-exhaustion: 0.1 + regen-exhaustion: 6.0 + swim-multiplier: 0.01 + sprint-multiplier: 0.1 + other-multiplier: 0.0 + max-tick-time: + tile: 50 + entity: 50 + squid-spawn-range: + min: 45.0 + merge-radius: + exp: 3.0 + item: 2.5 + entity-tracking-range: + players: 48 + animals: 48 + monsters: 48 + misc: 32 + other: 64 diff --git a/hosts/mizuki/nixos.nix b/hosts/mizuki/nixos.nix index 034c5b2..b1a705d 100644 --- a/hosts/mizuki/nixos.nix +++ b/hosts/mizuki/nixos.nix @@ -16,7 +16,6 @@ }; }; - networking.hostName = "mizuki"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/hosts/totsugeki/home-manager/desktop/default.nix b/hosts/totsugeki/home-manager/desktop/default.nix index 9836e0e..962493c 100644 --- a/hosts/totsugeki/home-manager/desktop/default.nix +++ b/hosts/totsugeki/home-manager/desktop/default.nix @@ -7,6 +7,7 @@ ./gtk.nix ./hypr ./kitty.nix + ./sway.nix ./qt.nix ]; dconf.settings = { diff --git a/hosts/totsugeki/home-manager/desktop/sway.nix b/hosts/totsugeki/home-manager/desktop/sway.nix new file mode 100644 index 0000000..ce4e433 --- /dev/null +++ b/hosts/totsugeki/home-manager/desktop/sway.nix @@ -0,0 +1,131 @@ +{ config, pkgs, ... }: +let cfg = config.wayland.windowManager.sway.config; +in { + home.packages = with pkgs; [ autotiling ]; + wayland.windowManager.sway = { + enable = true; + package = pkgs.swayfx; + checkConfig = false; # checkConfig crashes with swayfx on activation + config = { + bars = [ ]; + input = { + "type:keyboard" = { + xkb_layout = "es"; + xkb_variant = "dvorak"; + xkb_options = "lv5:caps_switch"; + }; + "type:pointer" = { + "accel_profile" = "flat"; + "pointer_accel" = "-0.4"; + }; + }; + focus.followMouse = "always"; + floating.titlebar = false; + gaps = { + inner = 4; + smartBorders = "off"; + smartGaps = false; + }; + keybindings = let + Super = "Mod4"; + Hyper = "Mod3"; + in { + "Ctrl+Alt+T" = "exec ${cfg.terminal}"; + "${Super}+Space" = "exec ags -t launcher"; + "${Super}+C" = "exec ags -t bar_extended"; + "${Hyper}+C" = "exec ags -t popup_clock"; + # Workspace management + "${Super}+1" = "workspace number 1"; + "${Super}+2" = "workspace number 2"; + "${Super}+3" = "workspace number 3"; + "${Super}+4" = "workspace number 4"; + "${Super}+5" = "workspace number 5"; + "${Super}+6" = "workspace number 6"; + "${Super}+7" = "workspace number 7"; + "${Super}+8" = "workspace number 8"; + "${Super}+9" = "workspace number 9"; + "${Super}+0" = "workspace number 10"; + "${Super}+Shift+1" = "move container to workspace number 1"; + "${Super}+Shift+2" = "move container to workspace number 2"; + "${Super}+Shift+3" = "move container to workspace number 3"; + "${Super}+Shift+4" = "move container to workspace number 4"; + "${Super}+Shift+5" = "move container to workspace number 5"; + "${Super}+Shift+6" = "move container to workspace number 6"; + "${Super}+Shift+7" = "move container to workspace number 7"; + "${Super}+Shift+8" = "move container to workspace number 8"; + "${Super}+Shift+9" = "move container to workspace number 9"; + "${Super}+Shift+0" = "move container to workspace number 10"; + # Window management + "${Super}+W" = "kill"; + "${Super}+E" = "exec pcmanfm-qt"; + "${Super}+${cfg.left}" = "focus left"; + "${Super}+${cfg.right}" = "focus right"; + "${Super}+${cfg.up}" = "focus up"; + "${Super}+${cfg.down}" = "focus down"; + "${Super}+Shift+${cfg.left}" = "move left"; + "${Super}+Shift+${cfg.right}" = "move right"; + "${Super}+Shift+${cfg.up}" = "move up"; + "${Super}+Shift+${cfg.down}" = "move down"; + "${Super}+F11" = "fullscreen toggle"; + # Modes + "${Hyper}+W" = "mode wallpaper"; + "${Hyper}+M" = "mode music"; + "${Hyper}+R" = "mode resize"; + # Speaker volume + "XF86AudioRaiseVolume" = "exec volumectl output +5"; + "XF86AudioLowerVolume" = "exec volumectl output -5"; + # Microphone volume + "Shift+XF86AudioRaiseVolume" = "exec volumectl input +5"; + "Shift+XF86AudioLowerVolume" = "exec volumectl input -5"; + # Brightness + "Alt+XF86AudioRaiseVolume" = "exec ddc-brightness +5"; + "Alt+XF86AudioLowerVolume" = "exec ddc-brightness -5"; + # Screenshots + "${Super}+S" = "exec screenshot full"; + "${Super}+Shift+S" = "exec screenshot section"; + }; + modes = { + music = { + p = "exec playerctl play-pause"; + h = "exec playerctl previous"; + l = "exec playerctl next"; + Escape = "mode default"; + }; + resize = { + "${cfg.left}" = "resize shrink width 10px"; + "${cfg.right}" = "resize grow width 10px"; + "${cfg.up}" = "resize shrink height 10px"; + "${cfg.down}" = "resize grow height 10px"; + Escape = "mode default"; + }; + wallpaper = { + l = "exec change-wallpaper next"; + h = "exec change-wallpaper previous"; + Escape = "mode default"; + }; + }; + output.DP-1.resolution = "2560x1440@165Hz"; + seat."*".xcursor_theme = "phinger-cursors-dark 32"; + startup = [ + { command = "swww-daemon"; } + { command = "autotiling"; } + { command = "ags"; } + { command = "lxqt-policykit-agent"; } + ]; + terminal = "kitty"; + }; + extraConfig = '' + # SwayFX configuration + blur enable + blur_radius 4 + blur_passes 3 + corner_radius 8 + default_dim_inactive 0.4 + default_border none + layer_effects bar blur enable; blur_ignore_transparent enable + layer_effects bar_extended blur enable; blur_ignore_transparent enable + layer_effects bar_extended blur enable; blur_ignore_transparent enable + layer_effects launcher blur enable; blur_ignore_transparent enable + ''; + }; +} diff --git a/hosts/totsugeki/home-manager/development.nix b/hosts/totsugeki/home-manager/development.nix index 12f2e5f..b85a6f9 100644 --- a/hosts/totsugeki/home-manager/development.nix +++ b/hosts/totsugeki/home-manager/development.nix @@ -1,6 +1,14 @@ { pkgs, ... }: { home = { - packages = with pkgs; [ android-tools mitmproxy python3 xh ]; + packages = with pkgs; [ + android-studio + android-tools + dotnet-sdk_8 + mitmproxy + python3 + unityhub + xh + ]; sessionVariables = { DOTNET_ROOT = "${pkgs.dotnet-sdk_8}"; }; sessionPath = [ "$HOME/.dotnet/tools" ]; };