dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit edee01d3d9e0e6181fe5b899b77f00565f6e2a3a parent 9a73b41e4b58fdce1ccc719f519e158e04c8339f Author: maydayv7 <maydayv7@gmail.com> Date: Fri, 25 Sep 2026 02:31:40 +0530 feat: Update `mc-server` to 26.3 Also fix install media and script
Diffstat:
| M | CHANGELOG.md | | | 8 | ++++++++ |
| M | README.md | | | 4 | +++- |
| M | flake.lock | | | 26 | +++++++++++++------------- |
| M | modules/apps/tools.nix | | | 2 | ++ |
| M | modules/core/home-manager.nix | | | 1 | + |
| M | modules/core/nixos.nix | | | 2 | ++ |
| M | modules/games/mc-server/_mods.nix | | | 86 | +++++++++++++++++++++++++++++++++++++++++-------------------------------------- |
| M | modules/games/mc-server/default.nix | | | 20 | ++++++++++++++++---- |
| M | modules/hosts/futura.nix | | | 3 | --- |
| M | modules/hosts/install.nix | | | 22 | ++++++++-------------- |
| M | modules/hosts/valkyrie/_disk/dualboot.nix | | | 2 | +- |
| M | modules/hosts/valkyrie/default.nix | | | 61 | +++++++++++++++++++++++++++++++------------------------------ |
| M | modules/hosts/vortex.nix | | | 3 | --- |
| M | modules/system/user/default.nix | | | 14 | +++++++++----- |
| M | scripts/commands.sh | | | 6 | +++--- |
| M | scripts/install.nix | | | 21 | +++++++++++++++++---- |
16 files changed, 159 insertions(+), 122 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md @@ -1,5 +1,13 @@ ## 2026 +### September + +- Update `mc-server` to 26.3 +- Change `site` domain +- Refactor `gitsite` and move `stagit` in-tree +- Improve `website` performance and accessibility +- Use `pix` instead of `shotwell` + ### August - Editor `direnv` integration diff --git a/README.md b/README.md @@ -284,7 +284,9 @@ To use my configuration as-is for a fresh NixOS installation, you can try the fo > [!IMPORTANT] > These instructions are mainly intended for personal use -To download the Install Media, click on the latest successsful run listed [here](../../actions/workflows/install.yml) and download the image artifact. Burn it to a USB using a flashing utility such as [Etcher](https://www.balena.io/etcher/) +To download the Install Media, click on the latest successsful run listed [here](../../actions/workflows/install.yml) and download the image artifact. +Burn it to a USB using a flashing utility such as [Etcher](https://www.balena.io/etcher/). +The image supports both UEFI and legacy BIOS USB boot with Secure Boot disabled. > [!TIP] > In order to directly use the configuration, you must first create a clone of this repository and follow steps 2 to 6 from the first section, and preferably create your own install media diff --git a/flake.lock b/flake.lock @@ -112,16 +112,16 @@ ] }, "locked": { - "lastModified": 1788011267, - "narHash": "sha256-mEq2kU+ljompTToZ44Afvm7d/rHJ5iMBl0tjZuyShJs=", + "lastModified": 1790001035, + "narHash": "sha256-1/SLBjSYBzDdDhvLQ83wrzBakyS/xNGgtxHGNuveOEQ=", "owner": "Mic92", "repo": "bun2nix", - "rev": "5765b0614591f75ee8ba5596e81ae85c167d1071", + "rev": "07a5bfc8ac36c5370199343fa620b69f63186e33", "type": "github" }, "original": { "owner": "Mic92", - "ref": "fix-structured-attrs-hook", + "ref": "llm-agents", "repo": "bun2nix", "type": "github" } @@ -509,11 +509,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1789367948, - "narHash": "sha256-/RwZVHYMHOhG9e6SCcA6gwX7dUGAFKIx6yzpkZcHZos=", + "lastModified": 1790255433, + "narHash": "sha256-a/tZWRpZsIIh6mY16bR57/8hbkCFDASasOxrQjMTekY=", "owner": "numtide", "repo": "llm-agents.nix", - "rev": "e5fba4b49a76262fab3632a64ef466698caa317c", + "rev": "c2d669b6ed4001f1f7c2a45cf14724467387cbe0", "type": "github" }, "original": { @@ -533,11 +533,11 @@ ] }, "locked": { - "lastModified": 1787914990, - "narHash": "sha256-MZXAF0a2SgJ2TnUpM9sSnGcRuenOHsCdESPokn3Qtbg=", + "lastModified": 1790223794, + "narHash": "sha256-NMUY1IK1bAfCdYZAqsmgqN9gTdJGxaHHP+IPkaSQ7PY=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "5495072f8178188498cb2a1b1fe167cfa9ea31e8", + "rev": "23ef278ce9e77686ee684db829f9f18fd115a917", "type": "github" }, "original": { @@ -688,11 +688,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1789073787, - "narHash": "sha256-xfX/toC2QV707s06GbP4II/TxYF0fNQj7s5/LClNDKc=", + "lastModified": 1790178388, + "narHash": "sha256-kK3t7gwoz4Nx8RF46cs1Xz/skKNcK7y3KYP+gGqX6W8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "aff8a0b28396750446e5537a96461bc4facdb287", + "rev": "00455b0a3690d3f5dc61e9aef4277dc86235b73f", "type": "github" }, "original": { diff --git a/modules/apps/tools.nix b/modules/apps/tools.nix @@ -19,6 +19,7 @@ in { home.packages = with pkgs; [ # Utilities clapgrep + freefilesync gearlever popsicle @@ -52,6 +53,7 @@ in { ".appimages" ".config/de.leopoldluley.Clapgrep" ".config/easyeffects" + ".config/FreeFileSync" ".config/obs-studio" ".config/pitivi" ".config/xnviewmp" diff --git a/modules/core/home-manager.nix b/modules/core/home-manager.nix @@ -41,6 +41,7 @@ in { # Default Modules util.map.array [ "base" + "filesystem" "user" "nix" "shell" diff --git a/modules/core/nixos.nix b/modules/core/nixos.nix @@ -30,6 +30,8 @@ in { # Default Modules util.map.array [ "base" + "boot" + "filesystem" "cpu" "gpu" "nix" diff --git a/modules/games/mc-server/_mods.nix b/modules/games/mc-server/_mods.nix @@ -3,26 +3,28 @@ # require - Included only when the server option is set [Optional] { fabric = { - version = "26.1.2"; + version = "26.3"; mods = [ - # Server + # Dependencies { name = "FabricAPI"; id = "P7dR8mSH"; - url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/NqRnXk9x/fabric-api-0.152.1%2B26.1.2.jar"; - hash = "sha256-slrZJsj9EH0hs6l1Gpjat4dzZSOzmke8LMsEiWJoDXY="; + url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/bNnaTiuM/fabric-api-0.161.0%2B26.3.jar"; + hash = "sha512-7Wslhtb94R/ehHL1pSfFHpm2cCbkb5TUv9hefijOXuKZFz7hatV2zrUfOfmNMKgRCGpt6xqGpSSFnMFuEtoQnQ=="; } { - name = "Lithium"; - id = "gvQqBUqZ"; - url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/fQBdPR1m/lithium-fabric-0.24.6%2Bmc26.1.2.jar"; - hash = "sha256-UJ5/dwx9SL036VkpFzKdsnaORpXHKkPiLBnvZND5g58="; + name = "FabricKotlin"; + id = "Ha28R6CL"; + url = "https://cdn.modrinth.com/data/Ha28R6CL/versions/eRRZzGMc/fabric-language-kotlin-1.14.1%2Bkotlin.2.4.20.jar"; + hash = "sha512-kUBPh3dEZs6GBKr+p5HYzJe2A7wxDc4XyBiPlPd4PMptwU/HJs6HHKMXv+kDPBmdjYWNUShBBqAHVOlSFHcDuA=="; } + + # Performance { - name = "Krypton"; - id = "fQEb0iXm"; - url = "https://cdn.modrinth.com/data/fQEb0iXm/versions/kYAGItyj/krypton-0.3.0.jar"; - hash = "sha256-dFsRFgQ0dC1EQFRqp+RF0U1ZuhJG5br5kdKTGQuplGM="; + name = "Lithium"; + id = "gvQqBUqZ"; + url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/WXHRsMRl/lithium-fabric-0.26.1%2Bmc26.3.jar"; + hash = "sha512-rLubA3ogPwBeA6IL8dmGYBk4Srta0nZkgIoSuRljmiUB7LUvjw130n4UCZNbDb27cOAaxGZIDArkIe5AP2ScWQ=="; } { name = "FerriteCore"; @@ -33,64 +35,66 @@ { name = "ScalableLux"; id = "Ps1zyz6x"; - url = "https://cdn.modrinth.com/data/Ps1zyz6x/versions/gYbHVCz8/ScalableLux-0.2.0%2Bfabric.2b63825-all.jar"; - hash = "sha256-bamBsryRWGU1zjuw+kGXWonMRgO5w6EG0kMaIUF7HfA="; + url = "https://cdn.modrinth.com/data/Ps1zyz6x/versions/g4eqNSKd/ScalableLux-fabric-mc26.3-0.3.0-alpha.0.6-all.jar"; + hash = "sha512-3tWpOfsgq4HB8zsUfKm5gFB3Pbso3/Ft+TnH1We2JoCVIplOyNv7mef0mNxqTmLyXhQah9GO+0P3P8WtFWnMyQ=="; } { name = "C2ME"; id = "VSNURh3q"; - url = "https://cdn.modrinth.com/data/VSNURh3q/versions/v1RNsfu7/c2me-fabric-mc26.1.2-0.4.0-alpha.0.17.jar"; - hash = "sha256-W6hKW/dASyp+A9yT85luhMTg9fF59GTeYoVdRLM6Dx8="; + url = "https://cdn.modrinth.com/data/VSNURh3q/versions/sSoXjAqP/c2me-fabric-mc26.3-0.4.2-alpha.0.88.jar"; + hash = "sha512-u3QdEYyI6m2Vd/7Rr/rMHx8Ke3JaYZ7pM0N8xeQDyPFHSnCKub1ALRVO/ePOZu9Ng+2VDAz099xlblJYNyOSJg=="; } + + # Server-side { name = "PlayerRoles"; id = "Rt1mrUHm"; - url = "https://cdn.modrinth.com/data/Rt1mrUHm/versions/sUiL9n9i/player-roles-1.9.0.jar"; - hash = "sha256-0q6WzsxFdOqrslFmH8C5Si9fADgOShnBhWa4SMcBY/8="; + url = "https://cdn.modrinth.com/data/Rt1mrUHm/versions/CMb2UHlv/player-roles-1.11.0.jar"; + hash = "sha512-l5Gr7bZW4CXcgc8oMfjz/hJfBtqtlH/WnJZputW3ldehyqYT5UPlpCsMZQXdO5UPyu87AToA98in14JWlzgLtQ=="; } { name = "SkinRestorer"; id = "ghrZDhGW"; - url = "https://cdn.modrinth.com/data/ghrZDhGW/versions/rgcYRGDt/skinrestorer-2.8.1%2B26.1-fabric.jar"; - hash = "sha256-MazpunDTQeMBLN3Da1t5akwBBXH+ia733loqgA4Ft38="; - } - { - name = "Silk"; - id = "aTaCgKLW"; - url = "https://cdn.modrinth.com/data/aTaCgKLW/versions/dm3Sfg3x/silk-all-1.11.8.jar"; - hash = "sha256-4+u68yBi4nom7b96+PCuJvwpAnQHgtgByjTxYaF5gpM="; - } - { - name = "FabricKotlin"; - id = "Ha28R6CL"; - url = "https://cdn.modrinth.com/data/Ha28R6CL/versions/Pd0xrHCw/fabric-language-kotlin-1.13.12%2Bkotlin.2.4.0.jar"; - hash = "sha256-NsXdi3KONHDSiCrmMRm5OiBQD8Dqb1yUXBK/ZbWrGDI="; + url = "https://cdn.modrinth.com/data/ghrZDhGW/versions/K7BFrFJD/skinrestorer-2.11.0%2B26.3-fabric.jar"; + hash = "sha512-hPu+nGVL+haEp+uyXqK5ij/NoXb8YvRF6Wn19TH2qkAukTK3Pg8cCDwAOZYJ6ivUKoJCU/GjjmhPiyxmkTfzKg=="; } { name = "Veinminer"; id = "OhduvhIc"; - url = "https://cdn.modrinth.com/data/OhduvhIc/versions/h4Z7xAL0/veinminer-fabric-2.10.3.jar"; - hash = "sha256-/Q4M4yr/kjAMtuSyBeVbgSBMmNoCWrB4tStHSUdUSVk="; + url = "https://cdn.modrinth.com/data/OhduvhIc/versions/G10nvigw/veinminer-fabric-2.12.2.jar"; + hash = "sha512-XjGGMpijZXnS62aYFwm57tecoBV1MbRPgXiXfEIWaAENNu9EXAAyFcKD6swPayE+eylwyDkCVAFEqtjf+yQPwA=="; } { name = "VeinminerEnchant"; id = "4sP0LXxp"; - url = "https://cdn.modrinth.com/data/4sP0LXxp/versions/6zzsM770/veinminer-enchant-2.10.3.jar"; - hash = "sha256-/li1ve6r0w9Mha+9tPO0Vf5mWafQghUpFzZDSEVcivs="; + url = "https://cdn.modrinth.com/data/4sP0LXxp/versions/9C8zH5YI/veinminer-enchant-2.11.2.jar"; + hash = "sha512-E3vrBokjmfpFIZy5nLUUFalEWXnfu1t0JQNLTDlw2j1VJsL+8puGZ+xSQ48z+ZPr9WY+BuYfefVCNybD0hm43g=="; } - # Client and Server + # Server and Client + { + name = "DistantHorizons"; + id = "uCdwusMi"; + url = "https://cdn.modrinth.com/data/uCdwusMi/versions/gfi11b05/DistantHorizons-3.3.2-26.3-fabric-neoforge.jar"; + hash = "sha512-eKN41ewRezMJIwFf5lF/z6usPbRkszIdeiW25dd90RIlyDtHB+g6xyBQfFrHGKFjkQEzIpWhxYBBPPJJj0cpWQ=="; + } + { + name = "JEI"; + id = "u6dRKJwZ"; + url = "https://cdn.modrinth.com/data/u6dRKJwZ/versions/wS0zzU8r/jei-26.3-fabric-31.7.0.34.jar"; + hash = "sha512-xaBTc1SuYTI93+NAQUezHhGJ9eDobNODpRFzxHmXfnWDRFFi+p0EqLaPbxeiFUWVo/W+PdzDJ+BRpZF8U6bAhA=="; + } { name = "Jade"; id = "nvQzSEkH"; - url = "https://cdn.modrinth.com/data/nvQzSEkH/versions/zu6GcgEW/Jade-mc26.1-Fabric-26.1.6.jar"; - hash = "sha256-X+1RyaOSVWNyLWRGTKSJErPRYci1XFJVdcbt/rsphS8="; + url = "https://cdn.modrinth.com/data/nvQzSEkH/versions/lt43vWtF/Jade-mc26.3-Fabric-26.3.1.jar"; + hash = "sha512-E1nWV2IU//rct71CAr/RYGyCerbHUUPLx3Ryae19QTH12yJqkUuakkyskuWWx5lOb+MwNnH/jVotzUHK9hPnrg=="; } { name = "SimpleVC"; id = "9eGKb6K1"; - url = "https://cdn.modrinth.com/data/9eGKb6K1/versions/xmAicr0J/voicechat-fabric-2.6.19%2B26.1.2.jar"; - hash = "sha256-JsPgZqSfRb70Z00m0FN2/noc8Tm4++ncOLt0r0Z0rdQ="; + url = "https://cdn.modrinth.com/data/9eGKb6K1/versions/OLnMVWXy/voicechat-fabric-2.6.24%2B26.3.jar"; + hash = "sha512-QU61GWcwX+d0DTQBa8jj5OL6FZDhJ4rQa836Bof2UAe4JdNF3An3mpknBKUeyTuvAf5yfgu8Mv31BoKLWmXYWg=="; require = "vc-port"; } ]; diff --git a/modules/games/mc-server/default.nix b/modules/games/mc-server/default.nix @@ -23,7 +23,7 @@ in { mkOption types ; - inherit (pkgs) fetchurl fetchzip linkFarmFromDrvs; + inherit (pkgs) fetchurl fetchzip linkFarm; cfg = config.games.mc-servers; dataDir = "/srv/minecraft"; @@ -33,7 +33,11 @@ in { mkMods = srv: loader: let mods = filter (m: !(m ? require) || (m.require == "vc-port" && srv.vc-port != null)) loader.mods; in - linkFarmFromDrvs "mods" (map (m: fetchurl {inherit (m) name url hash;}) mods); + linkFarm "mods" (map (m: { + name = "${m.name}.jar"; + path = fetchurl {inherit (m) name url hash;}; + }) + mods); in { imports = [inputs.minecraft.nixosModules.minecraft-servers]; @@ -130,12 +134,20 @@ in { serverProperties = srv.config // {server-port = srv.port;}; jvmOpts = let mem = toString srv.memory; - in "-Xms${mem}G -Xmx${mem}G --add-modules=jdk.incubator.vector -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=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15"; + in + lib.concatStringsSep " " [ + "-Xms${mem}G" + "-Xmx${mem}G" + "-XX:+UseZGC" + "-XX:+AlwaysPreTouch" + "--add-modules=jdk.incubator.vector" + "--enable-native-access=ALL-UNNAMED" + ]; } ## Fabric Server (mkIf (srv.type == "fabric") { - package = pkgs.fabricServers.fabric-26_1_2; + package = pkgs.fabricServers.fabric-26_3.override {jre_headless = pkgs.jdk25_headless;}; symlinks.mods = mkMods srv modData.fabric; }) diff --git a/modules/hosts/futura.nix b/modules/hosts/futura.nix @@ -9,7 +9,6 @@ sharedHmModules = util.map.array [ - "filesystem" "laptop" "firefox" "office" @@ -25,9 +24,7 @@ in { }: { imports = util.map.array [ - "boot" "security" - "filesystem" "laptop" "office" "flatpak" diff --git a/modules/hosts/install.nix b/modules/hosts/install.nix @@ -20,25 +20,14 @@ in { # Disabled Modules ( {lib, ...}: { - options = { - environment.persist = lib.mkOption { - type = lib.types.attrsOf lib.types.anything; - default = {}; - }; - system.fs.persist = lib.mkOption { - type = lib.types.attrsOf lib.types.anything; - default = {}; - }; - }; - config = { - sops.secrets = lib.mkForce {}; - home-manager.sharedModules = lib.mkForce []; - }; + sops.secrets = lib.mkForce {}; + home-manager.sharedModules = lib.mkForce []; } ) ]; # Environment + networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" "install"); system.kernel = "lts"; boot.loader.grub.device = lib.mkDefault "nodev"; fileSystems."/".fsType = "tmpfs"; @@ -46,6 +35,11 @@ in { image.modules.iso = { image.baseName = lib.mkForce "install"; system.switch.enable = false; + isoImage = { + makeBiosBootable = true; + makeEfiBootable = true; + makeUsbBootable = true; + }; }; # Localization diff --git a/modules/hosts/valkyrie/_disk/dualboot.nix b/modules/hosts/valkyrie/_disk/dualboot.nix @@ -24,7 +24,7 @@ zramSwap = { enable = true; algorithm = "zstd"; - memoryPercent = 25; + memoryPercent = 17; }; # Shared ESP diff --git a/modules/hosts/valkyrie/default.nix b/modules/hosts/valkyrie/default.nix @@ -8,12 +8,11 @@ inherit (config) util; nixosModules = [ - "boot" "prompt" "mobile" "printer" "docker" - #"mc-server" + "mc-server" #"roblox" #"vfio" ]; @@ -21,7 +20,7 @@ hmModules = [ "secrets" "auth" - #"syncthing" + "syncthing" "internet" "firefox" "notes" @@ -29,16 +28,14 @@ "spotify" "vscode" "zed" - "antigravity" "codex" - #"stream" - #"minecraft" - #"osu" + "stream" + "minecraft" + "osu" ]; mixedModules = [ "base-ext" - "filesystem" "security" "laptop" "mouse" @@ -46,10 +43,10 @@ "git" "office" "tools" + "games" + "latex" #"flatpak" - #"latex" #"wine" - #"games" #"libvirt" "niri" ]; @@ -58,7 +55,7 @@ util.map.array hmModules homeManager ++ util.map.array mixedModules homeManager; - disk = import ./_disk/dualboot.nix args; + disk = import ./_disk/full.nix args; asus = import ./_asus {}; dev = import ./_dev.nix {}; #vm = import ./_vm args; @@ -73,7 +70,11 @@ in { imports = util.map.array nixosModules nixos ++ util.map.array mixedModules nixos - ++ [disk.nixos (asus.nixos or {}) (dev.nixos or {})] + ++ [ + disk.nixos + (asus.nixos or {}) + (dev.nixos or {}) + ] ++ util.map.array ["asus-zephyrus-ga402x-nvidia"] inputs.hardware.nixosModules; networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" "valkyrie"); @@ -121,6 +122,24 @@ in { fancy = true; }; + # Minecraft Server + games.mc-servers = [ + { + type = "fabric"; + memory = 16; + port = 25565; + vc-port = 24454; + config = { + gamemode = "survival"; + difficulty = "normal"; + online-mode = false; + server-ip = "0.0.0.0"; + spawn-protection = 0; + motd = "My World"; + }; + } + ]; + # Virtualisation # virt.vfio = { # setup = true; @@ -132,24 +151,6 @@ in { # hugepages = 16; # }; - # Minecraft Server - # games.mc-servers = [ - # { - # type = "fabric"; - # memory = 16; - # port = 25565; - # vc-port = 24454; - # config = { - # gamemode = "survival"; - # difficulty = "normal"; - # online-mode = false; - # server-ip = "0.0.0.0"; - # spawn-protection = 0; - # motd = "My World"; - # }; - # } - # ]; - # User V7 users.users.v7 = { isNormalUser = true; diff --git a/modules/hosts/vortex.nix b/modules/hosts/vortex.nix @@ -11,7 +11,6 @@ util.map.array [ "secrets" "shell-utils" - "filesystem" "laptop" "discord" "firefox" @@ -34,8 +33,6 @@ in { util.map.array [ "security" - "boot" - "filesystem" "laptop" "mobile" "printer" diff --git a/modules/system/user/default.nix b/modules/system/user/default.nix @@ -31,10 +31,13 @@ in { }; # User Passwords - sops.secrets = util.map.secrets { - directory = ../../../secrets/passwords; - neededForUsers = true; - }; + sops.secrets = + lib.filterAttrs ( + name: _: builtins.hasAttr (lib.removeSuffix ".secret" name) config.users.users + ) (util.map.secrets { + directory = ../../../secrets/passwords; + neededForUsers = true; + }); # Home Manager settings home-manager = { @@ -47,6 +50,7 @@ in { sharedModules = util.map.array [ "base" + "filesystem" "user" "nix" "shell" @@ -142,7 +146,7 @@ in { }; publicKeys = - builtins.map + map (source: { inherit source; trust = "ultimate"; diff --git a/scripts/commands.sh b/scripts/commands.sh @@ -69,7 +69,7 @@ newline() { error() { echo -e "\n\033[0;31merror:\033[0m $1" - if [ -n "$2" ] + if [ -n "${2:-}" ] then echo -e "\n$2" fi @@ -78,7 +78,7 @@ error() { info() { echo -e "\n\033[0;35minfo:\033[0m $1" - if [ -n "$2" ] + if [ -n "${2:-}" ] then echo -e "\n$2" fi @@ -86,7 +86,7 @@ info() { warn() { echo -e "\n\033[0;35mwarning:\033[0m $1" - if [ -n "$2" ] + if [ -n "${2:-}" ] then echo -e "\n$2" fi diff --git a/scripts/install.nix b/scripts/install.nix @@ -37,12 +37,19 @@ in ${files.scripts.commands} TRIES=5 + CLEAN_TARGET=false cleanup() { - umount -R /mnt 2> /dev/null || true - zpool export fspool 2> /dev/null || true + if [ "$CLEAN_TARGET" = true ] + then + umount -R /mnt 2> /dev/null || true + zpool export fspool 2> /dev/null || true + CLEAN_TARGET=false + fi } + trap cleanup EXIT + install_system() { local attempt=0 while [ "$attempt" -lt "$TRIES" ] @@ -58,11 +65,11 @@ in return 1 } - internet if [ "$EUID" -ne 0 ] then error "This Command must be Executed as 'root'" fi + internet # Target Device and Repository read -rp "Enter Name of Device to Install: " HOST @@ -79,7 +86,7 @@ in # Target Disk echo "Resolving target disk for '$HOST'..." - if ! DISK=$(nix eval --raw "$URL#nixosConfigurations.$HOST.config.system.fs.disk" 2> /dev/null) + if ! DISK=$(nix eval --raw "$URL#nixosConfigurations.$HOST.config.system.fs.disk") then error "Couldn't resolve 'system.fs.disk' for '$HOST'" fi @@ -87,8 +94,13 @@ in then error "'$DISK' is not a valid block device" "Set 'system.fs.disk' for '$HOST' to this device's disk" fi + if [ "$(lsblk --nodeps --noheadings --output TYPE "$DISK" | tr -d '[:space:]')" != "disk" ] + then + error "'$DISK' is not a whole-disk block device" + fi # Confirm Destructive Wipe + lsblk --nodeps --output NAME,PATH,SIZE,MODEL,SERIAL "$DISK" warn "ALL DATA on '$DISK' will be PERMANENTLY ERASED for Automatic Partitioning" read -rp "Type the Disk path to confirm: " CONFIRM if [ "$CONFIRM" != "$DISK" ] @@ -97,6 +109,7 @@ in fi # Wipe Stale Signatures + CLEAN_TARGET=true echo "Wiping existing signatures on '$DISK'..." swapoff --all 2> /dev/null || true zpool labelclear -f "$DISK" 2> /dev/null || true