From 6c41be13f51d4d1d78ac3969d2efe147b382309a Mon Sep 17 00:00:00 2001 From: Luca Leon Happel Date: Sat, 21 Jan 2023 21:00:18 +0100 Subject: [PATCH 1/8] add: flake.nix and flake.lock --- flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..55e11a8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1674236650, + "narHash": "sha256-B4GKL1YdJnII6DQNNJ4wDW1ySJVx2suB1h/v4Ql8J0Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "cfb43ad7b941d9c3606fb35d91228da7ebddbfc5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ea65c27 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + 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"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, ... }@inputs: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + rec { + defaultPackage = packages.godot; + packages.godot = pkgs.callPackage ./pkgs/godot { }; + packages.godotHeadless = pkgs.callPackage ./pkgs/godot/headless.nix { + godotBin = packages.godot; + }; + packages.godotMono = pkgs.callPackage ./pkgs/godot/mono.nix { + godotBin = packages.godot; + }; + } + ); +} From 83381222a45e82d52a043be63935dcea225aba99 Mon Sep 17 00:00:00 2001 From: Luca Leon Happel Date: Sat, 21 Jan 2023 21:23:28 +0100 Subject: [PATCH 2/8] add: documentation about using flakes --- README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 25 +++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/README.md b/README.md index beef717..ada752a 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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.godot.x86_64-linux # for godot without Mono / C# + inputs.godot.godotHeadless.x86_64-linux # for godot headless + inputs.godot.godotMono.x86_64-linux # for 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.godot.x86_64-linux # for godot without Mono / C# + inputs.godot.godotHeadless.x86_64-linux # for godot headless + inputs.godot.godotMono.x86_64-linux # for godotMono + ] + ) + ] +``` diff --git a/flake.nix b/flake.nix index ea65c27..0fcda35 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,31 @@ 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 { }; packages.godotHeadless = pkgs.callPackage ./pkgs/godot/headless.nix { From d2eb7139804545cd85e25efcb15957a7bcb06f0d Mon Sep 17 00:00:00 2001 From: Luca Leon Happel Date: Sat, 21 Jan 2023 21:44:37 +0100 Subject: [PATCH 3/8] fix: error in install instructions --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ada752a..fb643a4 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,9 @@ Put this in your `flake.nix`, to install Godot for your user: ({ config, nixpkgs, ...}@inputs: users.users.YOURUSERNAME.packages = [ # ... - inputs.godot.godot.x86_64-linux # for godot without Mono / C# - inputs.godot.godotHeadless.x86_64-linux # for godot headless - inputs.godot.godotMono.x86_64-linux # for godotMono + 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 ] ) ] @@ -86,9 +86,9 @@ Alternatively you can also install Godot system-wide like this: ({ config, nixpkgs, ...}@inputs: environment.systemPackages = [ # ... - inputs.godot.godot.x86_64-linux # for godot without Mono / C# - inputs.godot.godotHeadless.x86_64-linux # for godot headless - inputs.godot.godotMono.x86_64-linux # for godotMono + 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 ] ) ] From 5d9a0afa913b8f782fff3d5e4d6153293f4ec804 Mon Sep 17 00:00:00 2001 From: Luca Leon Happel Date: Sat, 21 Jan 2023 22:40:12 +0100 Subject: [PATCH 4/8] add: desktop icons for godot --- flake.lock | 52 ++++++++++++++++++++++++++++++++++++++++++ flake.nix | 29 ++++++++++++++++++++++- pkgs/godot/default.nix | 18 +++++++++++++++ pkgs/godot/mono.nix | 20 +++++++++++++++- 4 files changed, 117 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index 55e11a8..1ae7f73 100644 --- a/flake.lock +++ b/flake.lock @@ -15,6 +15,54 @@ "type": "github" } }, + "godot-desktop-file": { + "flake": false, + "locked": { + "narHash": "sha256-FYiixHXikdWjfSDwYc0ZcchoW9UiOBh0cMsClOuSJFY=", + "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-xTcztMjjqJlymXLs/fcJRzaocomHAvxOK9FT0lmaBPc=", + "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-+oithkOprerqtxlLWXhiue4bF5CAT+8Zki9drEUWwy0=", + "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": 1674236650, @@ -34,6 +82,10 @@ "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" } } diff --git a/flake.nix b/flake.nix index 0fcda35..2de49c3 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,24 @@ 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: @@ -41,12 +59,21 @@ # 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 { }; + 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; }; } ); diff --git a/pkgs/godot/default.nix b/pkgs/godot/default.nix index 2eb34e7..8ee55e2 100644 --- a/pkgs/godot/default.nix +++ b/pkgs/godot/default.nix @@ -7,6 +7,10 @@ udev, alsaLib, libXcursor, libXinerama, libXrandr, libXrender, libX11, libXi, libpulseaudio, libGL, + godotDesktopFile, + godotIconPNG, + godotIconSVG, + godotManpage }: let @@ -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 = '' diff --git a/pkgs/godot/mono.nix b/pkgs/godot/mono.nix index fcc59b4..cfb3140 100644 --- a/pkgs/godot/mono.nix +++ b/pkgs/godot/mono.nix @@ -3,7 +3,11 @@ msbuild, dotnetPackages, mono5, - zlib + zlib, + godotDesktopFile, + godotIconPNG, + godotIconSVG, + godotManpage }: let @@ -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 = '' From 337fdf809c158480814c222fc54f0602af5b5d70 Mon Sep 17 00:00:00 2001 From: Luca Leon Happel Date: Mon, 12 Jun 2023 23:28:32 +0200 Subject: [PATCH 5/8] update: file hashes --- flake.lock | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 1ae7f73..a20ae59 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,15 @@ { "nodes": { "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -42,7 +45,7 @@ "godot-icon-svg": { "flake": false, "locked": { - "narHash": "sha256-xTcztMjjqJlymXLs/fcJRzaocomHAvxOK9FT0lmaBPc=", + "narHash": "sha256-hgrosZPGt/q0YsdhKK7GPO6r9kYwum6e9Y9kYwueiSM=", "type": "file", "url": "https://raw.githubusercontent.com/godotengine/godot/master/icon.svg" }, @@ -65,11 +68,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1674236650, - "narHash": "sha256-B4GKL1YdJnII6DQNNJ4wDW1ySJVx2suB1h/v4Ql8J0Q=", + "lastModified": 1686519857, + "narHash": "sha256-VkBhuq67aXXiCoEmicziuDLUPPjeOTLQoj6OeVai5zM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "cfb43ad7b941d9c3606fb35d91228da7ebddbfc5", + "rev": "6b1b72c0f887a478a5aac355674ff6df0fc44f44", "type": "github" }, "original": { @@ -88,6 +91,21 @@ "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", From a8b980a8160a964cfe03016c9704247a02cfa3a2 Mon Sep 17 00:00:00 2001 From: Luca Leon Happel Date: Thu, 6 Jul 2023 20:05:05 +0200 Subject: [PATCH 6/8] add: overlay using flakes --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 2de49c3..249970d 100644 --- a/flake.nix +++ b/flake.nix @@ -75,6 +75,7 @@ godotIconSVG = inputs.godot-icon-svg; godotManpage = inputs.godot-manpage; }; + overlays.default = (import ./overlay.nix { inherit pkgs; }); } ); } From 2d56e7f15601aa7debd28e389108ca2265a8d2ea Mon Sep 17 00:00:00 2001 From: Luca Leon Happel Date: Thu, 6 Jul 2023 20:28:13 +0200 Subject: [PATCH 7/8] refactor: make overlay work --- flake.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 249970d..42a3dc9 100644 --- a/flake.nix +++ b/flake.nix @@ -75,7 +75,11 @@ godotIconSVG = inputs.godot-icon-svg; godotManpage = inputs.godot-manpage; }; - overlays.default = (import ./overlay.nix { inherit pkgs; }); + overlays.default = final: prev: { + godot = packages.godot; + godotHeadless = packages.godotHeadless; + godotMono = packages.godotMono; + }; } ); } From 68adff8f70dceb2a4535dacf772b687019644250 Mon Sep 17 00:00:00 2001 From: Luca Leon Happel Date: Tue, 10 Oct 2023 13:38:34 +0200 Subject: [PATCH 8/8] update: flake hashes --- flake.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index a20ae59..2cc18cb 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { @@ -57,7 +57,7 @@ "godot-manpage": { "flake": false, "locked": { - "narHash": "sha256-+oithkOprerqtxlLWXhiue4bF5CAT+8Zki9drEUWwy0=", + "narHash": "sha256-QBl3N8oOgvzqoTiCCKWUq9PiBqjywhqvCaYM1g40FQw=", "type": "file", "url": "https://raw.githubusercontent.com/godotengine/godot/master/misc/dist/linux/godot.6" }, @@ -68,11 +68,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1686519857, - "narHash": "sha256-VkBhuq67aXXiCoEmicziuDLUPPjeOTLQoj6OeVai5zM=", + "lastModified": 1696757521, + "narHash": "sha256-cfgtLNCBLFx2qOzRLI6DHfqTdfWI+UbvsKYa3b3fvaA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6b1b72c0f887a478a5aac355674ff6df0fc44f44", + "rev": "2646b294a146df2781b1ca49092450e8a32814e1", "type": "github" }, "original": {