Skip to content

Latest commit

 

History

History
653 lines (547 loc) · 18.2 KB

home.org

File metadata and controls

653 lines (547 loc) · 18.2 KB

Guix Home Configuration

nouun

nouun is my main user account which is used on my all my desktop setups.

(define-module (jayu build home users nouun)
  #:use-module ((jayu build home themes rose-pine-sepia) #:prefix rps:))

Theming

Set the current theme, this will be used to configure the colorscheme of external programs.

Available Themes: rps - All natural pine, faux fur and a bit of soho vibes with a sepia twist”

(define current-theme rps:theme)

Packages

Packages which are installed a user level and are only accessible to the nouun user.

Define a small helper procedure to make mapping packages cleaner.

(use-modules (gnu packages))

(define (list->pkgs lst)
  (map specification->package+output lst))

General

General programs

(define general-packages
  (list->pkgs
   `("qutebrowser" ;; Qutebrowser seems to have an issue loading GitHub.
     "firefox" ;;ungoogled-chromium"
     "imagemagick"
     "inkscape"
     "kdevelop"
     "zathura"
     "zathura-pdf-mupdf")))

X11

Packages specific to X11 which can be easily enabled or disabled if switching to a different display server.

(use-modules (jayu packages scripts))

(define x11-packages
  (append
    (list
      treeshot)
    (list->pkgs
     `("rofi"
       "maim"
       "xclip"
       "xterm"))))

Wayland

Same as X11, just for Wayland. Kiwmi is currently in development and is rather unstable so we have to package locally.

(use-modules (jayu packages wm))

(define wayland-packages
    (append
     (list kiwmi)
     (list->pkgs
	 `("foot"
	   "wofi"
	   "swaybg"))))

Communications

Only really need Weechat here as Bitlbee is setup as a system service and that provides an interface for Discord. discordo has been packaged if I feel like changing back to that, but bitlbee-discord is working for now.

(define communication-packages
  (append
   ;(list discordo)
   (list->pkgs
    `("weechat"))))

Development

Most development packages are installed through a guix shell in their own directories but I still declare some globally that I use often.

(define development-packages
  (list->pkgs
    `(;; Sh
      "jq"
      ;; C/C++
      "cmake" "gcc" "clang" "ccls" "gdb"
      ;; Python
      "python"
      ;; Node
      "node")))

Fonts

Some generic fonts used for the terminal or Emacs, most of which I don’t even use.

(define font-packages
  (list->pkgs
   `("font-iosevka"
     "font-fira-mono"
     "font-fira-code"
     "font-google-noto"
     "font-gnu-freefont"
     "font-awesome"
     "font-google-material-design-icons")))

nouun

Append all the packages into one list.

(define nouun-packages
  (append
    general-packages
    x11-packages
    ; wayland-packages
    development-packages
    communication-packages
    font-packages))

Services

Alacritty

(use-modules (gnu services)
             (gnu home-services terminals))

(define alacritty-services
  (list
   (service home-alacritty-service-type
     (home-alacritty-configuration
      (config
       `((font . ((normal . ((font  . "Noto Sans Mono")))
                  (bold   . ((font  . "Noto Sans Mono")
                             (style . "bold")))
                  (italic . ((font  . "Noto Sans Mono")
                             (style . "light")))
                  (size   . 10.0)))
         (window . ((padding . ((x . 20)
                                (y . 20)))))
         (colors . ((primary . ((background . "#F5E9DA")
                                (foreground . "#575279")))
                    (normal . ((black   . "#232136")
                               (red     . "#AD4741")
                               (green   . "#569F84")
                               (yellow  . "#EA9D34")
                               (blue    . "#307E9D")
                               (magenta . "#907AA9")
                               (cyan    . "#56959F")
                               (white   . "#F2E9DE")))
                    (bright . ((black   . "#575279")
                               (red     . "#D7827E")
                               (green   . "#87BEA9")
                               (yellow  . "#F0BA71")
                               (blue    . "#73B8D4")
                               (magenta . "#B1A2C3")
                               (cyan    . "#87B6BE")
                               (white   . "#FAF4ED")))))))))))

Awesome

  (define awesome-services
    (list))
;      ()))

Direnv

 (use-modules (gnu)
              (gnu packages shellutils)
              (gnu home services)
              (gnu home-services base)
              (gnu home-services shellutils)
              (guix gexp))

(define-public direnv-services
  (list
    (simple-service 'direnv-service
                    home-files-service-type
                    `(("config/direnv/direnvrc"
                       ,(plain-file "direnverc" "\
use_guix() {
  local cache_dir=\"$(direnv_layout_dir)/.guix-profile\"
  if [[ -e \"$cache_dir/etc/profile\" ]]; then
    # shellcheck disable=SC1091
    source \"$cache_dir/etc/profile\"
  else
    mkdir -p \"$(direnv_layout_dir)\"
    eval \"$(guix environment --root=\"$cache_dir\" \"$@\" --search-paths)\"
  fi
}
"))))

    (service home-zsh-direnv-service-type)
    (service home-bash-direnv-service-type)

    (home-generic-service 'direnv-packages
      #:packages (list direnv))))

Git

(use-modules (gnu home)
               (gnu packages version-control)
               (gnu services)
               (gnu home services)
               (gnu home-services base)
               (gnu home-services version-control))

(define-public git-services
  (list
    (service home-git-service-type
      (home-git-configuration
        (config
          `((user
              ((name . "nouun") 
               (email . "[email protected]")))
            (github
              ((user . "nouun")))))
           ; ;; TODO: setup credential manager
           ;(credential
           ;  ((helper . "/usr/share/git/credential/libsecret/git-credential-libsecret")))))
        (ignore
          '(".envrc"))))

    (home-generic-service 'git-packages
      #:packages (list git))))

Picom

   (use-modules (gnu home)
                 (gnu packages compton)
                 (gnu services)
                 (gnu home services)
                 (gnu home-services base)
                 (jayu home services compton))

  (define-public picom-services
    (list
     (service home-picom-service-type
              (home-picom-configuration
               (config
                `((shadow . #t)
;                  (shadow-radius . 25)
;                  (shadow-offset-x . -20)
;                  (shadow-offset-y . -20)
;                  (shadow-opacity . 0.5)
                  (shadow-radius . 0)
                  (shadow-offset-x . 12)
                  (shadow-offset-y . 12)
                  (shadow-opacity . 0.5)
                  (shadow-exclude ("name = 'Notification'"
                                   "name = 'Icecat'"
                                   "name = 'Test'"))
                  (menu ((shadow . #f)))))))

     (home-generic-service 'picom-packages
      #:packages (list picom))))

Rofi

(use-modules (gnu home)
             (gnu services)
             (jayu home services xdisorg))

(define-public rofi-services
  (list
   (service home-rofi-service-type
            (home-rofi-configuration
             (config
              `((kb-mode-next     . "Shift+Right")
                (kb-mode-previous . "Shift+Left")
                (columns          . 1)))
             (theme
              `((* ((fg-lighter . "rgba( 87,  82, 121,  70%)")
                    (fg         . "rgba( 87,  82, 121, 100%)")
                    (fg-darker  . "rgba( 35,  33,  54, 100%)")
                    (bg         . "rgba(245, 233, 218, 100%)")
                    (bg-darker  . "rgba(237, 215, 189, 100%)")
                    (bar        . "rgba(144, 122, 169, 100%)")))
                (window ((background-color . @bg)
                         (border-color     . @bar)
                         (border           . (32 0 0 0))))
                (mainbox ((children     . (sidebar inputbar
                                           dummy listview))
                          (background-color . @bg)
                          (padding          . 10)
                          (spacing          . 0)))
                (sidebar ((background-color . transparent)
                          (spacing          . 0)))
                (button ((background-color . @bg)
                         (text-color       . @fg)
                         (padding          . 10)
                         (cursor           . pointer)
                         (expand           . #f)))
                (button.selected ((background-color . @bg-darker)
                                  (text-color       . @fg)))
                (inputbar ((background-color . @bg)
                           (text-color       . @fg)
                           (padding          . 20)
                           (spacing          . 10)))
                (prompt ((background-color . @fg)
                         (text-color       . @bg)
                         (enabled          . #f)))
                (case-indicator entry ((background-color . @bg)
                                       (text-color       . @fg)))
                (entry ((cursor . text)
                        (placeholder . "filter...")
                        (placeholder-color . @fg-lighter)))
                (dummy ((background-color . transparent)
                        (expand           . #f)
                        (padding          . (5 0 0 0))))
                (listview ((background-color . @bg)
                           (spacing          . 0)))
                (element ((background-color . transparent)
                          (padding          . 10)
                          (cursor           . pointer)))
                (element.selected.normal
                 element.selected.urgent
                 element.selected.active
                 element-text.selected ((background-color . @bg-darker)
                                        (text-color       . @fg)))
                (element.normal.normal
                 element.normal.urgent
                 element.normal.active
                 element.alternate.normal
                 element.alternate.urgent
                 element.alternate.active ((background-color . @bg)
                                           (text-color       . @fg)))
                (element-text ((background-color . transparent)
                               (text-color . @fg)))))))))

Shells

  (define sh-envvars
    '(("JAYU_HOME"   . "/home/nouun/jayu")
      ("JAYU_SYSTEM" . "verrb")))

  (define sh-colors
    "
esc() {
  echo \"\\033[$@m\"
}

RED=$(esc '1;31')
GREEN=$(esc '1;32')
CLEAR=$(esc '0')
")

  (define sh-cat-log
    "
  cat-log() {
    [ -d /tmp/jayu ] || mkdir /tmp/jayu
    cp $1 /tmp/jayu/log.gz
    gzip -d /tmp/jayu/log.gz
    cat /tmp/jayu/log
    rm /tmp/jayu/log
  }
")

  (define sh-jayu
    "
  __jayu_echo() {
    echo -e \" [${GREEN}Jayu${CLEAR}] $@\"
  }

  __jayu_err() {
    echo -e \" [${GREEN}Jayu${CLEAR}] $@\"
  }

  __jayu_config() {
    CMD=\"$1\"
    shift

    if [ -z \"$CMD\" ]; then
      __jayu_err \"No subcommand specified. Use 'jayu help config' for more information.\"
      return 1;
    fi

    case \"$CMD\" in
      pull|p)
        cd \"$JAYU_HOME\"
        make pull
        ;;
      home|h)
        cd \"$JAYU_HOME\"
        make home $@
        ;;
      system|s)
        cd \"$JAYU_HOME\"
        make system $@
        ;;
      *)
        __jayu_err \"Unknown command $1\"
        return 1
        ;;
    esac
  }

  __jayu_locate() {
    guix show $1 | \\
      grep location | \\
      xargs -n1 printf '(%s)' | \\
      sed -e 's/.*:)//g' -e 's/\\.scm.*)$/)/g' -e 's|/| |g' | \\
      xargs echo
  }

  __jayu_manifest() {
     MANIFEST_NAME=$(echo \"$1\" | tr 'A-Z' 'a-z')
     MANIFEST=\"$JAYU_HOME/jayu/manifests/$MANIFEST_NAME.scm\"
     shift

     if [ -z \"$MANIFEST_NAME\" ]; then
         ls \"$JAYU_HOME/jayu/manifests/\" | \
           sed -e \"s/.scm//g\" | \
           fzf --preview=\"cat $JAYU_HOME/jayu/manifests/{}.scm\" |
           __jayu_manifest
       return @?
     fi

     case \"$MANIFEST_NAME\" in
       .)
         if [ ! -f \"./guix-manifest.scm\"]; then
           __jayu_echo \"Creating Guix environment with guix-manifest.scm\"
           guix environment --manifest=guix-manifest.scm $@
         fi
         return 0
         ;;
       list|l)
         __jayu_echo 'Valid Manifests:'
         ls \"$JAYU_HOME/jayu/manifests/\" | \
           sed -e \"s/.scm//g\"

       return 0
       ;;
     esac

     if [ ! -f \"$MANIFEST\" ]; then
       __jayu_err \"$MANIFEST_NAME manifest does not exist\"
       return 0
     else
       __jayu_echo \"Creating Guix environment with $MANIFEST\"
       guix environment --manifest=\"$MANIFEST\" $@
     fi
  }

  __jayu_help() {
    if [ -z \"$1\" ]; then
      echo '  Jayu'
      echo '    Helper tool for Guix'
      echo ''
      echo '  Commands'
      echo '    config   - Config Guix'
      echo '    help     - Shows this message'
      echo '    locate   - Locate a guix package'
      echo '    manifest - Load a Jayu manifest'
    else
      case \"$1\" in
        help|h)
          echo '  Jayu - help'
          echo '    Disable information about a command'
          echo ''
          echo '  Usage'
          echo '    jayu help [COMMAND]'
          echo ''
          echo '  Example'
          echo '    jayu help'
          echo '    jayu help manifest'
          ;;
        config|c)
          echo '  Jayu - config'
          echo '    Helper for Jayu config'
          echo ''
          echo '  Usage'
          echo '    jayu config COMMAND'
          echo ''
          echo '  Commands'
          echo '    home   - Reconfigure Guix Home'
          echo '    system - Reconfigure Guix System'
          echo ''
          echo '  Example'
          echo '    jayu config home'
          echo '    jayu config system'
          ;;
        locate|l)
          echo '  Jayu - locate'
          echo '    Locate a Guix package by name'
          echo ''
          echo '  Usage'
          echo '    jayu locate PACKAGE'
          echo ''
          echo '  Example'
          echo '    jayu locate gcc'
          echo '    jayu locate weechat'
          ;;
        manifest|m)
          echo '  Jayu - manifest'
          echo '    Create a Guix environment from a Jayu manifest file'
          echo ''
          echo '  Usage'
          echo '    jayu help COMMAND|MANIFEST'
          echo ''
          echo '  Commands'
          echo '    list - Lists Jayu manifests'
          echo ''
          echo '  Example'
          echo '    jayu manifest list'
          echo '    jayu manifest qmk'
          ;;
        *)
          __jayu_err \"Unknown command $1\"
          return 1
          ;;
      esac
    fi
  }

  jayu() {
    CMD=\"$1\"
    shift

    case \"$CMD\" in
      config|c)   __jayu_config   $@ ;; 
      locate|l)   __jayu_locate   $@ ;; 
      manifest|m) __jayu_manifest $@ ;;
      *)          __jayu_help     $@ ;;
    esac
  }
")

Bash

 (use-modules (gnu home-services shells))

 (define bash-services
	(list
	  (service home-bash-service-type
	    (home-bash-configuration
	      (environment-variables sh-envvars)
             (bashrc
               (list sh-colors
                     sh-cat-log
                     sh-jayu))))))

Zsh

(define-public zsh-services
  (list
    (service home-zsh-service-type
      (home-zsh-configuration
        (environment-variables sh-envvars)
        (zshrc
          (list sh-colors
                sh-cat-log
                sh-jayu))))

    (service home-zsh-plugin-manager-service-type)))

nouun

(define nouun-services
  (append alacritty-services
          bash-services
          direnv-services
          git-services
          picom-services
          rofi-services
          zsh-services))

Environment

(home-environment
 (packages nouun-packages)
 (services nouun-services))