From fa8a6f493f1b5060fa306e39a5502df56f4f02c1 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 16 May 2021 09:49:15 -0400 Subject: move stuff into profiles --- darwin.nix | 43 ----- groq.nix | 73 -------- install.sh | 13 +- lib/common.nix | 1 + lib/emacs-packages.nix | 2 +- lib/linux.nix | 464 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/packages.nix | 1 + linux.nix | 450 ----------------------------------------------- profiles/darwin.nix | 43 +++++ profiles/groq.nix | 73 ++++++++ profiles/workshop.nix | 16 ++ server.nix | 9 - 12 files changed, 608 insertions(+), 580 deletions(-) delete mode 100644 darwin.nix delete mode 100644 groq.nix create mode 100644 lib/linux.nix delete mode 100644 linux.nix create mode 100644 profiles/darwin.nix create mode 100644 profiles/groq.nix create mode 100644 profiles/workshop.nix delete mode 100644 server.nix diff --git a/darwin.nix b/darwin.nix deleted file mode 100644 index c221e9e..0000000 --- a/darwin.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ pkgs, ... }: - -let - homedir = builtins.getEnv "HOME"; - haskellOverlay = self: super: { - haskellPackages = super.haskellPackages.override (old: { - overrides = self: super: { - hledger = self.callPackage ./pkgs/hledger-1.19.1.nix {}; - hledger-lib = self.callPackage ./pkgs/hledger-lib-1.19.1.nix {}; - }; - }); - }; -in -{ - nixpkgs.overlays = [ - haskellOverlay - ]; - - imports = [ - ./lib/common.nix - ./lib/email.nix - ]; - home = { - sessionVariables.PATH = "/usr/local/opt/mysql@5.7/bin:${homedir}/bin:${homedir}/.cabal/bin:${homedir}/.local/bin:$PATH"; - packages = with pkgs; [ - muchsync - (haskellPackages.ghcWithPackages (ps: with ps; [hledger])) - coreutils - ]; - }; - - programs = { - - # Doesnt' work bc clang can't compile it?? - #qutebrowser = { - # enable = true; - # settings = { - # "colors.webpage.darkmode.enabled" = true; - # }; - #}; - - }; -} diff --git a/groq.nix b/groq.nix deleted file mode 100644 index d1214b3..0000000 --- a/groq.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ pkgs, ... }: - -let - gitCommitTemplate = ./git-commit-template; -in -{ - imports = [ - ./common.nix - ]; - - accounts = { - email = { - maildirBasePath = "mail"; - accounts = { - "groq" = { - primary = true; - flavor = "gmail.com"; - realName = "Ben Sima"; - address = "bsima@groq.com"; - userName = "bsima@groq.com"; - mbsync = { - enable = true; - create = "both"; - expunge = "none"; - }; - notmuch.enable = true; - msmtp.enable = true; - passwordCommand = "secret-tool lookup email bsima@groq.io"; - }; - }; - }; - }; - - services.emacs.enable = true; - - programs = { - emacs = { - enable = true; - }; - - git = { - enable = true; - userName = "Ben Sima"; - userEmail = "bsima@groq.com"; - ignores = [ "*~" "*.swp" ]; - package = pkgs.gitAndTools.gitFull; - extraConfig = '' - [push] - default = simple - - [commit] - template = ${gitCommitTemplate} - ''; - }; - - mbsync.enable = true; - msmtp.enable = true; - - notmuch = { - enable = true; - new.tags = ["new"]; - hooks = {}; - extraConfig.search.exclude_tags = "deleted;spam;"; - }; - - alot = { - enable = true; - extraConfig = '' - theme = solarized_light - ''; - }; - }; -} diff --git a/install.sh b/install.sh index a16d8a6..4b19d53 100755 --- a/install.sh +++ b/install.sh @@ -2,16 +2,21 @@ # set -euxo pipefail # -[[ -z "$1" ]] && echo "usage: install.sh " && exit 1 +[[ -z "$1" ]] \ + && echo "usage: install.sh " \ + && echo "where is something from the 'profiles' directory" \ + && exit 1 # mkdir -p ~/.config/nixpkgs NIXDIR="$HOME/.config/nixpkgs" HOMEFILE="$NIXDIR/home.nix" NIXFILE="$(pwd)/$1" # -# -[[ -e "$HOMEFILE" ]] || ln -s "$NIXFILE" "$HOMEFILE" -[[ -e "$NIXDIR/config.nix" ]] || ln -s "$(pwd)/lib/config.nix" "$NIXDIR/config.nix" +# start from scratch +rm "$HOMEFILE" +ln -s "$NIXFILE" "$HOMEFILE" +rm "$NIXDIR/config.nix" +ln -s "$(pwd)/lib/config.nix" "$NIXDIR/config.nix" # # the notmuch config location is by default ~/.notmuch-config, but home-manager # puts it at ~/.config/notmuch/notmuchrc (which makes sense) and then sets diff --git a/lib/common.nix b/lib/common.nix index 197d8de..cbe0d25 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -111,6 +111,7 @@ in chainreplyto = false; composeencoding = "UTF-8"; annotate = "yes"; + cccmd = "git-contacts"; }; log = { date = "local"; diff --git a/lib/emacs-packages.nix b/lib/emacs-packages.nix index 09061b3..b8dc912 100644 --- a/lib/emacs-packages.nix +++ b/lib/emacs-packages.nix @@ -30,7 +30,7 @@ emojify eww-lnum flycheck flycheck-haskell -geiser +# geiser # broken? general melpaStablePackages.git-timemachine haskell-mode diff --git a/lib/linux.nix b/lib/linux.nix new file mode 100644 index 0000000..6823c8e --- /dev/null +++ b/lib/linux.nix @@ -0,0 +1,464 @@ +{ pkgs, lib, ... }: + +let + homedir = builtins.getEnv "HOME"; + hostname = lib.strings.removeSuffix "\n" (builtins.readFile /etc/hostname); + gpgid = "66A6AD150399D970DCA4C4E6C8218B7D0BFDECCD"; + cmdtree = pkgs.stdenv.mkDerivation { + name = "cmdtree"; + src = fetchGit { + url = "https://git.sr.ht/~jb55/cmdtree"; + ref = "master"; + rev = "5606078e8fa02462f0208d9f9cad98c7673812e6"; + }; + buildPhase = '' + cp ${./cfg.def.h} ./cfg.def.h + make + ''; + installPhase = '' + mkdir -p $out/bin + cp ./cmdtree $out/bin + ''; + buildInputs = [ pkgs.xorg.libX11 pkgs.xorg.libXft ]; + }; + + base16-scheme = "spacemacs"; + base16 = pkgs.stdenv.mkDerivation { + name = "base16-builder"; + src = builtins.fetchTarball { + url = "https://github.com/auduchinok/base16-builder/archive/51e3ad4d447fc3f1f539d0bfe33c851728fb6b5f.tar.gz"; + sha256 = "1qir689h38c6jr7fbbqbc3029544zgv41lrrqdcq26kcwxcwjrz1"; + }; + nativeBuildInputs = [pkgs.ruby]; + buildPhase = "${pkgs.ruby}/bin/ruby base16 -s schemes/${base16-scheme}.yml"; + installPhase = '' + mkdir -p $out + cp -r output/* $out + ''; + }; + theme = lib.removeSuffix "\n" (builtins.readFile "${homedir}/.local/share/xtheme"); + xresources = "${base16}/xresources/base16-${base16-scheme}.${theme}.xresources"; + + colors = { # derived from spacemacs + "dark" = { + highlight = "#5d4d7a"; + background = "#292b2e"; + foreground = "#b2b2b2"; + }; + "light" = { + highlight = "#67b11d"; + background = "#f6f1e1"; + foreground = "#655370"; + }; + }; + xmonadPackages = self: [ + self.xmonad-contrib + #self.taffybar # fails to build + self.xmonad-extras + self.monad-logger + ]; +in +{ + imports = [ + ./common.nix + ./email.nix + ]; + home = { + keyboard.options = [ "caps:ctrl_modifier" ]; + sessionVariables = { + LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; + }; + file = { + mutt = { + text = (builtins.readFile ./muttrc) + + (builtins.readFile ./mutt/solarized.muttrc); + target = ".muttrc"; + }; + mailcap = { + source = ./mailcap; + target = ".mailcap"; + }; + xbindkeys = { + source = ./xbindkeysrc; + target = ".xbindkeysrc"; + }; + }; + + packages = with pkgs; [ + acpi + apvlv + beets + bind + blueman + cmdtree + dict + dmenu + dolphin + exercism + feh + flameshot + gopher + glibcLocales # rofi locale fix -- https://github.com/rycee/home-manager/issues/354#issuecomment-415914278 + gnumake + gnupg + gopher + hledger-ui + hledger-web + keybase-gui + ledger + libnotify + lshw + minitube + mononoki + mplayer + msmtp + muchsync + mumble + neomutt + obs-studio + pandoc + pasystray + pavucontrol + pdftk + pinentry + sqlite + tdesktop + terminus + texlive.combined.scheme-full + torbrowser + usbutils + utillinux + vlc + xbindkeys + xclip + xdotool + xlayoutdisplay + xorg.xmodmap + xournal + xterm + yank + youtube-dl + zathura + + # languages i regularly use + (haskellPackages.ghcWithPackages (a: with a; [hledger rainbow])) # for hledger scripting + guile + python3 + ]; + }; + fonts.fontconfig.enable = true; + + xresources = { + properties = { + "XTerm*font" = "-*-FiraMono-medium-r-normal--18-*-*-*-*-*-iso10646-1"; + "XTerm*faceName" = "FireMono"; + "XTerm*faceSize" = "10"; + "XTerm*termName" = "xterm-256color"; + "XTerm*metaSendsEscape" = true; + "XTerm*utf8" = true; + #"Xautolock.time:" = 1; + #"Xautolock.locker:" = "xlock"; + #"Xautolock.corners:" = "+0-0"; + #"Xautolock.cornerdelay:" = 3; + #"Xautolock.notify:" = 30; + #"Xautolock.notifier:" = "notify-send -u critical -t 10000 -- 'Locking screen in 30 seconds'"; + }; + extraConfig = builtins.readFile(xresources); + }; + + services = { + lorri.enable = false; + emacs.enable = true; + + kbfs.enable = true; + keybase.enable = true; + + mbsync = { + enable = if hostname == "lithium" then true else false; + frequency = "*:0/5"; + postExec = "${pkgs.notmuch}/bin/notmuch new"; + }; + + mpd = { + enable = true; + musicDirectory = "/mnt/campbell/ben/music"; + network = { + listenAddress = "0.0.0.0"; + port = 6600; + }; + extraConfig = '' + audio_output { + type "httpd" + name "HTTP Stream" + encoder "vorbis" + port "8097" + quality "7.0" + format "44100:16:2" + } + ''; + }; + + polybar = { + # https://github.com/0x746866/dots/blob/master/polybar/config + enable = true; + config = { + "bar/top" = { + background = colors."${theme}".background; + font-0 = "FiraSans:size=16"; + font-1 = "Font Awesome 5:pixelsize=11;1"; + font-2 = "MaterialIcons:size=10:antialias=false;2"; + foreground = colors."${theme}".foreground; + height = "30"; + module-margin = 1; + modules-center = "date"; + modules-left = "volume-bar"; + modules-right = [ "battery" "cpu" "mem" "temp" ]; + monitor = "\${env:MONITOR:HDMI-1}"; + monitor-fallback = "\${env:MONITOR:eDP-1}"; + radius = 0; + separator = "|"; + tray-background = colors."${theme}".background; + tray-detached = false; + tray-maxsize = 16; + tray-offset-x = 0; + tray-offset-y = 0; + tray-padding = 0; + tray-position = "right"; + tray-scale = 1; + width = "100%"; + }; + "module/date" = { + type = "internal/date"; + internal = 5; + date = "%Y.%m.%d"; + time = "%H.%M"; + label = "%date%..%time%"; + }; + "module/battery" = { + type = "internal/battery"; + battery = "BAT0"; + adapter = "AC"; + full-at = 99; + }; + "module/volume-bar" = { + type = "internal/volume"; + bar-volume-font = 2; + bar-volume-width = 9; + format-volume = ""; + label-volume = " .) "; + label-muted = " .) mute"; + label-volume-foreground = colors.${theme}.foreground; + format-muted-foreground = colors.${theme}.foreground; + bar-volume-foreground-0 = colors.${theme}.foreground; + bar-volume-foreground-1 = colors.${theme}.foreground; + bar-volume-foreground-2 = colors.${theme}.foreground; + bar-volume-foreground-3 = colors.${theme}.foreground; + bar-volume-foreground-4 = colors.${theme}.foreground; + bar-volume-foreground-5 = colors.${theme}.foreground; + bar-volume-foreground-6 = colors.${theme}.foreground; + bar-volume-gradient = true; + bar-volume-indicator = "•"; + bar-volume-fill = "•"; + bar-volume-empty = "·"; + bar-volume-empty-foreground = colors.${theme}.foreground; + }; + "module/ethernet" = { + type = "internal/network"; + interface = "enp1s0"; + label-connected = "eth up: %upspeed:9% down: %downspeed%"; + label-disconnected = "no eth"; + }; + "module/wifi" = { + type = "internal/network"; + interface = "wlan1"; + label-connected = "wifi up: %upspeed% down: %downspeed%"; + label-disconnected = "no wifi"; + }; + "module/cpu" = { + type = "internal/cpu"; + interval = 3; + format-padding = 1; + format = "