Added tools to manage hard linking

This commit is contained in:
rasmus-kirk
2024-03-07 09:54:17 +01:00
parent cf3362a67b
commit 17866268ef
+23 -1
View File
@@ -6,6 +6,14 @@
}: }:
with lib; let with lib; let
cfg = config.nixarr; cfg = config.nixarr;
list-unlinked = pkgs.writeShellApplication {
name = "list-unlinked";
runtimeInputs = with pkgs; [util-linux];
text = ''
find "$1" -type f -links 1 -exec du -h {} + | sort -h
'';
};
in { in {
imports = [ imports = [
./jellyfin ./jellyfin
@@ -56,6 +64,15 @@ in {
''; '';
}; };
mediaUsers = mkOption {
type = with types; listOf str;
default = [];
example = [ "user" ];
description = ''
Extra users to add to the media group.
'';
};
mediaDir = mkOption { mediaDir = mkOption {
type = types.path; type = types.path;
default = "/data/media"; default = "/data/media";
@@ -147,7 +164,7 @@ in {
]; ];
users.groups = { users.groups = {
media = {}; media.members = cfg.mediaUsers;
streamer = {}; streamer = {};
torrenter = {}; torrenter = {};
}; };
@@ -180,6 +197,11 @@ in {
"d '${cfg.mediaDir}/torrents/readarr' 0755 torrenter media - -" "d '${cfg.mediaDir}/torrents/readarr' 0755 torrenter media - -"
]; ];
environment.systemPackages = with pkgs; [
jdupes
list-unlinked
];
# TODO: wtf to do about openports # TODO: wtf to do about openports
vpnnamespaces.wg = { vpnnamespaces.wg = {
enable = cfg.vpn.enable ; enable = cfg.vpn.enable ;