(add-to-load-path "/etc/guix-config")
(add-to-load-path "/home/cobra/.config/guix")

(use-modules (gnu home)
             (gnu home services)
             (gnu home services mcron)
             (gnu home services desktop)
             (gnu home services shells)
             (gnu packages)
             (gnu packages gl)
             (gnu services)
             (gnu services dbus)
             (gnu services mcron)
             (guix gexp)

             ;; Deranged Guix Home Usage(TM)
             (cobra homedir)
             (cobra config)
             (cobra bin)
             (cobra packages))

(define webfetch-job
  #~(job "*/1 * * * *"
         "hyfetch > /tmp/fetch; rsync --rsh=\"ssh -i /home/cobra/.ssh/id_fetch\" /tmp/fetch vern.cc:~/public_html/${HOSTNAME,,}"))

(home-environment
  (packages
    (map specification->package+output
         (list ;; Audio
               "alsa-utils"
               "cmus"
               "mumble"
               "pamixer"
               "pipewire"
               "playerctl"
               "pulseaudio"
               "pulsemixer"
               "wireplumber"

               ;; Bluetooth
               "blueman"

               ;; Browsers
               "icecat"
               "icedove"
               "lynx"
               "ungoogled-chromium-wayland"
               
               ;; CAD
               "cura"
               "freecad"
               "gpx"
               "kicad"
               "kicad-doc"
               "kicad-footprints"
               "kicad-packages3d"
               "kicad-symbols"
               "kicad-templates"
               
               ;; Chat
               "irssi"
               "pinentry"
               "profanity"

               ;; Desktop
               "brightnessctl"
               "foot"
               "grim"
               "libnotify"
               "light"
               "light"
               "mako"
               "slurp"
               "sway"
               "swayhide"
               "swayidle"
               "swaylock"
               "waybar"
               "wf-recorder"
               "wl-clipboard"
               "wlr-randr"
               "wob"
               "wofi"
               "xorg-server-xwayland"

               ;; Development
               "at-spi2-core"
               "avr-toolchain"
               "gcc-toolchain"
               "git"
               "git:send-email"
               "go"
               "make"
               "microscheme"
               "perl"
               "python"

               ;; DICT
               "dico"

               ;; Encryption
               "gnupg"
               "password-store"

               ;; Games
               "adanaxisgpl"
               "minetest"
               "red-eclipse"
               "supertuxkart"
               "teeworlds"
               "xonotic"

               ;; Multimedia
               "ffmpeg"
               "gimp"
               "handbrake"
               "imagemagick"
               "kodi"
               "mpv"
               "mpv-mpris"
               "reptyr"
               "ripit"

               ;; Network
               "bind:utils"
               "i2pd"
               "net-tools"
               "netcat"
               "proxychains-ng"
               "socat"
               "tmate"
               "whois"
               "wireguard-tools"

               ;; Utilities
               "bc"
               "dialog"
               "emacs"
               "htop"
               "hyfetch"
               "libqalculate"
               "lm-sensors"
               "macchanger"
               "monero-gui"
               "newsboat"
               "rsync"
               "scdoc"
               "screen"
               "unzip"
               "wget"
               "yt-dlp")))
  (services
    (list
      (service home-dbus-service-type)
      (service home-mcron-service-type
              (home-mcron-configuration
                (jobs (list webfetch-job))))
      (simple-service 'home-env
                      home-environment-variables-service-type
                      `(("LIBGL_DRIVERS_PATH" . ,(if (equal? (gethostname) "Neon")
                                                   (file-append mesa-i915 "/lib/dri")
                                                   (file-append mesa      "/lib/dri")))
                        ("PRIV" . "sudo")
                        ("WM" . "sway")
                        ("WIFI" . "wlp2s0")
                        ("COPY_COMMAND" . "wl-copy")
                        ("PASTE_COMMAND" . "wl-paste")
                        ("UPDATE" . "guix pull --branch=master && reconf && hreconf")))
      (simple-service 'dotfiles
                      home-files-service-type
                      (list `(".bashrc" ,%home:bashrc)
                            `(".prompt" ,%home:prompt)
                            `(".devspec" ,%home:devspec)
                            `(".bash_profile" ,%home:bash-profile)

                            `(".local/bin/backtick" ,%bin:backtick)
                            `(".local/bin/beep" ,%bin:beep)
                            `(".local/bin/beep-wrapper" ,%bin:beep-wrapper)
                            `(".local/bin/fss" ,%bin:fss)
                            `(".local/bin/lock" ,%bin:lock)
                            `(".local/bin/logout-wofi" ,%bin:logout-wofi)
                            `(".local/bin/screenshot" ,%bin:screenshot)
                            `(".local/bin/start-pipewire" ,%bin:start-pipewire)
                            `(".local/bin/__suspend" ,%bin:suspend)
                            `(".local/bin/suspend" ,%bin:suspend-wrap)
                            `(".local/bin/torbrowser" ,%bin:torbrowser)

                            `(".config/neofetch/config.conf" ,%config:neofetch)
                            `(".config/hyfetch.json" ,%config:hyfetch)
                            `(".config/colorscheme" ,%config:colorscheme)
                            `(".config/foot/foot.ini" ,%config:foot)
                            `(".config/mako/config" ,%config:mako)
                            `(".config/mpv/mpv.conf" ,%config:mpv)
                            `(".config/swaylock/config" ,%config:swaylock)
                            `(".config/sway/config" ,%config:sway)
                            
                            `(".config/waybar/config" ,%waybar:config)
                            `(".config/waybar/style.css" ,%waybar:style))))))
