adding default.nix for nix packaging

This commit is contained in:
Bernardo Magri
2025-04-24 18:20:42 +01:00
parent c61173308a
commit fe0b39a49d
3 changed files with 109 additions and 24 deletions

48
default.nix Normal file
View File

@@ -0,0 +1,48 @@
{ lib
, stdenv
, fetchFromGitHub
, meson
, ninja
, pkg-config
, wrapGAppsHook4
, gtk4
, gtkmm4
, libsigcxx
}:
stdenv.mkDerivation rec {
pname = "minesweeper";
version = "0.2.0";
src = ./.;
# If you want to use fetchFromGitHub instead:
# src = fetchFromGitHub {
# owner = "username";
# repo = "minesweeper";
# rev = "v${version}";
# hash = "sha256-0000000000000000000000000000000000000000000=";
# };
nativeBuildInputs = [
meson
ninja
pkg-config
wrapGAppsHook4
];
buildInputs = [
gtk4
gtkmm4
libsigcxx
];
meta = with lib; {
description = "Modern Minesweeper game with GTK4 interface";
homepage = "https://github.com/username/minesweeper";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ /* your name here */ ];
mainProgram = "minesweeper";
};
}

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1735563628,
"narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"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",
"version": 7
}

View File

@@ -1,24 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
meson
ninja
pkg-config
gtk4
gtkmm4
libsigcxx
# Development tools
gdb
valgrind
clang-tools
];
shellHook = ''
echo "MineSweeper Development Environment"
echo "=================================="
echo "Build with: meson setup build && meson compile -C build"
echo "Run with: ./build/minesweeper"
'';
}