Configuration for my NixOS based systems and Home Manager
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Better valheim server impl

+76 -155
+56 -13
flake.lock
··· 47 47 ] 48 48 }, 49 49 "locked": { 50 - "lastModified": 1774106245, 51 - "narHash": "sha256-gB3XhG900wWKDa/dbqgK0wFGRf8u9PQhqN/SvnTZlIM=", 50 + "lastModified": 1774419577, 51 + "narHash": "sha256-1dmCZWYAhJ1Z65Bl11wgXCHcCu1CTTD0j+PBGFfjanM=", 52 52 "owner": "sadjow", 53 53 "repo": "claude-code-nix", 54 - "rev": "0b01bf3b7cb403ef11f502183b6de55e2aaccf88", 54 + "rev": "8117d36a65200c7a2870620427296b381acb4c35", 55 55 "type": "github" 56 56 }, 57 57 "original": { ··· 357 357 ] 358 358 }, 359 359 "locked": { 360 - "lastModified": 1773963144, 361 - "narHash": "sha256-WzBOBfSay3GYilUfKaUa1Mbf8/jtuAiJIedx7fWuIX4=", 360 + "lastModified": 1774274588, 361 + "narHash": "sha256-dnHvv5EMUgTzGZmA+3diYjQU2O6BEpGLEOgJ1Qe9LaY=", 362 362 "owner": "nix-community", 363 363 "repo": "home-manager", 364 - "rev": "a91b3ea73a765614d90360580b689c48102d1d33", 364 + "rev": "cf9686ba26f5ef788226843bc31fda4cf72e373b", 365 365 "type": "github" 366 366 }, 367 367 "original": { ··· 541 541 }, 542 542 "nixpkgs-unstable": { 543 543 "locked": { 544 - "lastModified": 1773821835, 545 - "narHash": "sha256-TJ3lSQtW0E2JrznGVm8hOQGVpXjJyXY2guAxku2O9A4=", 544 + "lastModified": 1774106199, 545 + "narHash": "sha256-US5Tda2sKmjrg2lNHQL3jRQ6p96cgfWh3J1QBliQ8Ws=", 546 546 "owner": "nixos", 547 547 "repo": "nixpkgs", 548 - "rev": "b40629efe5d6ec48dd1efba650c797ddbd39ace0", 548 + "rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655", 549 549 "type": "github" 550 550 }, 551 551 "original": { ··· 557 557 }, 558 558 "nixpkgs_2": { 559 559 "locked": { 560 - "lastModified": 1773964973, 561 - "narHash": "sha256-NV/J+tTER0P5iJhUDL/8HO5MDjDceLQPRUYgdmy5wXw=", 560 + "lastModified": 1774244481, 561 + "narHash": "sha256-4XfMXU0DjN83o6HWZoKG9PegCvKvIhNUnRUI19vzTcQ=", 562 562 "owner": "nixos", 563 563 "repo": "nixpkgs", 564 - "rev": "812b3986fd1568f7a858f97fcf425ad996ba7d25", 564 + "rev": "4590696c8693fea477850fe379a01544293ca4e2", 565 565 "type": "github" 566 566 }, 567 567 "original": { ··· 603 603 "nixpkgs": "nixpkgs_2", 604 604 "nixpkgs-unstable": "nixpkgs-unstable", 605 605 "pre-commit-hooks": "pre-commit-hooks", 606 - "tangled": "tangled" 606 + "tangled": "tangled", 607 + "valheim-server": "valheim-server" 607 608 } 608 609 }, 609 610 "sqlite-lib-src": { ··· 619 620 "url": "https://sqlite.org/2024/sqlite-amalgamation-3450100.zip" 620 621 } 621 622 }, 623 + "steam-fetcher": { 624 + "inputs": { 625 + "nixpkgs": [ 626 + "valheim-server", 627 + "nixpkgs" 628 + ] 629 + }, 630 + "locked": { 631 + "lastModified": 1714795926, 632 + "narHash": "sha256-PkgC9jqoN6cJ8XYzTA2PlrWs7aPJkM3BGiTxNqax0cA=", 633 + "owner": "nix-community", 634 + "repo": "steam-fetcher", 635 + "rev": "12f66eafb7862d91b3e30c14035f96a21941bd9c", 636 + "type": "github" 637 + }, 638 + "original": { 639 + "owner": "nix-community", 640 + "repo": "steam-fetcher", 641 + "type": "github" 642 + } 643 + }, 622 644 "systems": { 623 645 "locked": { 624 646 "lastModified": 1681028828, ··· 693 715 "ref": "refs/tags/v1.11.0-alpha", 694 716 "type": "git", 695 717 "url": "https://tangled.org/@tangled.org/core" 718 + } 719 + }, 720 + "valheim-server": { 721 + "inputs": { 722 + "nixpkgs": [ 723 + "nixpkgs" 724 + ], 725 + "steam-fetcher": "steam-fetcher" 726 + }, 727 + "locked": { 728 + "lastModified": 1774478317, 729 + "narHash": "sha256-RaoSaPo1ppn/JGLndWHky9LWcdPGfLcvFHcWTkC6QpE=", 730 + "ref": "refs/heads/main", 731 + "rev": "3c7b93376da5fd8e6393645fa9ee6f61002bfbb5", 732 + "revCount": 113, 733 + "type": "git", 734 + "url": "file:///home/noah/repos/valheim-server-flake" 735 + }, 736 + "original": { 737 + "type": "git", 738 + "url": "file:///home/noah/repos/valheim-server-flake" 696 739 } 697 740 } 698 741 },
+7
flake.nix
··· 33 33 url = "github:sadjow/claude-code-nix"; 34 34 inputs.nixpkgs.follows = "nixpkgs"; 35 35 }; 36 + valheim-server = { 37 + #url = "github:chiefnoah/valheim-server-flake"; 38 + url = "git+file:///home/noah/repos/valheim-server-flake"; 39 + inputs.nixpkgs.follows = "nixpkgs"; 40 + }; 36 41 }; 37 42 38 43 outputs = ··· 47 52 agenix, 48 53 tangled, 49 54 claude-code, 55 + valheim-server, 50 56 ... 51 57 }@inputs: 52 58 let ··· 113 119 useUnstable = true; 114 120 modules = [ 115 121 ./host-specific/odin/configuration.nix 122 + valheim-server.nixosModules.default 116 123 ]; 117 124 }; 118 125 nixosConfigurations.shizuri = basicSystem {
-1
host-specific/odin/configuration.nix
··· 12 12 #./gui.nix 13 13 ./packages.nix 14 14 ./services.nix 15 - ./steam.nix 16 15 ./valheim.nix 17 16 ]; 18 17
+4 -1
host-specific/odin/networking.nix
··· 28 28 networking.firewall = { 29 29 enable = true; 30 30 allowPing = true; 31 - allowedUDPPorts = [ ]; 31 + allowedUDPPorts = [ 32 + 2456 33 + ]; 32 34 allowedUDPPortRanges = [ ]; 33 35 allowedTCPPorts = [ 34 36 2375 37 + 2456 35 38 3000 36 39 ]; 37 40 };
-80
host-specific/odin/steam.nix
··· 1 - { 2 - pkgs, 3 - unstable, 4 - ... 5 - }: 6 - { 7 - users.users.steam = { 8 - isSystemUser = true; 9 - group = "steam"; 10 - home = "/var/lib/steam"; 11 - createHome = true; 12 - }; 13 - 14 - users.groups.steam = { }; 15 - 16 - systemd.services."steam@" = { 17 - unitConfig = { 18 - StopWhenUnneeded = true; 19 - }; 20 - serviceConfig = { 21 - Type = "oneshot"; 22 - ExecStart = "${ 23 - pkgs.resholve.writeScript "steam" 24 - { 25 - interpreter = "${pkgs.zsh}/bin/zsh"; 26 - inputs = with pkgs; [ 27 - patchelf 28 - unstable.steamcmd 29 - ]; 30 - execer = [ 31 - "cannot:${unstable.steamcmd}/bin/steamcmd" 32 - ]; 33 - } 34 - '' 35 - set -eux 36 - 37 - instance=''${1:?Instance Missing} 38 - eval 'args=(''${(@s:_:)instance})' 39 - app=''${args[1]:?App ID missing} 40 - beta=''${args[2]:-} 41 - betapass=''${args[3]:-} 42 - 43 - dir=/var/lib/steam-app-$instance 44 - 45 - cmds=( 46 - +force_install_dir $dir 47 - +login anonymous 48 - +app_update $app validate 49 - ) 50 - 51 - if [[ $beta ]]; then 52 - cmds+=(-beta $beta) 53 - if [[ $betapass ]]; then 54 - cmds+=(-betapassword $betapass) 55 - fi 56 - fi 57 - 58 - cmds+=(+quit) 59 - 60 - steamcmd $cmds 61 - 62 - for f in $dir/*; do 63 - if ! [[ -f $f && -x $f ]]; then 64 - continue 65 - fi 66 - 67 - # Update the interpreter to the path on NixOS. 68 - patchelf --set-interpreter ${pkgs.glibc}/lib/ld-linux-x86-64.so.2 $f || true 69 - done 70 - '' 71 - } %i"; 72 - PrivateTmp = true; 73 - Restart = "on-failure"; 74 - StateDirectory = "steam-app-%i"; 75 - TimeoutStartSec = 3600; # Allow time for updates. 76 - User = "steam"; 77 - WorkingDirectory = "~"; 78 - }; 79 - }; 80 - }
+9 -60
host-specific/odin/valheim.nix
··· 1 - # See https://kevincox.ca/2022/12/09/valheim-server-nixos-v2/ 2 - { pkgs, utils, ... }: 3 - let 4 - # Set to {id}-{branch}-{password} for betas. 5 - steam-app = "896660"; 6 - in 7 1 { 8 - imports = [ 9 - ./steam.nix 10 - ]; 11 - 12 - users.users.valheim = { 13 - isSystemUser = true; 14 - # Valheim puts save data in the home directory. 15 - home = "/var/lib/valheim"; 16 - createHome = true; 17 - homeMode = "750"; 18 - group = "valheim"; 19 - }; 20 - 21 - users.groups.valheim = { }; 22 - 23 - systemd.services.valheim = { 24 - wantedBy = [ "multi-user.target" ]; 25 - 26 - # Install the game before launching. 27 - wants = [ "steam@${steam-app}.service" ]; 28 - after = [ "steam@${steam-app}.service" ]; 29 - 30 - serviceConfig = { 31 - ExecStart = utils.escapeSystemdExecArgs [ 32 - "/var/lib/steam-app-${steam-app}/valheim_server.x86_64" 33 - "-nographics" 34 - "-batchmode" 35 - # "-crossplay" # This is broken because it looks for "party" shared library in the wrong path. 36 - "-savedir" 37 - "/var/lib/valheim/save" 38 - "-name" 39 - "rm -rf" 40 - "-port" 41 - "2456" 42 - "-world" 43 - "Dedicated" 44 - "-password" 45 - "Password123" 46 - "-public" 47 - "0" # Valheim now supports favourite servers in-game which I am using instead of listing in the public registry. 48 - "-backups" 49 - "3" # I take my own backups, if you don't you can remove this to use the built-in basic rotation system. 50 - ]; 51 - Nice = "-5"; 52 - PrivateTmp = true; 53 - Restart = "always"; 54 - User = "valheim"; 55 - WorkingDirectory = "~"; 56 - }; 57 - environment = { 58 - # linux64 directory is required by Valheim. 59 - LD_LIBRARY_PATH = "/var/lib/steam-app-${steam-app}/linux64:${pkgs.glibc}/lib"; 60 - SteamAppId = "892970"; 61 - }; 2 + ... 3 + }: 4 + { 5 + services.valheim = { 6 + enable = true; 7 + serverName = "ngp's Valheim server"; 8 + worldName = "Midgard"; 9 + openFirewall = true; 10 + password = "Password123"; 62 11 }; 63 12 }