Compare commits
No commits in common. "d68d82cb26eb9834bade7eaf9c56b65853c72df5" and "1f965038fc8e18f16b93b38f164efc37ec3d2e9f" have entirely different histories.
d68d82cb26
...
1f965038fc
|
@ -1,4 +1,4 @@
|
||||||
{ lib, config, pkgs, mmdvm_host, mmdvm_firmware, ... }:
|
{ lib, config, pkgs, mmdvm_host, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
# Shorter name to access final settings a
|
# Shorter name to access final settings a
|
||||||
|
@ -10,36 +10,14 @@ in
|
||||||
|
|
||||||
options.services.mmdvm_host = {
|
options.services.mmdvm_host = {
|
||||||
enable = mkEnableOption "MMDVMHost service";
|
enable = mkEnableOption "MMDVMHost service";
|
||||||
|
package = mkOption {
|
||||||
host_package = mkOption {
|
|
||||||
default = mmdvm_host.x86_64-linux.default;
|
default = mmdvm_host.x86_64-linux.default;
|
||||||
type = types.package;
|
type = types.package;
|
||||||
};
|
};
|
||||||
|
|
||||||
firmware_package = mkOption {
|
|
||||||
default = mmdvm_firmware.x86_64-linux.default;
|
|
||||||
type = types.package;
|
|
||||||
};
|
|
||||||
|
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "afg";
|
default = "afg";
|
||||||
};
|
};
|
||||||
|
|
||||||
group = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "afg";
|
|
||||||
};
|
|
||||||
|
|
||||||
config-file = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
|
|
||||||
usb-tty = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "/dev/ttyUSB0";
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,8 +25,7 @@ in
|
||||||
# List packages installed in system profile. To search, run:
|
# List packages installed in system profile. To search, run:
|
||||||
# $ nix search wget
|
# $ nix search wget
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.stm32flash
|
cfg.package
|
||||||
cfg.host_package
|
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.mmdvm_host = {
|
systemd.services.mmdvm_host = {
|
||||||
|
@ -59,22 +36,13 @@ in
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "exec";
|
Type = "exec";
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = "3s";
|
RestartSec = "3s";
|
||||||
|
StartLimitIntervalSec = "0";
|
||||||
RuntimeDirectory = "MMDVMHost";
|
RuntimeDirectory = "MMDVMHost";
|
||||||
};
|
};
|
||||||
script = ''
|
script = ''
|
||||||
if [ ! -e /var/lib/mmdvm/firmware-version ]; then
|
exec ${cfg.package}/bin/MMDVMHost
|
||||||
mkdir -p /var/lib/mmdvm
|
|
||||||
touch /var/lib/mmdvm/firmware-version
|
|
||||||
fi
|
|
||||||
if [ "${cfg.firmware_package}" != "$(cat /var/lib/mmdvm/firmware-version)" ]; then
|
|
||||||
${pkgs.stm32flash}/bin/stm32flash -w ${cfg.firmware_package}/firmware/mmdvm_f4.bin -i ',-dtr,-rts,dtr,,:-dtr,rts,dtr' ${cfg.usb-tty}
|
|
||||||
echo "{cfg.firmware_package}" > /var/lib/mmdvm/firmware-version
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec ${cfg.package}/bin/MMDVMHost ${cfg.config-file}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1734323986,
|
"lastModified": 1717179513,
|
||||||
"narHash": "sha256-m/lh6hYMIWDYHCAsn81CDAiXoT3gmxXI9J987W5tZrE=",
|
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "394571358ce82dff7411395829aa6a3aad45b907",
|
"rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-24.11",
|
"ref": "24.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
description = "A flake for MMDVMHost for DB0KL.";
|
description = "A flake for MMDVMHost for DB0KL.";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/24.05";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,10 +21,7 @@
|
||||||
|
|
||||||
nixosModules.MMDVMHost = { config, pkgs, ... }: {
|
nixosModules.MMDVMHost = { config, pkgs, ... }: {
|
||||||
imports = [ ./MMDVMHost/module.nix ];
|
imports = [ ./MMDVMHost/module.nix ];
|
||||||
_module.args = {
|
_module.args.mmdvm_host = self.packages.x86_64-linux.MMDVMHost;
|
||||||
mmdvm_host = self.packages.x86_64-linux.MMDVMHost;
|
|
||||||
mmdvm_firmware = self.packages.x86_64-linux.MMDVMFirmware;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue