This commit is contained in:
shinya 2025-03-19 11:51:57 +01:00
commit 021f20f6b6
10 changed files with 530 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Sean Gillespie
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

95
README.md Normal file
View File

@ -0,0 +1,95 @@
# NixOS Godot Binaries
> Official Godot binary packages for NixOS
(including godot-mono for C# support!)
## Getting Started
### Without Flakes ❄❌
The simplest way to use these packages are to use the overlay. In your `configuration.nix`:
let
nixosGodot = fetchGit {
url = "https://github.com/sgillespie/nixos-godot-bin.git";
};
in
nixpkgs.overlays = nixpkgs.overlays ++ [(import "${nixosGodot}/overlay.nix)"]
# <-- Snip -->
environment.systemPackages = with pkgs; [
godotBin
godotMonoBin
godotHeadlessBin
]
### With Flakes ❄✅
#### Running Godot without installing it
To run Godot without any further configuration, run this command:
```
nix run github:Quoteme/nixos-godot-bin
```
##### Running different Godot flavors
There are also these other options available to run Godot:
```
nix run github:Quoteme/nixos-godot-bin\#godot
nix run github:Quoteme/nixos-godot-bin\#godotHeadless
nix run github:Quoteme/nixos-godot-bin\#godotMono
```
Most importantly, using `\#godotMono` will allow you to write in C#.
#### Installing Godot using flakes system-wide
Put this in your `flake.nix`, to install Godot for your user:
```
inputs = {
# ...
godot.url = "github:Quoteme/nixos-godot-bin";
# ...
};
outputs = { self, nixpkgs, ... }@attrs:
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
modules = [
({ config, nixpkgs, ...}@inputs:
users.users.YOURUSERNAME.packages = [
# ...
inputs.godot.packages.x86_64-linux.godot # for godot without Mono / C#
inputs.godot.packages.x86_64-linux.godotHeadless # for godot headless
inputs.godot.packages.x86_64-linux.godotMono
]
)
]
```
Alternatively you can also install Godot system-wide like this:
```
inputs = {
# ...
godot.url = "github:Quoteme/nixos-godot-bin";
# ...
};
outputs = { self, nixpkgs, ... }@attrs:
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
modules = [
({ config, nixpkgs, ...}@inputs:
environment.systemPackages = [
# ...
inputs.godot.packages.x86_64-linux.godot # for godot without Mono / C#
inputs.godot.packages.x86_64-linux.godotHeadless # for godot headless
inputs.godot.packages.x86_64-linux.godotMono
]
)
]
```

16
default.nix Normal file
View File

@ -0,0 +1,16 @@
{
pkgs ? import <nixpkgs> { },
}:
let
inherit (pkgs) callPackage;
in
rec {
godot = callPackage ./pkgs/godot { };
godotHeadless = callPackage ./pkgs/godot/headless.nix {
godotBin = godot;
};
godotMono = callPackage ./pkgs/godot/mono.nix {
godotBin = godot;
};
}

113
flake.lock Normal file
View File

@ -0,0 +1,113 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"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"
}
},
"godot-desktop-file": {
"flake": false,
"locked": {
"narHash": "sha256-vFVYuHYKIcr/ngibwV9G2bsxzG3YWS9Mm4WjKaAUcbM=",
"type": "file",
"url": "https://raw.githubusercontent.com/godotengine/godot/master/misc/dist/linux/org.godotengine.Godot.desktop"
},
"original": {
"type": "file",
"url": "https://raw.githubusercontent.com/godotengine/godot/master/misc/dist/linux/org.godotengine.Godot.desktop"
}
},
"godot-icon-png": {
"flake": false,
"locked": {
"narHash": "sha256-Y4Y2RpEiZOBJEEtgJZVHDJ+GUgN2fn9VPP+oZWQZMr0=",
"type": "file",
"url": "https://raw.githubusercontent.com/godotengine/godot/master/icon.png"
},
"original": {
"type": "file",
"url": "https://raw.githubusercontent.com/godotengine/godot/master/icon.png"
}
},
"godot-icon-svg": {
"flake": false,
"locked": {
"narHash": "sha256-fIvrlGt9n3o45i3skf4LhIBWMR/d8Xo2rHPftfOoHZA=",
"type": "file",
"url": "https://raw.githubusercontent.com/godotengine/godot/master/icon.svg"
},
"original": {
"type": "file",
"url": "https://raw.githubusercontent.com/godotengine/godot/master/icon.svg"
}
},
"godot-manpage": {
"flake": false,
"locked": {
"narHash": "sha256-QBl3N8oOgvzqoTiCCKWUq9PiBqjywhqvCaYM1g40FQw=",
"type": "file",
"url": "https://raw.githubusercontent.com/godotengine/godot/master/misc/dist/linux/godot.6"
},
"original": {
"type": "file",
"url": "https://raw.githubusercontent.com/godotengine/godot/master/misc/dist/linux/godot.6"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1742272065,
"narHash": "sha256-ud8vcSzJsZ/CK+r8/v0lyf4yUntVmDq6Z0A41ODfWbE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3549532663732bfd89993204d40543e9edaec4f2",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"godot-desktop-file": "godot-desktop-file",
"godot-icon-png": "godot-icon-png",
"godot-icon-svg": "godot-icon-svg",
"godot-manpage": "godot-manpage",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

85
flake.nix Normal file
View File

@ -0,0 +1,85 @@
{
description = "Official Godot binary packages for NixOS - An overlay for Godot";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:numtide/flake-utils";
};
# Add files needed to create a launcher icon for Godot
godot-desktop-file = {
url = "https://raw.githubusercontent.com/godotengine/godot/master/misc/dist/linux/org.godotengine.Godot.desktop";
flake = false;
};
godot-icon-png = {
url = "https://raw.githubusercontent.com/godotengine/godot/master/icon.png";
flake = false;
};
godot-icon-svg = {
url = "https://raw.githubusercontent.com/godotengine/godot/master/icon.svg";
flake = false;
};
godot-manpage = {
url = "https://raw.githubusercontent.com/godotengine/godot/master/misc/dist/linux/godot.6";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
rec {
# This section is here, so users can run:
# > nix run github:Quoteme/nixos-godot-bin
# and start Godot without any further configuration.
#
# > nix run github:Quoteme/nixos-godot-bin\#godot
# > nix run github:Quoteme/nixos-godot-bin\#godotHeadless
# > nix run github:Quoteme/nixos-godot-bin\#godotMono
# are also available.
defaultApp = apps.godot;
apps.godot = {
type = "app";
program = "${packages.godot}/bin/godot";
};
apps.godotHeadless = {
type = "app";
program = "${packages.godot}/bin/godot-headless";
};
apps.godotMono = {
type = "app";
program = "${packages.godotMono}/bin/godot-mono";
};
# This is for installing Godot using flakes
# just add this flake to your flakes inputs, and then you can
# use these packages to include Godot in your environment.
defaultPackage = packages.godot;
packages.godot = pkgs.callPackage ./pkgs/godot {
godotDesktopFile = inputs.godot-desktop-file;
godotIconPNG = inputs.godot-icon-png;
godotIconSVG = inputs.godot-icon-svg;
godotManpage = inputs.godot-manpage;
};
packages.godotHeadless = pkgs.callPackage ./pkgs/godot/headless.nix {
godotBin = packages.godot;
};
packages.godotMono = pkgs.callPackage ./pkgs/godot/mono.nix {
godotBin = packages.godot;
godotDesktopFile = inputs.godot-desktop-file;
godotIconPNG = inputs.godot-icon-png;
godotIconSVG = inputs.godot-icon-svg;
godotManpage = inputs.godot-manpage;
};
overlays.default = final: prev: {
godot = packages.godot;
godotHeadless = packages.godotHeadless;
godotMono = packages.godotMono;
};
}
);
}

11
overlay.nix Normal file
View File

@ -0,0 +1,11 @@
self: super:
let
inherit (super) callPackage config lib;
in
{
godotBin = callPackage ./pkgs/godot { };
godotMonoBin = callPackage ./pkgs/godot/mono.nix { };
godotHeadlessBin = callPackage ./pkgs/godot/headless.nix { };
}

89
pkgs/godot/default.nix Normal file
View File

@ -0,0 +1,89 @@
{
stdenv,
lib,
autoPatchelfHook,
makeWrapper,
fetchurl,
unzip,
udev,
alsa-lib,
libXcursor,
libXinerama,
libXrandr,
libXrender,
libX11,
libXi,
libpulseaudio,
libGL,
libxkbcommon,
godotDesktopFile,
godotIconPNG,
godotIconSVG,
godotManpage,
fontconfig,
xorg,
}: let
qualifier = "stable";
in
stdenv.mkDerivation rec {
pname = "godot-bin";
version = "3.5.1";
src = fetchurl {
url = "https://github.com/godotengine/godot-builds/releases/download/4.4.1-rc1/Godot_v4.4.1-rc1_linux.x86_64.zip";
sha256 = "sha256-aIQgp/KBXvV4BBLsLjTXVqSZj0BN5EevEnPFyhaEu3c=";
};
nativeBuildInputs = [autoPatchelfHook makeWrapper unzip];
buildInputs = [
udev
fontconfig
libxkbcommon
alsa-lib
libXcursor
libXinerama
libXrandr
libXrender
libX11
libXi
libpulseaudio
libGL
xorg.libXext
];
libraries = lib.makeLibraryPath buildInputs;
unpackCmd = "unzip $curSrc -d source";
installPhase = ''
mkdir -p $out/bin
install -m 0755 Godot_v4.4.1-rc1_linux.x86_64 $out/bin/godot
# Only create a desktop file, if the necessary variables are set
# these are set only, if one installs this program using flakes.
if [[ -f "${godotDesktopFile}" ]]; then
mkdir -p "$out/man/share/man/man6"
cp ${godotManpage} "$out/man/share/man/man6/"
mkdir -p $out/share/{applications,icons/hicolor/scalable/apps}
cp ${godotDesktopFile} "$out/share/applications/org.godotengine.Godot.desktop"
cp ${godotIconSVG} "$out/share/icons/hicolor/scalable/apps/godot.svg"
cp ${godotIconPNG} "$out/share/icons/godot.png"
substituteInPlace "$out/share/applications/org.godotengine.Godot.desktop" \
--replace "Exec=godot" "Exec=$out/bin/godot"
fi
'';
postFixup = ''
wrapProgram $out/bin/godot \
--set LD_LIBRARY_PATH ${libraries}
'';
meta = {
homepage = "https://godotengine.org";
description = "Free and Open Source 2D and 3D game engine";
license = lib.licenses.mit;
platforms = ["i686-linux" "x86_64-linux"];
maintainers = [lib.maintainers.twey];
};
}

27
pkgs/godot/headless.nix Normal file
View File

@ -0,0 +1,27 @@
{ fetchurl,
godotBin
}:
let
qualifier = "stable";
in
godotBin.overrideAttrs (oldAttrs: rec {
pname = "godot-headless-bin";
version = "3.5.1";
src = fetchurl {
url = "https://downloads.tuxfamily.org/godotengine/${version}/Godot_v${version}-${qualifier}_linux_headless.64.zip";
sha256 = "NgrJetf/EPYW64pix/+8PRrna0QlvnsA2tbdqjpEFHY=";
};
installPhase = ''
mkdir -p $out/bin
install -m 0755 Godot_v${version}-${qualifier}_linux_headless.64 $out/bin/godot-headless
'';
postFixup = ''
wrapProgram $out/bin/godot-headless \
--set LD_LIBRARY_PATH ${oldAttrs.libraries}
'';
})

56
pkgs/godot/mono.nix Normal file
View File

@ -0,0 +1,56 @@
{ fetchurl,
godotBin,
msbuild,
dotnetPackages,
mono5,
zlib,
godotDesktopFile,
godotIconPNG,
godotIconSVG,
godotManpage
}:
let
qualifier = "stable";
in
godotBin.overrideAttrs (oldAttrs: rec {
pname = "godot-mono-bin";
version = "3.5.1";
src = fetchurl {
url = "https://downloads.tuxfamily.org/godotengine/${version}/mono/Godot_v${version}-${qualifier}_mono_x11_64.zip";
sha256 = "7phG4vgq4m0h92gCMPv5kehQQ1BH7rS1c5VZ6Dx3WPc=";
};
buildInputs = oldAttrs.buildInputs ++ [zlib];
unpackCmd = "";
installPhase = ''
mkdir -p $out/bin $out/opt/godot-mono
install -m 0755 Godot_v${version}-${qualifier}_mono_x11.64 $out/opt/godot-mono/Godot_v${version}-${qualifier}_mono_x11.64
cp -r GodotSharp $out/opt/godot-mono
ln -s $out/opt/godot-mono/Godot_v${version}-${qualifier}_mono_x11.64 $out/bin/godot-mono
# Only create a desktop file, if the necessary variables are set
# these are set only, if one installs this program using flakes.
if [[ -f "${godotDesktopFile}" ]]; then
mkdir -p "$out/man/share/man/man6"
cp ${godotManpage} "$out/man/share/man/man6/"
mkdir -p $out/share/{applications,icons/hicolor/scalable/apps}
cp ${godotDesktopFile} "$out/share/applications/org.godotengine.Godot-Mono.desktop"
cp ${godotIconSVG} "$out/share/icons/hicolor/scalable/apps/godot.svg"
cp ${godotIconPNG} "$out/share/icons/godot.png"
substituteInPlace "$out/share/applications/org.godotengine.Godot-Mono.desktop" \
--replace "Exec=godot" "Exec=$out/bin/godot-mono"
fi
'';
postFixup = ''
wrapProgram $out/bin/godot-mono \
--set LD_LIBRARY_PATH ${oldAttrs.libraries}
'';
})

17
shell.nix Normal file
View File

@ -0,0 +1,17 @@
{
pkgPath ? <nixpkgs>,
overlays ? (import <nixpkgs/nixos> { }).config.nixpkgs.overlays
}:
let
overlay = import ./overlay.nix;
pkgs = import pkgPath { overlays = [overlay] ++ overlays; };
inherit (pkgs) mkShell;
in
mkShell {
buildInputs = with pkgs; [
godotBin
godotHeadlessBin
godotMonoBin
];
}