Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/nix-github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ jobs:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: DeterminateSystems/flakehub-cache-action@main
- run: nix build -L '.#${{ matrix.attr }}'
- run: nix build --impure -L '.#${{ matrix.attr }}'
env:
NIXPKGS_ALLOW_UNFREE: 1
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ This repository includes automated package updates:
## Docs

- [Why doesn't my Simulation GUI work?](/docs/simulation-gui.md)
- [FIRST Driver Station (NixOS)](/docs/firstdriverstation.md)

32 changes: 32 additions & 0 deletions docs/firstdriverstation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# FIRST Driver Station (NixOS)

## App permissions

To use the FIRST Driver Station you need your user to be in the input group:

```nix
users.users.alice.extraGroups = [ "input" ];
```

This allows it to access the keyboard for global input and E-Stop functionality.

You can also install the udev rules from the documentation like so:

```nix
{
services.udev.packages = [ pkgs.wpilib.firstdriverstation ];
}
```

However, it's currently unclear whether these udev rules are actually required, as the DS appears to work fine without them.


## App Scaling

The Driver Station uses the Avalonia framework, and runs through XWayland. On wayland with a HiDPI screen this might cause the app to be too small to be readable. The scaling of the app can be controlled by the `AVALONIA_GLOBAL_SCALE_FACTOR` variable:

```nix
environment.sessionVariables.AVALONIA_GLOBAL_SCALE_FACTOR = 2;
```


23 changes: 23 additions & 0 deletions pkgs/frc-nix-update/update-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ fetch_github_hashes() {
hash=$(fetch_url_hash "$url")
echo "hash = \"$hash\";"
;;
"FirstDriverStation")
local base_url="https://github.com/wpilibsuite/FirstDriverStation-Public/releases/download/v${version}"
local hash_x64 hash_arm64
hash_x64=$(fetch_url_hash "$base_url/FirstDriverStation-linux-x64-${version}.tar.gz")
hash_arm64=$(fetch_url_hash "$base_url/FirstDriverStation-linux-arm64-${version}.tar.gz")
echo "x86_64-linux = \"$hash_x64\";"
echo "aarch64-linux = \"$hash_arm64\";"
;;
esac
}

Expand Down Expand Up @@ -419,6 +427,20 @@ update_hashes() {
fi
fi
done <<< "$hash_output"
elif [[ "$tool" == "FirstDriverStation" ]]; then
# FirstDriverStation: update per-arch hashes in sources block
while IFS= read -r hash_line; do
if [[ "$hash_line" =~ ^([a-z0-9_-]+)\ =\ \"([^\"]+)\"\;$ ]]; then
local arch="${BASH_REMATCH[1]}"
local hash_val="${BASH_REMATCH[2]}"
# Match the arch key in sources and update the following hash line
awk -v arch="$arch" -v hash="$hash_val" '
$0 ~ "\"" arch "\"" { found=1 }
found && /hash = / { gsub(/hash = "[^"]*"/, "hash = \"" hash "\""); found=0 }
{ print }
' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
fi
done <<< "$hash_output"
else
# Other packages use artifactHashes block
local temp_file
Expand Down Expand Up @@ -599,6 +621,7 @@ update_all_packages() {
["pathplanner"]="mjansen4857/pathplanner:pkgs/pathplanner/package.nix:PathPlanner"
["vscode-wpilib"]="wpilibsuite/vscode-wpilib:pkgs/wpilib/vscode-wpilib.nix:vscode-wpilib"
["wpilib-utility"]="wpilibsuite/vscode-wpilib:pkgs/wpilib/wpilib-utility.nix:wpilib-utility"
["firstdriverstation"]="wpilibsuite/FirstDriverStation-Public:pkgs/wpilib/firstdriverstation/package.nix:FirstDriverStation"
)

for package in "${!github_packages[@]}"; do
Expand Down
2 changes: 2 additions & 0 deletions pkgs/wpilib/firstdriverstation/72-hidraw.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Grant access to all hidraw devices for the active user
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0660", TAG+="uaccess"
163 changes: 163 additions & 0 deletions pkgs/wpilib/firstdriverstation/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
lib,
stdenv,
autoPatchelfHook,
copyDesktopItems,
fetchurl,
makeDesktopItem,
udevCheckHook,
makeWrapper,

alsa-lib,
angle,
avahi,
fontconfig,
gtk3,
icu,
libGL,
libgcc,
libice,
libinput,
libpulseaudio,
libsm,
libusb1,
libx11,
libxcb,
libxcursor,
libxext,
libxfixes,
libxi,
libxrandr,
pipewire,
sndio,
udev,
webkitgtk_4_1,
dhcpcd,
}:
let
pname = "firstdriverstation";
version = "2027.0.0-alpha-2";

sourceURL = "https://github.com/wpilibsuite/FirstDriverStation-Public/releases/download/v${version}";
sources = {
"x86_64-linux" = fetchurl {
url = "${sourceURL}/FirstDriverStation-linux-x64-${version}.tar.gz";
hash = "sha256-MnDV6FQSYoPa3jQrXu+aD6UeNB9ZO4MtCHOqHTn5ei8=";
};
"aarch64-linux" = fetchurl {
url = "${sourceURL}/FirstDriverStation-linux-arm64-${version}.tar.gz";
hash = "sha256-CZ5VAlCIyz0mA+IjpbqRSjdSoozomCfhs46txbKhdag=";
};
};
in
stdenv.mkDerivation (finalAttrs: {
inherit pname version;

src =
sources.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");

sourceRoot = ".";

nativeBuildInputs = [
autoPatchelfHook
copyDesktopItems
udevCheckHook
];

buildInputs = [
makeWrapper

alsa-lib
angle
avahi
fontconfig
libGL
libgcc
libinput
libpulseaudio
libusb1
libx11
libxcb
libxcursor
libxext
libxfixes
libxi
libxrandr
pipewire
pipewire.jack
sndio
udev
];

autoPatchelfIgnoreMissingDeps = [
"libGLES_CM.so.1"
"libsteam_api.so"
];

runtimeDependencies = [
gtk3
icu
libice
libsm
libx11
webkitgtk_4_1
];

dontBuild = true;

installPhase =
let
installPath = "$out/lib/wpilib/firstdriverstation";
in
''
runHook preInstall

install -Dm744 ./FirstDriverStation ${installPath}/FirstDriverStation
install -Dm744 ./libHarfBuzzSharp.so ${installPath}/libHarfBuzzSharp.so
install -Dm744 ./libSkiaSharp.so ${installPath}/libSkiaSharp.so

install -Dm644 ./License.txt $out/share/doc/FirstDriverStation/License.txt
install -Dm644 ${./72-hidraw.rules} $out/etc/udev/rules.d/72-hidraw.rules
install -Dm644 ${../wpilib_logo.svg} $out/share/icons/hicolor/scalable/apps/FirstDriverStation.svg

makeWrapper ${installPath}/FirstDriverStation $out/bin/FirstDriverStation \
--prefix PATH : ${lib.makeBinPath [ dhcpcd ]}

runHook postInstall
'';

desktopItems = [
(makeDesktopItem rec {
name = "FirstDriverStation";
desktopName = name;
exec = name;
comment = finalAttrs.meta.description or null;
icon = name;
categories = [
"Robotics"
"Development"
];
keywords = [
"FRC"
"FTC"
"DriverStation"
];
})
];
meta = {
description = "Enables users to control their FTC and FRC robots.";
homepage = "https://github.com/wpilibsuite/FirstDriverStation-Public/";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ nullcube ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
platforms = [
"x86_64-linux"
"aarch64-linux"
# TODO: Support darwin
# "x86_64-darwin"
# "aarch64-darwin"
];
mainProgram = "FirstDriverStation";
};
})
Loading