First Commit

This commit is contained in:
2026-01-05 04:04:36 +01:00
commit c7a17f7772
83 changed files with 3574 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
{
description = "Artemis RGB (Avalonia + SkiaSharp, NixOS compatible)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
};
outputs = { nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
artemis = pkgs.stdenvNoCC.mkDerivation rec {
pname = "artemis-rgb";
version = "latest-master";
src = pkgs.fetchurl {
url = "https://updating.artemis-rgb.com/api/artifacts/latest/master/linux";
sha256 = "sha256-YzgkzfVZbxSesrVTZTvUXWm8K2TBA6pQbiN9ErDGzeA=";
};
nativeBuildInputs = [
pkgs.unzip
pkgs.makeWrapper
];
buildInputs = [
# .NET runtime deps
pkgs.icu
pkgs.zlib
pkgs.openssl
# Skia / fonts
pkgs.fontconfig
pkgs.freetype
# X11 (required even on Wayland for Avalonia)
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXrandr
pkgs.xorg.libXi
pkgs.xorg.libXinerama
pkgs.xorg.libxcb
pkgs.xorg.libICE
pkgs.xorg.libSM
# Graphics / display
pkgs.mesa
pkgs.wayland
];
unpackPhase = ''
unzip $src
'';
installPhase = ''
mkdir -p $out/lib/artemis
cp -r ./* $out/lib/artemis
chmod +x $out/lib/artemis/Artemis.UI.Linux
mkdir -p $out/bin
makeWrapper $out/lib/artemis/Artemis.UI.Linux \
$out/bin/Artemis.UI.Linux \
--set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath buildInputs}"
mkdir -p $out/share/applications
cat > $out/share/applications/artemis.desktop <<EOF
[Desktop Entry]
Name=Artemis
Exec=Artemis.UI.Linux
Icon=artemis
Terminal=false
Type=Application
Categories=Utility;
EOF
if [ -d $out/lib/artemis/Icons ]; then
mkdir -p $out/share/icons/hicolor
cp -r $out/lib/artemis/Icons/* $out/share/icons/hicolor/
fi
'';
meta = with pkgs.lib; {
description = "Artemis RGB lighting controller";
homepage = "https://artemis-rgb.com";
license = licenses.unfreeRedistributable;
platforms = [ "x86_64-linux" ];
};
};
in {
packages.${system}.default = artemis;
};
}

View File

@@ -0,0 +1,132 @@
{
description = "NixOS flake for OpenLinkHub";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
outputs = { nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
openlinkhubPkg = pkgs.buildGoModule rec {
pname = "openlinkhub";
version = "0.7.4";
src = pkgs.fetchFromGitHub {
owner = "jurkovic-nikola";
repo = "OpenLinkHub";
tag = version;
sha256 = "sha256-isUi3GDGmZ5BwOrLkxlPRzfZZyPlTZNhwq/dCKVfsXo=";
};
# REQUIRED for Go deps
vendorHash = "sha256-wLoDbaLfSP2VLbl5yzJSSA7cvsv5tXnfb5+jsy0BjGA=";
buildInputs = [
pkgs.udev
];
subPackages = [ "." ];
postInstall = ''
# Udev rules (correct NixOS way)
mkdir -p $out/lib/udev/rules.d
cp 99-openlinkhub.rules $out/lib/udev/rules.d/
'';
meta = with pkgs.lib; {
description = "Open source interface for iCUE LINK Hub & Corsair devices";
homepage = "https://github.com/jurkovic-nikola/OpenLinkHub";
license = licenses.gpl3;
platforms = platforms.linux;
};
};
module = { config, lib, ... }: {
options.openlinkhub.enable =
lib.mkEnableOption "Enable OpenLinkHub service";
config = lib.mkIf config.openlinkhub.enable {
environment.systemPackages = [ openlinkhubPkg ];
users.groups.openlinkhub = {};
users.users.openlinkhub = {
isSystemUser = true;
group = "openlinkhub";
description = "OpenLinkHub service user";
home = "/var/lib/openlinkhub";
createHome = true;
};
services.udev.packages = [ openlinkhubPkg ];
systemd.services.openlinkhub = {
description = "OpenLinkHub service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "udev.service" ];
# On first service start, populate working dir
preStart = ''
# Create working directory if missing
mkdir -p /var/lib/openlinkhub
cd /var/lib/openlinkhub
# Copy database if missing
if [ ! -d database ]; then
cp -r ${openlinkhubPkg.src}/database .
fi
rm -r static || true
# Copy static assets if missing
if [ ! -d static ]; then
cp -r ${openlinkhubPkg.src}/static .
fi
rm -r static || true
# Copy web UI if missing
if [ ! -d web ]; then
cp -r ${openlinkhubPkg.src}/web .
fi
rm -r api || true
# Copy api docs if missing
if [ ! -d api ]; then
cp -r ${openlinkhubPkg.src}/api .
fi
# Ensure ownership
chown -R openlinkhub:openlinkhub /var/lib/openlinkhub
chmod u+w /var/lib/openlinkhub -R
'';
serviceConfig = {
ExecStart = "${openlinkhubPkg}/bin/OpenLinkHub";
StateDirectory = "openlinkhub";
WorkingDirectory = "/var/lib/openlinkhub";
User = "openlinkhub";
Group = "openlinkhub";
Restart = "on-failure";
NoNewPrivileges = true;
PrivateTmp = true;
ProtectSystem = "strict";
ProtectHome = true;
};
};
};
};
in
{
packages.${system}.default = openlinkhubPkg;
nixosModules.default = module;
nixosModules.openlinkhub = module;
};
}