add seadrive
This commit is contained in:
parent
9e530e27e5
commit
6c1b8a727d
@ -2,48 +2,91 @@
|
||||
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;
|
||||
format = pkgs.formats.ini { };
|
||||
|
||||
settings = {
|
||||
account = {
|
||||
server = cfg.settings.server;
|
||||
username = cfg.settings.username;
|
||||
token = "#token#";
|
||||
is_pro = cfg.settings.isPro;
|
||||
};
|
||||
general = {
|
||||
client_name = cfg.settings.clientName;
|
||||
};
|
||||
cache = {
|
||||
size_limit = cfg.settings.sizeLimit;
|
||||
clean_cache_interval = cfg.settings.cleanCacheInterval;
|
||||
};
|
||||
};
|
||||
|
||||
configFile = format.generate "seadrive.conf" settings;
|
||||
|
||||
startScript = pkgs.writeShellScript "start-seadrive" ''
|
||||
token=$(head -n1 ${cfg.settings.tokenFile})
|
||||
cp -f ${configFile} ${cfg.stateDir}/seadrive.conf
|
||||
sed -e "s,#token#,$token,g" -i "${cfg.stateDir}/seadrive.conf"
|
||||
chmod 440 "${cfg.stateDir}/seadrive.conf"
|
||||
|
||||
mkdir -p ${cfg.mountPoint} || true
|
||||
|
||||
${cfg.package}/bin/seadrive -c ${cfg.stateDir}/seadrive.conf -f -d ${cfg.stateDir}/data -l ${cfg.stateDir}/logs ${cfg.mountPoint}
|
||||
'';
|
||||
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.
|
||||
default = { };
|
||||
description = lib.mdDoc ''
|
||||
'';
|
||||
};
|
||||
|
||||
settingsFile = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.path;
|
||||
type = types.submodule {
|
||||
freeformType = format.type;
|
||||
|
||||
options = {
|
||||
server = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
username = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
tokenFile = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
isPro = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
clientName = mkOption {
|
||||
type = types.str;
|
||||
default = config.networking.hostName;
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
sizeLimit = mkOption {
|
||||
type = types.str;
|
||||
default = "10GB";
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
cleanCacheInterval = mkOption {
|
||||
type = types.int;
|
||||
default = 10;
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "Which package to use for the seadrive.";
|
||||
description = lib.mdDoc "Which package to use for the seadrive.";
|
||||
default = pkgs.seadrive-fuse;
|
||||
defaultText = literalExpression "pkgs.seadrive-fuse";
|
||||
};
|
||||
@ -51,25 +94,22 @@ in {
|
||||
mountPoint = mkOption {
|
||||
type = types.str;
|
||||
default = "/media/seadrive";
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.str;
|
||||
default = "~/.seadrive";
|
||||
description = lib.mdDoc "";
|
||||
};
|
||||
};
|
||||
|
||||
###### Implementation
|
||||
|
||||
config.home-manager.users.${config.mainuser} = 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-online.target" ];
|
||||
Wants = After;
|
||||
};
|
||||
Install.WantedBy = [ "multi-user.target" ];
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.seadrive = rec {
|
||||
serviceConfig.ExecStart = startScript;
|
||||
after = [ "network-online.target" ];
|
||||
wants = after;
|
||||
wantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
}
|
@ -32,13 +32,12 @@ with lib; {
|
||||
reshade-shaders = pkgs.callPackage ./packages/reshade-shaders.nix { };
|
||||
rosepine-gtk-theme = pkgs.callPackage ./packages/rosepine-gtk-theme.nix { };
|
||||
rosepine-icon-theme = pkgs.callPackage ./packages/rosepine-icon-theme.nix { };
|
||||
# seadrive-fuse = pkgs.callPackage ./packages/seadrive-fuse.nix { };
|
||||
tidal-dl = pkgs.callPackage ./packages/tidal-dl.nix { };
|
||||
tokyonight-gtk-theme = pkgs.callPackage ./packages/tokyonight-gtk-theme.nix { };
|
||||
tokyonight-icon-theme = pkgs.callPackage ./packages/tokyonight-icon-theme.nix { };
|
||||
xonar-fp = pkgs.callPackage ./packages/xonar-fp.nix { };
|
||||
youtube-to-mpv = pkgs.callPackage ./packages/youtube-to-mpv.nix { term = config.defaultApplications.term.cmd; };
|
||||
vivaldi = master.vivaldi;
|
||||
seadrive-fuse = pkgs.callPackage ./packages/seadrive-fuse.nix { };
|
||||
steam = master.steam.override {
|
||||
withJava = true;
|
||||
extraPkgs = pkgs: with pkgs; [ mono libkrb5 keyutils ];
|
||||
|
@ -1,13 +1,10 @@
|
||||
{ fetchFromGitHub
|
||||
, pkg-config
|
||||
, pkgconfig
|
||||
, stdenv
|
||||
, autoreconfHook
|
||||
, lib
|
||||
# Package dependencies
|
||||
, libsearpc
|
||||
, libselinux
|
||||
, libuuid
|
||||
, pcre
|
||||
, libtool
|
||||
, libevent
|
||||
, sqlite
|
||||
@ -17,31 +14,27 @@
|
||||
, intltool
|
||||
, jansson
|
||||
, curl
|
||||
, python
|
||||
, python3
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "seadrive-fuse";
|
||||
version = "2.0.16";
|
||||
version = "2.0.22";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "haiwen";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "072sx4wvj3gbslv3hn4sifr28fy812b8aja9d7phl1w4yix9l55z";
|
||||
hash = "sha256-zzUg3ukV3bf0X+LYDmDgB6TXfDx388q4RvVCAnKzauE=";
|
||||
};
|
||||
|
||||
patches = [];
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoreconfHook
|
||||
pkg-config
|
||||
pkgconfig
|
||||
];
|
||||
buildInputs = [
|
||||
libsearpc
|
||||
libselinux
|
||||
libuuid # Satisfies the 'mount' package requirement. Contains 'mount.pc'
|
||||
pcre
|
||||
libuuid
|
||||
libtool
|
||||
libevent
|
||||
sqlite
|
||||
@ -51,14 +44,14 @@ stdenv.mkDerivation rec {
|
||||
intltool
|
||||
jansson
|
||||
curl
|
||||
python
|
||||
python3
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/haiwen/seadrive-fuse";
|
||||
homepage = https://github.com/haiwen/seadrive-fuse;
|
||||
description = "SeaDrive daemon with FUSE interface";
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [];
|
||||
};
|
||||
}
|
||||
}
|
19
profiles/workspace/seadrive.nix
Normal file
19
profiles/workspace/seadrive.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ config, pkgs, lib, ... }: {
|
||||
# secrets.seadrive.owner = config.mainuser;
|
||||
secrets.seadrive-token.owner = config.mainuser;
|
||||
services.seadrive = {
|
||||
enable = true;
|
||||
mountPoint = "/media/seadrive";
|
||||
stateDir = "~/.config/seadrive";
|
||||
settings = {
|
||||
server = "https://file.ataraxiadev.com";
|
||||
username = "ataraxiadev@ataraxiadev.com";
|
||||
tokenFile = config.secrets.seadrive-token.decrypted;
|
||||
isPro = false;
|
||||
clientName = config.networking.hostName;
|
||||
sizeLimit = "4GB";
|
||||
cleanCacheInterval = 10;
|
||||
};
|
||||
};
|
||||
persist.state.homeDirectories = [ ".config/seadrive" ];
|
||||
}
|
@ -3,7 +3,8 @@
|
||||
./base.nix
|
||||
inputs.base16.hmModule
|
||||
|
||||
# seadrive
|
||||
inputs.self.customModules.seadrive
|
||||
inputs.self.nixosProfiles.seadrive
|
||||
xray
|
||||
|
||||
applications-setup
|
||||
@ -18,7 +19,6 @@
|
||||
corectrl
|
||||
firefox
|
||||
gamemode
|
||||
google-drive
|
||||
himalaya
|
||||
kitty
|
||||
mangohud
|
||||
|
Loading…
x
Reference in New Issue
Block a user