Files
minesweeper/flake.nix
Bernardo Magri 05bc82a5c1 minors
2025-10-16 19:32:21 +01:00

93 lines
2.4 KiB
Nix

{
description = "GTK4 Minesweeper game";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
# Robust fallbacks across channels
wrapGApps = pkgs.wrapGAppsHook4 or pkgs.wrapGAppsHook;
adwaitaTheme = pkgs.gnome.adwaita-icon-theme or pkgs.adwaita-icon-theme;
in
{
# Main package
packages.default = pkgs.stdenv.mkDerivation rec {
pname = "minesweeper";
version = "0.1";
src = self;
strictDeps = true;
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
gobject-introspection
wrapGApps
];
buildInputs = with pkgs; [
gtk4
gtkmm4
glibmm
libsigcxx30
gdk-pixbuf
librsvg # SVG loader
gvfs # GIO modules
gsettings-desktop-schemas
hicolor-icon-theme
adwaitaTheme
];
# Ensure we use Nix-provided GIO modules, not host ones
preFixup = ''
gappsWrapperArgs+=(
--set GIO_EXTRA_MODULES ${pkgs.gvfs}/lib/gio/modules
)
'';
meta = with pkgs.lib; {
description = "A simple GTKmm4 Minesweeper game";
homepage = "https://example.org/minesweeper";
license = licenses.gpl3Plus;
platforms = platforms.linux;
mainProgram = "minesweeper";
};
};
# nix run support
apps.${system}.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/minesweeper";
};
# Dev shell for hacking
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
gobject-introspection
];
buildInputs = with pkgs; [
gtk4
gtkmm4
glibmm
libsigcxx30
gdk-pixbuf
librsvg
gvfs
gsettings-desktop-schemas
hicolor-icon-theme
adwaitaTheme
];
};
});
}