Initial commit
This commit is contained in:
commit
68bea2c7e8
16
0001-patch-install-path.patch
Normal file
16
0001-patch-install-path.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
diff --git a/Makefile b/Makefile
|
||||
index bac0711..0e17fc4 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -30,8 +30,9 @@ RemoteCommand: Log.o RemoteCommand.o UDPSocket.o
|
||||
|
||||
.PHONY install:
|
||||
install: all
|
||||
- install -m 755 MMDVMHost /usr/local/bin/
|
||||
- install -m 755 RemoteCommand /usr/local/bin/
|
||||
+ mkdir -p ${out}/bin
|
||||
+ install -m 755 MMDVMHost ${out}/bin/
|
||||
+ install -m 755 RemoteCommand ${out}/bin/
|
||||
|
||||
.PHONY install-service:
|
||||
install-service: install /etc/MMDVM.ini
|
12
0002-fix-missing-include.patch
Normal file
12
0002-fix-missing-include.patch
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/M17Utils.cpp b/M17Utils.cpp
|
||||
index 4462c9b..a65ca13 100644
|
||||
--- a/M17Utils.cpp
|
||||
+++ b/M17Utils.cpp
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "M17Defines.h"
|
||||
|
||||
#include <cassert>
|
||||
+#include <cstdint>
|
||||
|
||||
const std::string M17_CHARS = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-/.";
|
||||
|
22
0003-fix-null-controller.patch
Normal file
22
0003-fix-null-controller.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
diff --git a/NullController.cpp b/NullController.cpp
|
||||
index edfeffe..598b783 100644
|
||||
--- a/NullController.cpp
|
||||
+++ b/NullController.cpp
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
+#include <cstdint>
|
||||
|
||||
const unsigned char MMDVM_FRAME_START = 0xE0U;
|
||||
|
||||
@@ -120,7 +121,8 @@ void CNullController::writeVersion()
|
||||
::memset(reply + 7U, 0x00U, 16U);
|
||||
|
||||
uint8_t count = 23U;
|
||||
- for (uint8_t i = 0U; HARDWARE[i] != 0x00U; i++, count++)
|
||||
+ uint8_t i = 0;
|
||||
+ for (i = 0U; HARDWARE[i] != 0x00U; i++, count++)
|
||||
reply[count] = HARDWARE[i];
|
||||
|
||||
reply[1U] = count;
|
20
default.nix
Normal file
20
default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ stdenv, fetchFromGitHub, ... }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "MMDVMHost";
|
||||
version = "yolo";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "g4klx";
|
||||
repo = "MMDVMHost";
|
||||
rev = "b02560ccbc02bdb076b77aaef3e70655a714cd36";
|
||||
sha256 = "sha256-y9mreTIsQuKr1HlUGuSZIdry9f1yFXkbEKKzAaK79v0=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./0001-patch-install-path.patch
|
||||
./0002-fix-missing-include.patch
|
||||
./0003-fix-null-controller.patch
|
||||
];
|
||||
|
||||
}
|
27
flake.lock
Normal file
27
flake.lock
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1717179513,
|
||||
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
26
flake.nix
Normal file
26
flake.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
description = "A flake for mmdvm DL0XK patches.";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/24.05";
|
||||
};
|
||||
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, ... }:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
in
|
||||
{
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
|
||||
|
||||
packages = {
|
||||
x86_64-linux = {
|
||||
default = nixpkgs.legacyPackages.x86_64-linux.callPackage ./default.nix { };
|
||||
};
|
||||
};
|
||||
|
||||
nixosModules.default = { config, pkgs, ... }: {
|
||||
imports = [ ./module.nix ];
|
||||
_module.args.mmdvm_host = self.packages;
|
||||
};
|
||||
};
|
||||
}
|
50
module.nix
Normal file
50
module.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ lib, config, pkgs, mmdvm_host, ... }:
|
||||
with lib;
|
||||
let
|
||||
# Shorter name to access final settings a
|
||||
# user of hello.nix module HAS ACTUALLY SET.
|
||||
# cfg is a typical convention.
|
||||
cfg = config.services.mmdvm_host;
|
||||
in
|
||||
{
|
||||
|
||||
options.services.mmdvm_host = {
|
||||
enable = mkEnableOption "mmdvm host service";
|
||||
package = mkOption {
|
||||
default = mmdvm_host.x86_64-linux.default;
|
||||
type = types.package;
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "afg";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = [
|
||||
cfg.package
|
||||
];
|
||||
|
||||
systemd.services.mmdvm_host = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network.target" ];
|
||||
after = [ "network.target" ];
|
||||
description = "mmdvm_host service";
|
||||
serviceConfig = {
|
||||
Type = "exec";
|
||||
User = cfg.user;
|
||||
Restart = "always";
|
||||
RestartSec = "3s";
|
||||
StartLimitIntervalSec = "0";
|
||||
RuntimeDirectory = "mmdvm_host";
|
||||
};
|
||||
script = ''
|
||||
exec ${cfg.package}/bin/mmdvm_host
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue