From 0a17959a0d3b6533744d3b34308d4befb798c4bd Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Fri, 29 Sep 2023 22:09:13 -0400 Subject: [PATCH] ADD rofi devs to file based differentiation --- .../laptop.dhall | 0 .../workstation.dhall | 0 .files/rofi-dev-configs/laptop.dhall | 119 ++++++++++++++ .files/rofi-dev-configs/workstation.dhall | 89 ++++++++++ dot_config/conky.dhall.tmpl | 4 +- dot_config/rofi/devices.dhall.tmpl | 154 +----------------- dot_config/rofi/devices.dhall.tmpl.bak | 149 +++++++++++++++++ 7 files changed, 364 insertions(+), 151 deletions(-) rename .files/{conky-config => conky-configs}/laptop.dhall (100%) rename .files/{conky-config => conky-configs}/workstation.dhall (100%) create mode 100644 .files/rofi-dev-configs/laptop.dhall create mode 100644 .files/rofi-dev-configs/workstation.dhall create mode 100644 dot_config/rofi/devices.dhall.tmpl.bak diff --git a/.files/conky-config/laptop.dhall b/.files/conky-configs/laptop.dhall similarity index 100% rename from .files/conky-config/laptop.dhall rename to .files/conky-configs/laptop.dhall diff --git a/.files/conky-config/workstation.dhall b/.files/conky-configs/workstation.dhall similarity index 100% rename from .files/conky-config/workstation.dhall rename to .files/conky-configs/workstation.dhall diff --git a/.files/rofi-dev-configs/laptop.dhall b/.files/rofi-dev-configs/laptop.dhall new file mode 100644 index 0000000..e218c63 --- /dev/null +++ b/.files/rofi-dev-configs/laptop.dhall @@ -0,0 +1,119 @@ +let C = ../rofi-extras/dhall/rofi-dev.dhall + +let cryptdir = "/mnt/data/Documents/.crypt" + +let sshKey = "ssh" + +let gpgKey = "gpg" + +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 = + [ { 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:/wrk/njd2/stratomod-experiments" + } + , { tKey = "nist_workstation" + , tVal = + sshfsTree + "nist_workstation" + "NIST Workstation" + "nist-workstation:/mnt/data" + } + , { 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" + } + ] + +in { scTmpPath = Some "/tmp/media/${env:LOGNAME as Text}" + , scVerbose = Some False + , scDevices = defaultDevs # otherDevs + } diff --git a/.files/rofi-dev-configs/workstation.dhall b/.files/rofi-dev-configs/workstation.dhall new file mode 100644 index 0000000..2748bf4 --- /dev/null +++ b/.files/rofi-dev-configs/workstation.dhall @@ -0,0 +1,89 @@ +let C = ../rofi-extras/dhall/rofi-dev.dhall + +let cryptdir = "/mnt/data/.crypt" + +let sshKey = "ssh workstation" + +let gpgKey = "gpg workstation" + +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 = + [ { tKey = "ebm_snakemake" + , tVal = + sshfsTree + "ebm_snakemake" + "EBM" + "nisaba:/wrk/njd2/stratomod-experiments" + } + ] + +in { scTmpPath = Some "/tmp/media/${env:LOGNAME as Text}" + , scVerbose = Some False + , scDevices = defaultDevs # otherDevs + } diff --git a/dot_config/conky.dhall.tmpl b/dot_config/conky.dhall.tmpl index 2b92de2..844cc23 100644 --- a/dot_config/conky.dhall.tmpl +++ b/dot_config/conky.dhall.tmpl @@ -1,5 +1,5 @@ {{- if eq .features.conky_alias "laptop" -}} -{{- include ".files/conky-config/laptop.dhall" -}} +{{- include ".files/conky-configs/laptop.dhall" -}} {{- else if eq .features.conky_alias "workstation" -}} -{{- include ".bashrc_linux" -}} +{{- include ".files/conky-configs/workstation.dhall" -}} {{- end -}} diff --git a/dot_config/rofi/devices.dhall.tmpl b/dot_config/rofi/devices.dhall.tmpl index 6454326..903bf51 100644 --- a/dot_config/rofi/devices.dhall.tmpl +++ b/dot_config/rofi/devices.dhall.tmpl @@ -1,149 +1,5 @@ -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 = "nist_workstation" - , tVal = - sshfsTree - "nist_workstation" - "NIST Workstation" - "nist-workstation:/mnt/data" - } - , { 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 - } +{{- if eq .features.conky_alias "laptop" -}} +{{- include ".files/rofi-dev-configs/laptop.dhall" -}} +{{- else if eq .features.conky_alias "workstation" -}} +{{- include ".files/rofi-dev-configs/workstation.dhall" -}} +{{- end -}} diff --git a/dot_config/rofi/devices.dhall.tmpl.bak b/dot_config/rofi/devices.dhall.tmpl.bak new file mode 100644 index 0000000..6454326 --- /dev/null +++ b/dot_config/rofi/devices.dhall.tmpl.bak @@ -0,0 +1,149 @@ +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 = "nist_workstation" + , tVal = + sshfsTree + "nist_workstation" + "NIST Workstation" + "nist-workstation:/mnt/data" + } + , { 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 + }