{"id":16333409,"url":"https://github.com/iogamaster/flux","last_synced_at":"2025-03-16T14:31:12.963Z","repository":{"id":231151926,"uuid":"781062616","full_name":"IogaMaster/flux","owner":"IogaMaster","description":"Create and deploy game servers with nix","archived":false,"fork":false,"pushed_at":"2024-10-20T01:36:33.000Z","size":74,"stargazers_count":58,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-27T10:39:49.762Z","etag":null,"topics":["game-server","gameserver","gaming","minecraft","nix","nix-flake","steam"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IogaMaster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"iogamaster","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2024-04-02T17:18:50.000Z","updated_at":"2025-02-15T21:56:30.000Z","dependencies_parsed_at":"2024-07-08T22:48:14.828Z","dependency_job_id":"4246a6ab-cbed-4022-a6bc-b87d27997250","html_url":"https://github.com/IogaMaster/flux","commit_stats":null,"previous_names":["iogamaster/dynamo","iogamaster/flux"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IogaMaster%2Fflux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IogaMaster%2Fflux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IogaMaster%2Fflux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IogaMaster%2Fflux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IogaMaster","download_url":"https://codeload.github.com/IogaMaster/flux/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818194,"owners_count":20352629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-server","gameserver","gaming","minecraft","nix","nix-flake","steam"],"created_at":"2024-10-10T23:35:30.163Z","updated_at":"2025-03-16T14:31:12.078Z","avatar_url":"https://github.com/IogaMaster.png","language":"Nix","funding_links":["https://ko-fi.com/iogamaster"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eFlux\u003c/h1\u003e\n\n\u003ch1 align=\"center\"\u003e\n\u003ca href='#'\u003e\u003cimg src=\"https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/palette/macchiato.png\" width=\"600px\"/\u003e\u003c/a\u003e\n  \u003cbr\u003e \u003cbr\u003e\n  \u003cdiv\u003e\n    \u003ca href=\"https://github.com/IogaMaster/flux/issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/issues/IogaMaster/flux?color=fab387\u0026labelColor=303446\u0026style=for-the-badge\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/IogaMaster/flux/stargazers\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/stars/IogaMaster/flux?color=ca9ee6\u0026labelColor=303446\u0026style=for-the-badge\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/IogaMaster/flux\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/repo-size/IogaMaster/flux?color=ea999c\u0026labelColor=303446\u0026style=for-the-badge\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/IogaMaster/flux/blob/main/.github/LICENCE\"\u003e\n        \u003cimg src=\"https://img.shields.io/static/v1.svg?style=for-the-badge\u0026label=License\u0026message=MIT\u0026logoColor=ca9ee6\u0026colorA=313244\u0026colorB=cba6f7\"/\u003e\n    \u003c/a\u003e\n    \u003cbr\u003e\n    \u003c/div\u003e\n        \u003cimg href=\"https://builtwithnix.org\" src=\"https://builtwithnix.org/badge.svg\"/\u003e\n   \u003c/h1\u003e\n   \u003cbr\u003e\n\nWith flux you can build servers as packages with a simple interface and deploy them with the included module.\n\n- 🏗️ Builders that make packaging and running servers simple:\n    - mkGenericServer (builder for any server)\n    - mkMinecraftServer (builder for mcman based servers)\n    - mkSteamServer (wrapper for steamcmd and steam-run)\n- ⚙️ A module for running servers with additional tools:\n    - 🏭 Runs the server\n    - 🌐 Sets up proxy (playit.gg, ngrok, cloudflare tunnels)\n    - 🫙 Works great on host, nixos-containers, and microvms\n- 📦 Packages not present in nixpkgs (yet) that are useful for servers.\n    - [mcman](https://github.com/ParadigmMC/mcman)\n    - [playit](https://playit.gg/)\n\n#### Why?\n\nI set up servers for my friends all of the time, and I became frustrated at the amount of work it took change a vanilla minecraft server to a modded one.\nSo I integrated [mcman](https://github.com/ParadigmMC/mcman) to make this easy, then I decided to make servers for steam and other random projects.\n\n## 📦 Installation and Usage\n\nInstallation is simple:\n\n1. Add flux as an input to your flake\n   ```nix\n   inputs.flux.url = \"github:IogaMaster/flux\";\n   ```\n2. Add the exposed overlay to your global pkgs definition, so the builder functions are available.\n   ```nix\n    nixpkgs.overlays = [ flux.overlays.default ];\n   ```\n3. Import the NixOS module `flux.nixosModules.default` in your host config.\n   ```nix\n   nixosConfigurations.host1 = lib.nixosSystem {\n      system = \"x86_64-linux\";\n      modules = [\n        ./host1/configuration.nix\n        flux.nixosModules.default\n      ];\n   };\n   ```\n4. Define a server using the module.\n   ```nix\n   flux = {\n       enable = true;\n       servers = {\n           vanilla-minecraft = {\n               package = pkgs.mkMinecraftServer {\n                  name = \"myminecraftserver\";\n                  src = ./mcmanconfig; # Path to a mcman config\n                  hash = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\";\n               };\n               proxy.enable = true;\n           };\n        };\n   };\n   ```\n\n\u003cdetails\u003e\n\u003csummary\u003eExample flake.nix\u003c/summary\u003e\n\n```nix\n{\n  inputs = {\n    flake-utils.url = \"github:numtide/flake-utils\";\n    nixpkgs.url = \"github:NixOS/nixpkgs/nixos-unstable\";\n    flux.url = \"github:oddlama/nix-flux\";\n    flux.inputs.nixpkgs.follows = \"nixpkgs\";\n  };\n\n  outputs = { self, flake-utils, nixpkgs, flux, ... }: {\n    # Example. Use your own hosts and add the module to them\n    nixosConfigurations.host1 = nixpkgs.lib.nixosSystem {\n      system = \"x86_64-linux\";\n      modules = [\n        {\n            flux = {\n                enable = true;\n                servers = {\n                    vanilla-minecraft = {\n                        package = pkgs.mkMinecraftServer {\n                           name = \"myminecraftserver\";\n                           src = ./mcmanconfig; # Path to a mcman config\n                           hash = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\";\n                        };\n                        proxy.enable = true;\n                    };\n                 };\n            };\n        }\n        flux.nixosModules.default\n      ];\n    };\n  }\n  // flake-utils.lib.eachDefaultSystem (system: rec {\n    pkgs = import nixpkgs {\n      inherit system;\n      overlays = [ flux.overlays.default ];\n    };\n  });\n}\n```\n\u003c/details\u003e\n\n## 🌱 Using the builder functions:\n\nYou can create packages that run the server instead of using them in the module:\n\nExample minecraft server:\n```nix\n{lib, pkgs, ... }: \npkgs.mkMinecraftServer {\n   name = \"myminecraftserver\";\n   src = ./mcmanconfig; # Path to a mcman config\n   hash = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\";\n}\n```\n\nExample generic server:\n```nix\n{\n  lib,\n  mkGenericServer,\n  fetchzip,\n  ...\n}: \nmkGenericServer {\n  name = \"myserver\";\n\n  src = fetchzip {\n    url = \"http://www.example.org/server.tar.gz\";\n    hash = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\";\n  };\n\n  nativeBuildInputs = [];\n\n  buildInputs = [];\n\n  buildPhase = ''\n    HOME=$TMPDIR\n\n    cd $src\n    cp -r . $out\n  '';\n\n  startCmd = \"./start.sh\";\n}\n```\n\nExample steam server:\n```nix\n{lib, pkgs, ... }: \npkgs.mkSteamServer rec {\n   name = \"mygameserver\";\n   src = pkgs.fetchSteam {\n       inherit name;\n       appId = \"\"; # Dedicated server app id, can be found with https://steamdb.info/\n       hash = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\";\n   };\n   \n   startCmd = \"./FactoryServer.sh\";\n\n   hash = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\";\n}\n```\n\n## 🔨 TODO\n\nThere is still a lot to do.\n\n- Examples\n\n## ❤️ Contributing\n\nContributions are whole-heartedly welcome! Please feel free to suggest new features,\nimplement additional builders, helpers, or generally assist if you'd like. We'd be happy to have you.\nThere's more information in [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## 📜 License\n\nLicensed under the MIT license ([LICENSE](LICENSE) or \u003chttps://opensource.org/licenses/MIT\u003e).\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in this project by you, shall be licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiogamaster%2Fflux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiogamaster%2Fflux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiogamaster%2Fflux/lists"}