attempt to seadrive-fuse automount

This commit is contained in:
Dmitriy Kholkin 2022-04-22 02:16:24 +03:00
parent be55a17137
commit 8255b3e36b
6 changed files with 153 additions and 0 deletions

75
modules/seadrive.nix Normal file
View File

@ -0,0 +1,75 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.seadrive;
settingsFormat = pkgs.formats.ini { };
seadriveConf = if (cfg.settingsFile != null) then
cfg.settingsFile
else
settingsFormat.generate "seadrive.conf" cfg.settings;
in {
###### Interface
options.services.seadrive = {
enable = mkEnableOption "Seadrive";
settings = mkOption {
type = types.submodule {
freeformType = settingsFormat.type;
};
default = {
account = {
server = "";
username = "";
token = "";
is_pro = false;
};
general = {
client_name = "nixos";
};
cache = {
size_limit = "10GB";
clean_cache_interval = 10;
};
};
description = ''
Configuration for Seadrive.
'';
};
settingsFile = mkOption {
default = null;
type = types.nullOr types.path;
};
package = mkOption {
type = types.package;
description = "Which package to use for the seadrive.";
default = pkgs.seadrive-fuse;
defaultText = literalExpression "pkgs.seadrive-fuse";
};
mountPoint = mkOption {
type = types.str;
default = "/media/seadrive";
};
};
###### Implementation
config.home-manager.users.alukard = mkIf cfg.enable {
systemd.user.services.seadrive-daemon = {
Service = {
Type = "simple";
# Restart = "always";
ExecStart = ''
${cfg.package}/bin/seadrive -c ${seadriveConf} -f -d %h/.seadrive/data ${cfg.mountPoint}
'';
};
Unit = rec {
After = [ "network.target" ];
Wants = After;
};
Install.WantedBy = [ "multi-user.target" ];
};
};
}

View File

@ -96,5 +96,6 @@ with config.deviceSpecific; {
# winetricks # winetricks
] ++ lib.optionals isLaptop [ ] ++ lib.optionals isLaptop [
acpi acpi
seadrive-fuse
]; ];
} }

View File

@ -31,6 +31,7 @@ with lib; {
mpris-ctl = pkgs.callPackage ./packages/mpris-ctl.nix { }; mpris-ctl = pkgs.callPackage ./packages/mpris-ctl.nix { };
multimc = pkgs.qt5.callPackage ./packages/multimc.nix { multimc-repo = inputs.multimc-cracked; }; multimc = pkgs.qt5.callPackage ./packages/multimc.nix { multimc-repo = inputs.multimc-cracked; };
reshade-shaders = pkgs.callPackage ./packages/reshade-shaders.nix { }; reshade-shaders = pkgs.callPackage ./packages/reshade-shaders.nix { };
seadrive-fuse = pkgs.callPackage ./packages/seadrive-fuse.nix { };
tidal-dl = pkgs.callPackage ./packages/tidal-dl.nix { }; tidal-dl = pkgs.callPackage ./packages/tidal-dl.nix { };
vscode = master.vscode; vscode = master.vscode;
vscode-fhs = master.vscode-fhs; vscode-fhs = master.vscode-fhs;

View File

@ -0,0 +1,64 @@
{ fetchFromGitHub
, pkgconfig
, stdenv
, autoreconfHook
, lib
# Package dependencies
, libsearpc
, libselinux
, libuuid
, pcre
, libtool
, libevent
, sqlite
, openssl
, fuse
, vala
, intltool
, jansson
, curl
, python
}:
stdenv.mkDerivation rec {
pname = "seadrive-fuse";
version = "2.0.16";
src = fetchFromGitHub {
owner = "haiwen";
repo = pname;
rev = "v${version}";
sha256 = "072sx4wvj3gbslv3hn4sifr28fy812b8aja9d7phl1w4yix9l55z";
};
patches = [];
nativeBuildInputs = [
autoreconfHook
pkgconfig
];
buildInputs = [
libsearpc
libselinux
libuuid # Satisfies the 'mount' package requirement. Contains 'mount.pc'
pcre
libtool
libevent
sqlite
openssl.dev
fuse
vala
intltool
jansson
curl
python
];
meta = with lib; {
homepage = https://github.com/haiwen/seadrive-fuse;
description = "SeaDrive daemon with FUSE interface";
license = licenses.gpl3;
platforms = platforms.all;
maintainers = with maintainers; [];
};
}

View File

@ -28,6 +28,8 @@ with config.deviceSpecific; {
interval = "weekly"; interval = "weekly";
}; };
services.gvfs.enable = !isServer;
# FIX! # FIX!
#services.thermald.enable = isLaptop; #services.thermald.enable = isLaptop;
@ -74,6 +76,15 @@ with config.deviceSpecific; {
temperature.night = 3000; temperature.night = 3000;
}; };
secrets.seadrive = {
owner = "alukard";
};
services.seadrive = {
enable = true;
settingsFile = config.secrets.seadrive.decrypted;
mountPoint = "/media/seadrive";
};
services.upower.enable = true; services.upower.enable = true;
systemd.services.systemd-udev-settle.enable = false; systemd.services.systemd-udev-settle.enable = false;

View File

@ -16,6 +16,7 @@
network network
nix nix
overlay overlay
seadrive
secrets secrets
secrets-envsubst secrets-envsubst
security security