shithub: m8c

Download patch

ref: 3dd55d91838f71eccaa80e06a7006e5ff5925081
parent: f6b0c1e4b4fb0d59b4ce0839bae6f3dc69cc90cc
parent: c5390f9c7fc905ccefba13e03408744befe1374a
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Mon Sep 15 10:58:18 EDT 2025

Merge pull request #207 from pope/supernix

Simplify the Nix config and add a workflow for it

--- a/.github/workflows/build-ubuntu.yml
+++ b/.github/workflows/build-ubuntu.yml
@@ -12,13 +12,13 @@
 jobs:
  
   build-linux:
-    runs-on: ubuntu-22.04
+    runs-on: ubuntu-latest
     name: linux-x86_64
     steps:
       - name: 'Install dependencies'
         run: |
-          sudo apt-get update
-          sudo apt-get install --fix-missing build-essential libserialport-dev zip git make pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev
+          sudo apt-get update -y
+          sudo apt-get install -y --fix-missing build-essential libserialport-dev zip git make pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev
 
       - name: 'Checkout'
         uses: actions/checkout@v4
@@ -80,3 +80,27 @@
           name: m8c-${{ env.NOW }}-linux-x86_64.AppImage
           path: |
             m8c*.AppImage
+
+  build-linux-with-nix:
+    runs-on: ubuntu-latest
+    name: with-nix-linux-x86_64
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set current date as env variable
+        run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
+
+      - name: Set up Nix
+        uses: cachix/install-nix-action@v31
+        with:
+          nix_path: nixpkgs=channel:nixos-unstable
+
+      - name: 'Build binary'
+        run: nix-build
+
+      - name: 'Upload artifact'
+        uses: actions/upload-artifact@v4
+        with:
+          name: m8c-${{ env.NOW }}-with-nix-linux-x86_64
+          path: result
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,7 @@
 endif ()
 
 if (WIN32)
-target_link_libraries(${APP_NAME} ${SDL3_LIBRARIES} ${LIBSERIALPORT_LIBRARIES})
+    target_link_libraries(${APP_NAME} ${SDL3_LIBRARIES} ${LIBSERIALPORT_LIBRARIES})
 endif ()
 
 if (APPLE)
@@ -108,4 +108,10 @@
     set(CPACK_PACKAGE_DIRECTORY "package-output")
     set(CPACK_GENERATOR "DragNDrop")
     include(CPack)
-endif ()
\ No newline at end of file
+elseif (UNIX)
+    install(TARGETS ${APP_NAME})
+    install(DIRECTORY package/share/applications DESTINATION share/)
+    install(DIRECTORY package/share/icons DESTINATION share/)
+    install(FILES AUDIOGUIDE.md README.md LICENSE DESTINATION share/doc/${APP_NAME})
+    install(FILES gamecontrollerdb.txt DESTINATION bin/)
+endif ()
--- a/README.md
+++ b/README.md
@@ -70,7 +70,7 @@
 #### NixOS
 
 ```sh
-nix-env -iA m8c-stable -f https://github.com/laamaa/m8c/archive/refs/heads/main.tar.gz
+nix-env -iA m8c -f https://github.com/laamaa/m8c/archive/refs/heads/main.tar.gz
 ```
 
 Or if you're using flakes and the nix command, you can run the app directly with:
@@ -329,4 +329,4 @@
 * No audio output:
   - Check that audio routing is enabled (F12)
   - Verify audio device selection in config
-  - On macOS, ensure microphone permission is granted
\ No newline at end of file
+  - On macOS, ensure microphone permission is granted
--- a/default.nix
+++ b/default.nix
@@ -14,5 +14,5 @@
     }).defaultNix.packages.${builtins.currentSystem};
 in
 {
-  inherit (pkgs) m8c-stable m8c-dev;
+  inherit (pkgs) m8c;
 }
--- a/flake.nix
+++ b/flake.nix
@@ -14,39 +14,21 @@
 
   outputs = { self, nixpkgs, systems, treefmt-nix, ... }:
     let
-      # HOWTO keep this package definition up-to-date:
-      #
-      # 1. NEW VERSION:
-      # After the new version is tagged and pushed, update the `version` var to the
-      # proper value and update the hash. You can use the following command to find
-      # out the sha256, for example, with version 1.0.3:
-      # `nix-prefetch-github --rev v1.0.3 laamaa m8c`
-      #
-      # 2. NEW DEPENDENCIES:
-      # Make sure new dependencies are added. Runtime deps go to buildInputs and
-      # compile-time deps go to nativeBuildInputs. Use the nixpkgs manual for help
       pname = "m8c";
       version = "2.1.0";
       m8c-package =
         { stdenv
-        , gnumake
+        , cmake
+        , copyDesktopItems
         , pkg-config
         , sdl3
         , libserialport
-        , fetchFromGitHub
         }:
         stdenv.mkDerivation {
           inherit pname version;
+          src = ./.;
 
-          src = fetchFromGitHub {
-            owner = "laamaa";
-            repo = pname;
-            rev = "v${version}";
-            hash = "sha256-grShHkCkBqgPHTLYwqQUnvIRzUxW1ENU0dYO4TOpYO8=";
-          };
-
-          installFlags = [ "PREFIX=$(out)" ];
-          nativeBuildInputs = [ gnumake pkg-config ];
+          nativeBuildInputs = [ cmake copyDesktopItems pkg-config ];
           buildInputs = [ sdl3 libserialport ];
         };
       eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f
@@ -64,21 +46,18 @@
     in
     {
       packages = eachSystem (pkgs: rec {
-        m8c-stable = pkgs.callPackage m8c-package { };
-        m8c-dev = (pkgs.callPackage m8c-package { }).overrideAttrs (_oldAttrs: {
-          src = ./.;
-        });
-        default = m8c-stable;
+        m8c = pkgs.callPackage m8c-package { };
+        default = m8c;
       });
 
       overlays.default = final: _prev: {
-        inherit (self.packages.${final.system}) m8c-stable m8c-dev;
+        inherit (self.packages.${final.system}) m8c;
       };
 
       apps = eachSystem (pkgs: rec {
         m8c = {
           type = "app";
-          program = "${self.packages.${pkgs.system}.m8c-stable}/bin/m8c";
+          program = "${self.packages.${pkgs.system}.m8c}/bin/m8c";
         };
         default = m8c;
       });
@@ -91,7 +70,7 @@
             nix-prefetch-github
             treefmtEval.${system}.config.build.wrapper
           ];
-          inputsFrom = [ self.packages.${system}.m8c-dev ];
+          inputsFrom = [ self.packages.${system}.m8c ];
         };
       });
 
--- /dev/null
+++ b/package/share/applications/m8c.desktop
@@ -1,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=m8c
+Exec=m8c
+Icon=m8c
+Categories=Audio;AudioVideo
+Version=1.4
binary files /dev/null b/package/share/icons/hicolor/1024x1024/apps/m8c.png differ
binary files /dev/null b/package/share/icons/hicolor/128x128/apps/m8c.png differ
binary files /dev/null b/package/share/icons/hicolor/256x256/apps/m8c.png differ
binary files /dev/null b/package/share/icons/hicolor/32x32/apps/m8c.png differ
binary files /dev/null b/package/share/icons/hicolor/48x48/apps/m8c.png differ
binary files /dev/null b/package/share/icons/hicolor/512x512/apps/m8c.png differ
binary files /dev/null b/package/share/icons/hicolor/64x64/apps/m8c.png differ
--