mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-21 19:35:49 +08:00
feat(nix): added modules and packages
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# default.nix - for backwards compatibility with nix-build
|
||||||
|
(import (
|
||||||
|
fetchTarball {
|
||||||
|
url = "https://github.com/edolstra/flake-compat/archive/master.tar.gz";
|
||||||
|
sha256 = "0bi4cpqmwpqkv2ikml4ryh14j5l9bl1f16wfixa97h6yvk7ik9aw";
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
src = ./.;
|
||||||
|
}).defaultNix
|
||||||
Generated
+27
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1766309749,
|
||||||
|
"narHash": "sha256-3xY8CZ4rSnQ0NqGhMKAy5vgC+2IVK0NoVEzDoOh4DA4=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a6531044f6d0bef691ea18d4d4ce44d0daa6e816",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = forAllSystems (system: {
|
||||||
|
default = nixpkgs.legacyPackages.${system}.callPackage ./nix/package.nix { };
|
||||||
|
});
|
||||||
|
|
||||||
|
apps = forAllSystems (system: {
|
||||||
|
default = {
|
||||||
|
type = "app";
|
||||||
|
program = "${self.packages.${system}.default}/bin/idescriptor";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
devShells = forAllSystems (system:
|
||||||
|
let pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cmake
|
||||||
|
pkg-config
|
||||||
|
go
|
||||||
|
qt6.wrapQtAppsHook
|
||||||
|
copyDesktopItems
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
qt6.qtbase
|
||||||
|
qt6.qtdeclarative
|
||||||
|
qt6.qtmultimedia
|
||||||
|
qt6.qtserialport
|
||||||
|
qt6.qtpositioning
|
||||||
|
qt6.qtlocation
|
||||||
|
lxqt.qtermwidget
|
||||||
|
qrencode
|
||||||
|
libheif
|
||||||
|
libde265
|
||||||
|
x265
|
||||||
|
libirecovery
|
||||||
|
libssh
|
||||||
|
ffmpeg
|
||||||
|
pugixml
|
||||||
|
avahi
|
||||||
|
avahi-compat
|
||||||
|
libimobiledevice
|
||||||
|
libirecovery
|
||||||
|
libplist
|
||||||
|
usbmuxd
|
||||||
|
libzip
|
||||||
|
openssl
|
||||||
|
];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DCMAKE_BUILD_TYPE=Release"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
nixosModules.default = { config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.programs.idescriptor;
|
||||||
|
idescriptorPkg = self.packages.${pkgs.system}.default;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ./nix/nixos-module.nix ];
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
programs.idescriptor.package = lib.mkDefault idescriptorPkg;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
homeManagerModules.default = { config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.programs.idescriptor;
|
||||||
|
idescriptorPkg = self.packages.${pkgs.system}.default;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ./nix/hm-module.nix ];
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
programs.idescriptor.package = lib.mkDefault idescriptorPkg;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.programs.idescriptor;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.idescriptor = {
|
||||||
|
enable = mkEnableOption "iDescriptor program";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
defaultText = literalExpression "pkgs.idescriptor";
|
||||||
|
description = "The iDescriptor package to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.programs.idescriptor;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.idescriptor = {
|
||||||
|
enable = mkEnableOption "iDescriptor program";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
defaultText = literalExpression "pkgs.idescriptor";
|
||||||
|
description = "The iDescriptor package to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
};
|
||||||
|
}
|
||||||
+122
@@ -0,0 +1,122 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
pkgs.stdenv.mkDerivation rec {
|
||||||
|
pname = "idescriptor";
|
||||||
|
version = "0.1.2";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "iDescriptor";
|
||||||
|
repo = "iDescriptor";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-pj/8PCZUTPu28MQd3zL8ceDsQy4+55348ZOCpiQaiEo=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
goModules = (pkgs.stdenv.mkDerivation {
|
||||||
|
name = "${pname}-${version}-go-modules";
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [ go ];
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
export GOPATH="$TMPDIR/go"
|
||||||
|
export GOCACHE="$TMPDIR/go-cache"
|
||||||
|
export HOME="$TMPDIR"
|
||||||
|
cd lib/ipatool-go
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
go mod download
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r --reflink=auto $GOPATH/pkg/mod $out/
|
||||||
|
'';
|
||||||
|
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHash = "sha256-CmthXlyxbWRqAY4gFLshx7VGAdbQlySm4y6mWFdxdUI=";
|
||||||
|
});
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cmake
|
||||||
|
pkg-config
|
||||||
|
go
|
||||||
|
qt6.wrapQtAppsHook
|
||||||
|
copyDesktopItems
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
qt6.qtbase
|
||||||
|
qt6.qtdeclarative
|
||||||
|
qt6.qtmultimedia
|
||||||
|
qt6.qtserialport
|
||||||
|
qt6.qtpositioning
|
||||||
|
qt6.qtlocation
|
||||||
|
lxqt.qtermwidget
|
||||||
|
qrencode
|
||||||
|
libheif
|
||||||
|
libde265
|
||||||
|
x265
|
||||||
|
libirecovery
|
||||||
|
libssh
|
||||||
|
ffmpeg
|
||||||
|
pugixml
|
||||||
|
avahi
|
||||||
|
avahi-compat
|
||||||
|
libimobiledevice
|
||||||
|
libirecovery
|
||||||
|
libplist
|
||||||
|
usbmuxd
|
||||||
|
libzip
|
||||||
|
openssl
|
||||||
|
];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DCMAKE_BUILD_TYPE=Release"
|
||||||
|
];
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
export HOME=$TMPDIR
|
||||||
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
|
export GOPATH=$TMPDIR/go
|
||||||
|
|
||||||
|
# Copy Go modules to writable location
|
||||||
|
mkdir -p $GOPATH/pkg
|
||||||
|
cp -r --reflink=auto ${goModules}/mod $GOPATH/pkg/
|
||||||
|
chmod -R +w $GOPATH/pkg/mod
|
||||||
|
|
||||||
|
export GOMODCACHE=$GOPATH/pkg/mod
|
||||||
|
export GOPROXY=off
|
||||||
|
'';
|
||||||
|
|
||||||
|
desktopItems = [
|
||||||
|
(pkgs.makeDesktopItem {
|
||||||
|
name = "iDescriptor";
|
||||||
|
exec = "iDescriptor";
|
||||||
|
icon = "idescriptor";
|
||||||
|
desktopName = "iDescriptor";
|
||||||
|
comment = "Cross-platform iDevice management tool";
|
||||||
|
categories = [ "System" "Utility" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
# Install icon
|
||||||
|
install -Dm644 $src/resources/icons/app-icon/icon.png \
|
||||||
|
$out/share/icons/hicolor/256x256/apps/idescriptor.png
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with pkgs.lib; {
|
||||||
|
description = "Free, open-source, cross-platform iDevice management tool";
|
||||||
|
homepage = "https://github.com/iDescriptor/iDescriptor";
|
||||||
|
license = licenses.agpl3Only;
|
||||||
|
maintainers = [ fn3x ];
|
||||||
|
platforms = platforms.unix;
|
||||||
|
mainProgram = "iDescriptor";
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user