clean(systems/optional/networking): reorder, refactor ios -> iphone
This commit is contained in:
parent
4cde826c0d
commit
b746f5ad37
|
@ -1,12 +0,0 @@
|
|||
#https://nixos.wiki/wiki/IOS
|
||||
{ pkgs }:
|
||||
{
|
||||
services.usbmuxd = {
|
||||
enable = true;
|
||||
#package = pkgs.usbmuxd2;
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
libimobiledevice
|
||||
#ifuse # optional, to mount using 'ifuse'
|
||||
];
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
# ...
|
||||
# imports = [ /path/to/iphone.nix ];
|
||||
# iphone.enable = true;
|
||||
# iphone.user = "yourusername";
|
||||
# ...
|
||||
# Then rebuild system. Attach iPhone via cable, open terminal and run command `iphone`
|
||||
# It will fail, but there will occure a dialog on your iPhone to "trust this computer"
|
||||
# Press OK there and run `iphone` again. If it succeeds it will open a freshly mounted folder
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.iphone;
|
||||
in {
|
||||
options.iphone = {
|
||||
enable = lib.mkOption { default = false; };
|
||||
directory = lib.mkOption { default = "/run/media/iPhone"; };
|
||||
user = lib.mkOption { };
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [
|
||||
pkgs.libimobiledevice
|
||||
pkgs.usbmuxd
|
||||
(pkgs.writeScriptBin "iphone" ''
|
||||
sudo systemctl restart iphone \
|
||||
&& ${pkgs.gnome2.libgnome}/bin/gnome-open ${cfg.directory}
|
||||
'')
|
||||
];
|
||||
services.usbmuxd = {
|
||||
enable = true;
|
||||
user = cfg.user;
|
||||
#https://nixos.wiki/wiki/IOS
|
||||
#package = pkgs.usbmuxd2
|
||||
};
|
||||
|
||||
systemd.services.iphone = {
|
||||
preStart = "mkdir -p ${cfg.directory}; chown ${cfg.user} ${cfg.directory}";
|
||||
script = ''
|
||||
${pkgs.libimobiledevice}/bin/idevicepair pair \
|
||||
&& exec ${pkgs.ifuse}/bin/ifuse ${cfg.directory}
|
||||
'';
|
||||
serviceConfig = {
|
||||
PermissionsStartOnly = true;
|
||||
User = cfg.user;
|
||||
Type = "forking";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue