dotfiles/dot_config/rofi/devices.dhall.tmpl

142 lines
3.5 KiB
Cheetah

let C = ../rofi-extras/dhall/rofi-dev.dhall
let cryptdir =
{{ if eq .features.rofi_alias "laptop" -}}
"/mnt/data/Documents/.crypt"
{{- else if eq .features.rofi_alias "workstation" -}}
"/mnt/data/.crypt"
{{- else -}}
"~/.crypt"
{{- end }}
let sshKey =
{{ if eq .features.rofi_alias "workstation" -}}
"ssh workstation"
{{- else -}}
"ssh"
{{- end }}
let gpgKey =
{{ if eq .features.rofi_alias "workstation" -}}
"gpg workstation"
{{- else -}}
"gpg"
{{- end }}
let bwConfig =
\(k : Text) ->
C.PasswordConfig.PwdBW ({ bwKey = k, bwTries = 2 } : C.BitwardenConfig)
let sshData =
\(r : Text) ->
C.DataConfig.SSHFSConfig
( { sshfsRemote = r, sshfsPassword = None C.PasswordConfig }
: C.SSHFSData
)
let sshfsTree =
\(m : Text) ->
\(l : Text) ->
\(r : Text) ->
{ tcParent =
{ deviceMount = { mpPath = m, mpLabel = Some l } : C.MountConfig
, deviceData = sshData r
}
: C.DeviceConfig
, tcChildren = [ "ssh" ]
}
: C.TreeConfig
let crypt = \(b : Text) -> "${cryptdir}/${b}"
let vcName = \(n : Text) -> "Veracrypt (${n})"
let vcryptTree =
\(m : Text) ->
\(l : Optional Text) ->
\(v : Text) ->
\(k : Text) ->
{ tcParent =
{ deviceMount = { mpPath = m, mpLabel = l } : C.MountConfig
, deviceData =
C.DataConfig.VeracryptConfig
( { vcVolume = crypt v
, vcPassword = Some (bwConfig (vcName k))
}
: C.VeracryptData
)
}
: C.DeviceConfig
, tcChildren = [] : List Text
}
: C.TreeConfig
let defaultDevs =
[ { tKey = "ssh"
, tVal =
vcryptTree
"${env:HOME as Text}/.ssh"
(Some "ssh")
"ssh-config"
sshKey
}
, { tKey = "gnupg"
, tVal =
vcryptTree
"${env:GNUPGHOME as Text}"
(None Text)
"gpg-config"
gpgKey
}
]
let otherDevs =
{{- if eq .features.rofi_alias "laptop" -}}
[ { tKey = "accounts"
, tVal = vcryptTree "accounts" (None Text) "accounts" "accounts"
}
, { tKey = "ansible-pki"
, tVal = vcryptTree "ansible-pki" (None Text) "ansible" "Ansible PKI"
}
, { tKey = "call_logs"
, tVal = vcryptTree "call-logs" (None Text) "call_logs" "ACR"
}
, { tKey = "ebm_snakemake"
, tVal =
sshfsTree
"ebm_snakemake"
"EBM"
"nisaba:/aigenomics/EBM_dev/snakemake"
}
, { tKey = "music"
, tVal =
sshfsTree
"/mnt/data/Music"
"Music"
"portnoy4prez:/mnt/data/home/Music"
}
, { tKey = "videos"
, tVal =
sshfsTree
"/mnt/data/Videos"
"Videos"
"portnoy4prez:/mnt/data/home/Videos"
}
]
{{- else if eq .features.rofi_alias "workstation" -}}
[ { tKey = "ebm_snakemake"
, tVal =
sshfsTree
"ebm_snakemake"
"EBM"
"nisaba:/aigenomics/EBM_dev/snakemake"
}
]
{{- else -}}
[] : C.TreeMap
{{- end }}
in { scTmpPath = Some "/tmp/media/${env:LOGNAME as Text}"
, scVerbose = Some False
, scDevices = defaultDevs # otherDevs
}