refactor: abstacted records

This commit is contained in:
Nick 2025-06-26 21:20:09 -05:00
parent 64572cb106
commit 06a684fa32
42 changed files with 211 additions and 202 deletions

View file

@ -1,6 +1,6 @@
{ devicesFunctions }:
{ moduleFunctions }:
let
inherit (devicesFunctions)
inherit (moduleFunctions.devicesFunctions)
sshfsOptions
fileModeAndDirMode
ceresStorageDriveName
@ -10,6 +10,9 @@ let
userIdForUser0
ceresIP
;
inherit (moduleFunctions.usersFunctions) user0;
inherit (moduleFunctions.devicesFunctions) externalIP;
ceresName = "ceres";
in
{
@ -36,7 +39,7 @@ in
};
remote0 = {
mount = "/mnt/media/remote";
device = "nick@24.76.173.0:/mnt/media/${ceresStorageDriveName}";
device = "${user0}@${externalIP}:/mnt/media/${ceresStorageDriveName}";
options = sshfsOptions;
};
}

View file

@ -1,6 +1,6 @@
{ devicesFunctions }:
{ moduleFunctions }:
let
inherit (devicesFunctions)
inherit (moduleFunctions.devicesFunctions)
ownerWriteOthersReadMask
deimosIP
;

View file

@ -1,6 +1,6 @@
{ devicesFunctions }:
{ moduleFunctions }:
let
inherit (devicesFunctions)
inherit (moduleFunctions.devicesFunctions)
ownerWriteOthersReadMask
readWritePermissions
marsIP

View file

@ -1,6 +1,6 @@
{ devicesFunctions }:
{ moduleFunctions }:
let
inherit (devicesFunctions)
inherit (moduleFunctions.devicesFunctions)
ownerWriteOthersReadMask
phobosIP
;

View file

@ -1,6 +1,6 @@
{ devicesFunctions }:
{ moduleFunctions }:
let
inherit (devicesFunctions)
inherit (moduleFunctions.devicesFunctions)
phoneIP
dummy
;

View file

@ -1,8 +1,7 @@
{ devicesFunctions }:
{ moduleFunctions }:
let
inherit (devicesFunctions)
dummy
;
inherit (moduleFunctions.devicesFunctions) dummy;
in
{
name = dummy;

View file

@ -1,9 +1,7 @@
{ devicesFunctions }:
{ moduleFunctions }:
let
inherit (devicesFunctions)
brotherIP
dummy
;
inherit (moduleFunctions.devicesFunctions) brotherIP dummy;
in
{
name = dummy;

View file

@ -1,15 +1,12 @@
{ devicesFunctions }:
{ moduleFunctions }:
let
inherit (devicesFunctions)
inherit (moduleFunctions.devicesFunctions)
sambaPermissions
userIdForUser0
userIdForUser1
synologyIP
;
user0 = "nick";
user1 = "streaming";
user0Name = "Nick";
inherit (moduleFunctions.usersFunctions) user0 user0Label user1;
synologyName = "synology";
in
{
@ -24,13 +21,13 @@ in
# Nick Home Folder
folder0 = {
mount = "/mnt/media/${synologyName}/${user0}";
device = "//${synologyIP}/homes/${user0Name}";
device = "//${synologyIP}/homes/${user0Label}";
options = sambaPermissions ++ userIdForUser0;
};
# Streaming Folder
folder1 = {
mount = "/mnt/media/${synologyName}/${user1}";
device = "//${synologyIP}/homes/${user0Name}";
device = "//${synologyIP}/homes/${user0Label}";
options = sambaPermissions ++ userIdForUser1;
};
}

View file

@ -1,64 +1,16 @@
{ moduleFunctions }:
let
configPath = ./config;
printerPath = configPath + /printers;
devicesFunctions = {
ownerWriteOthersReadMask = [
"fmask=0022"
"dmask=0022"
];
ownerExclusiveReadWriteMask = [
"fmask=0077"
"dmask=0077"
];
readWritePermissions = [
"rw"
];
sambaPermissions = [
"rw"
"gid=100"
"vers=3.0"
"x-systemd.automount"
"x-systemd.requires=network-online.target"
];
sshfsOptions = [
"allow_other"
"_netdev"
"x-systemd.automount"
"reconnect"
"user"
"ServerAliveInterval=15"
"IdentityFile=/var/run/secrets/ssh/private"
];
fileModeAndDirMode = [
"file_mode=0644"
"dir_mode=0755"
];
userIdForUser0 = [
"uid=1000"
];
userIdForUser1 = [
"uid=1002"
];
dummy = [
];
ceresStorageDriveName = "NAS1";
ceresIP = "192.168.50.140";
deimosIP = "192.168.50.142";
marsIP = "192.168.50.218";
phoneIP = "192.168.50.243";
phobosIP = "192.168.50.180";
synologyIP = "192.168.50.210";
brotherIP = "192.168.50.195";
};
deviceswithFunctions = builtins.listToAttrs (
map
(name: {
name = builtins.substring 0 (builtins.stringLength name - 4) name;
value = import (configPath + "/${name}") {
inherit
devicesFunctions
moduleFunctions
;
};
})
@ -75,7 +27,7 @@ let
name = builtins.substring 0 (builtins.stringLength name - 4) name;
value = import (printerPath + "/${name}") {
inherit
devicesFunctions
moduleFunctions
;
};
})