Skip to content

Commit

Permalink
pineflash: init at 0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
acuteaangle committed Jan 1, 2025
1 parent 7f1e16d commit 4e39dcf
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkgs/by-name/pi/pineflash/fix_pkexec_path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/src/submodules/flash.rs b/src/submodules/flash.rs
index 5b224b2..e30f286 100644
--- a/src/submodules/flash.rs
+++ b/src/submodules/flash.rs
@@ -107,7 +107,7 @@ impl Flasher {
let dfupath = "dfu-util";

#[cfg(target_os = "linux")]
- let command = Command::new("pkexec")
+ let command = Command::new("/run/wrappers/bin/pkexec")
// .env("PATH", path)
.arg(dfupath)
.arg("-D")
@@ -182,7 +182,7 @@ impl Flasher {
let blisppath = "blisp";

#[cfg(target_os = "linux")]
- let command = Command::new("pkexec")
+ let command = Command::new("/run/wrappers/bin/pkexec")
.env("PATH", "/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:linux")
.arg(blisppath)
.arg("write")
70 changes: 70 additions & 0 deletions pkgs/by-name/pi/pineflash/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
pkg-config,
openssl,
systemd,
glib,
gtk3,
dfu-util,
blisp,
fontconfig,
libxkbcommon,
libGL,
}:
rustPlatform.buildRustPackage rec {
pname = "pineflash";
version = "0.5.5";

src = fetchFromGitHub {
owner = "Spagett1";
repo = "pineflash";
tag = "${version}";
hash = "sha256-4tcwEok36vuXbtlZNUkLNw1kHFQPBEJM/gWRhRWNLPg=";
};

cargoHash = "sha256-l01It6mUflENlADW6PpOQvK1o4qOjbTsMLB6n+OIl0U=";

patches = [
./fix_pkexec_path.patch
];

postPatch = ''
substituteInPlace src/submodules/flash.rs \
--replace-fail 'let blisppath = "blisp";' 'let blisppath = "${blisp}/bin/blisp";' \
--replace-fail 'let dfupath = "dfu-util";' 'let dfupath = "${dfu-util}/bin/dfu-util";'
'';

nativeBuildInputs = [
pkg-config
];

buildInputs = [
openssl
systemd
glib
gtk3
fontconfig
libxkbcommon
libGL
dfu-util
blisp
];

postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf $out/bin/pineflash --add-rpath ${libxkbcommon}/lib
patchelf $out/bin/pineflash --add-rpath ${libGL}/lib
'';

meta = {
description = "GUI tool to flash IronOS to the Pinecil V1 and V2";
homepage = "https://github.com/Spagett1/pineflash";
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [
acuteaangle
];
mainProgram = "pineflash";
};
}

0 comments on commit 4e39dcf

Please sign in to comment.