Skip to content

Commit fb9bb0d

Browse files
committed
Use Nix flakes instead of git submodules
1 parent e00e128 commit fb9bb0d

File tree

2 files changed

+154
-17
lines changed

2 files changed

+154
-17
lines changed

flake.lock

Lines changed: 106 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,51 @@
2020
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2121
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2222

23-
# Due to the use of submodules this has to be build with:
24-
#
25-
# nix build "git+file://$(pwd)?submodules=1"
26-
#
27-
# See: https://github.com/NixOS/nix/pull/5434
2823
{
2924
description = "A 2D platform game featuring Tux the penguin";
3025

31-
inputs = rec {
26+
inputs = {
3227
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
3328
flake-utils.url = "github:numtide/flake-utils";
29+
30+
tinycmmc.url = "gitlab:grumbel/cmake-modules";
31+
tinycmmc.inputs.nixpkgs.follows = "nixpkgs";
32+
tinycmmc.inputs.flake-utils.follows = "flake-utils";
33+
34+
sexpcpp.url = "gitlab:lispparser/sexp-cpp";
35+
sexpcpp.inputs.nixpkgs.follows = "nixpkgs";
36+
sexpcpp.inputs.flake-utils.follows = "flake-utils";
37+
sexpcpp.inputs.tinycmmc.follows = "tinycmmc";
38+
39+
tinygettext.url = "github:tinygettext/tinygettext";
40+
tinygettext.inputs.nixpkgs.follows = "nixpkgs";
41+
tinygettext.inputs.flake-utils.follows = "flake-utils";
42+
tinygettext.inputs.tinycmmc.follows = "tinycmmc";
43+
44+
SDL2_ttf.url = "github:SuperTux/SDL_ttf";
45+
SDL2_ttf.inputs.nixpkgs.follows = "nixpkgs";
46+
SDL2_ttf.inputs.flake-utils.follows = "flake-utils";
3447
};
3548

36-
outputs = { self, nixpkgs, flake-utils }:
49+
outputs = { self, nixpkgs, flake-utils, tinycmmc, sexpcpp, tinygettext, SDL2_ttf }:
3750
flake-utils.lib.eachDefaultSystem (system:
3851
let
3952
pkgs = nixpkgs.legacyPackages.${system};
4053
in rec {
4154
packages = flake-utils.lib.flattenTree rec {
55+
squirrel = pkgs.stdenv.mkDerivation {
56+
pname = "squirrel";
57+
version = "3.2";
58+
src = pkgs.fetchgit {
59+
url = "https://github.com/albertodemichelis/squirrel.git";
60+
rev = "v3.2";
61+
hash = "sha256-vzAF0ooYoghw0yKKoS0Q6RnPPMhmP+05RoutVSZIGwk=";
62+
};
63+
nativeBuildInputs = [
64+
pkgs.cmake
65+
];
66+
};
67+
4268
raqm = pkgs.stdenv.mkDerivation rec {
4369
pname = "libraqm";
4470
version = "0.7.2";
@@ -70,23 +96,25 @@
7096
# isn't included in the Nix store.
7197
version = "0.6.3-unknown-" + (if (self ? shortRev) then self.shortRev else "dirty");
7298
src = nixpkgs.lib.cleanSource ./.;
73-
postPatch = let
99+
patchPhase = let
74100
ver = builtins.splitVersion version;
75-
in ''cat > version.cmake <<EOF
101+
in ''
102+
substituteInPlace config.h.cmake \
103+
--replace "#define _SQ64" ""
104+
105+
cat > version.cmake <<EOF
76106
SET(SUPERTUX_VERSION_MAJOR ${builtins.elemAt ver 0})
77107
SET(SUPERTUX_VERSION_MINOR ${builtins.elemAt ver 1})
78108
SET(SUPERTUX_VERSION_PATCH ${builtins.elemAt ver 2})
79109
SET(SUPERTUX_VERSION_TWEAK )
80110
SET(SUPERTUX_VERSION_STRING "v${version}")
81111
SET(SUPERTUX_VERSION_BUILD "${builtins.elemAt ver 4}")
82112
EOF
83-
'';
113+
'';
84114
cmakeFlags = [ "-DINSTALL_SUBDIR_BIN=bin" ];
85115
enableParallelBuilding = true;
86116
nativeBuildInputs = [
87117
pkgs.cmake
88-
pkgs.ninja
89-
pkgs.gcc
90118
pkgs.pkgconfig
91119
pkgs.makeWrapper
92120
pkgs.git
@@ -98,10 +126,17 @@ EOF
98126
'';
99127
buildInputs = [
100128
raqm
129+
squirrel
130+
sexpcpp.defaultPackage.${system}
131+
tinygettext.defaultPackage.${system}
132+
SDL2_ttf.defaultPackage.${system}
133+
134+
pkgs.physfs
135+
pkgs.SDL_ttf
101136

102137
pkgs.boost
103138
pkgs.curl
104-
pkgs.fmt
139+
pkgs.fmt_8
105140
pkgs.fribidi
106141
pkgs.harfbuzz
107142
pkgs.freetype

0 commit comments

Comments
 (0)