From 05bc82a5c13300974f4c07552b51868e1f687eb8 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Thu, 16 Oct 2025 19:32:21 +0100 Subject: [PATCH] minors --- flake.nix | 66 ++++++++++++++++++++++++++++++++++++++++++++------ src/window.cpp | 20 +++++++-------- 2 files changed, 69 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index d71eb49..81b5f4b 100644 --- a/flake.nix +++ b/flake.nix @@ -10,31 +10,83 @@ flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; - in { + # 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; - nativeBuildInputs = [ pkgs.meson pkgs.ninja pkgs.pkg-config ]; - buildInputs = [ pkgs.gtkmm4 pkgs.libsigcxx30 pkgs.glibmm ]; + 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 = [ pkgs.meson pkgs.ninja pkgs.pkg-config ]; - buildInputs = [ pkgs.gtkmm4 pkgs.libsigcxx30 pkgs.glibmm ]; + 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 + ]; }; - }); } diff --git a/src/window.cpp b/src/window.cpp index df3a0ab..9c9deff 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -43,7 +43,7 @@ void MainWindow::setupUI() { // Configure main window set_title("MineSweeper"); - set_default_size(400, 400); + set_default_size(650, 650); set_resizable(true); // Configure main layout @@ -249,14 +249,14 @@ void MainWindow::setupCSSProviders() css_provider->load_from_data( "button.cell-button { border-radius: 0; margin: 1px; padding: 0; }" ".cell-button:checked { background-color: #e0e0e0; }" - ".label-1 { font-weight: bold; font-size: 1.2em; color: blue; }" - ".label-2 { font-weight: bold; font-size: 1.2em; color: green; }" - ".label-3 { font-weight: bold; font-size: 1.2em; color: darkorange; }" - ".label-4 { font-weight: bold; font-size: 1.2em; color: purple; }" - ".label-5 { font-weight: bold; font-size: 1.2em; color: red; }" - ".label-6 { font-weight: bold; font-size: 1.2em; color: salmon; }" - ".label-7 { font-weight: bold; font-size: 1.2em; color: turquoise; }" - ".label-8 { font-weight: bold; font-size: 1.2em; color: magenta; }" + ".label-1 { font-weight: bold; font-size: 1.1em; color: blue; }" + ".label-2 { font-weight: bold; font-size: 1.1em; color: green; }" + ".label-3 { font-weight: bold; font-size: 1.1em; color: darkorange; }" + ".label-4 { font-weight: bold; font-size: 1.1em; color: purple; }" + ".label-5 { font-weight: bold; font-size: 1.1em; color: red; }" + ".label-6 { font-weight: bold; font-size: 1.1em; color: salmon; }" + ".label-7 { font-weight: bold; font-size: 1.1em; color: turquoise; }" + ".label-8 { font-weight: bold; font-size: 1.1em; color: magenta; }" ".confetti { opacity: 0.8; }" ); @@ -1061,7 +1061,7 @@ void MainWindow::showNameInputDialog(int time) showLeaderboard(); } - dialog->close(); + //dialog->close(); // Ask if player wants to play again auto newGameDialog = Gtk::make_managed(