Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# 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
Expand All @@ -18,3 +23,73 @@ The simplest way to use these packages are to use the overlay. In your `configur
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
]
)
]
```
113 changes: 113 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 85 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
);
}
18 changes: 18 additions & 0 deletions pkgs/godot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
udev,
alsaLib, libXcursor, libXinerama, libXrandr, libXrender, libX11, libXi,
libpulseaudio, libGL,
godotDesktopFile,
godotIconPNG,
godotIconSVG,
godotManpage
}:

let
Expand Down Expand Up @@ -43,6 +47,20 @@ stdenv.mkDerivation rec {
installPhase = ''
mkdir -p $out/bin
install -m 0755 Godot_v${version}-${qualifier}_x11.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 = ''
Expand Down
20 changes: 19 additions & 1 deletion pkgs/godot/mono.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
msbuild,
dotnetPackages,
mono5,
zlib
zlib,
godotDesktopFile,
godotIconPNG,
godotIconSVG,
godotManpage
}:

let
Expand All @@ -29,6 +33,20 @@ godotBin.overrideAttrs (oldAttrs: rec {
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 = ''
Expand Down