Browse Source

a lot of stuff

canon
Hazel Levine 2 months ago
parent
commit
8d78d2891a
Signed by: hazel GPG Key ID: 1884029A28789A62
19 changed files with 111 additions and 177 deletions
  1. +2
    -2
      bin/backlight
  2. +2
    -2
      bin/volume
  3. +26
    -62
      config/doom/config.org
  4. +5
    -4
      config/doom/init.el
  5. +1
    -1
      config/waybar/style.css
  6. +1
    -1
      config/zathura/zathurarc
  7. +11
    -6
      machines/hyacinth/default.nix
  8. +1
    -1
      modules/desktop/apps/alacritty.nix
  9. +1
    -1
      modules/desktop/core/mako.nix
  10. +1
    -1
      modules/desktop/core/wofi.nix
  11. +1
    -0
      modules/desktop/settings/fonts.nix
  12. +2
    -2
      modules/desktop/settings/gtk.nix
  13. +3
    -3
      modules/desktop/sway.nix
  14. +1
    -0
      modules/lang/lisp.nix
  15. +2
    -1
      modules/system/desktop.nix
  16. +0
    -53
      modules/system/fonts.nix
  17. +2
    -2
      modules/tools/emacs.nix
  18. +3
    -3
      nix/sources.json
  19. +46
    -32
      nix/sources.nix

+ 2
- 2
bin/backlight View File

@ -1,13 +1,13 @@
#!/bin/sh
send_notification() {
backlight=$(brightnessctl -m | cut -d, -f4 | sed 's/%//' | awk '{print int($1 / 3.4)}')
backlight=$(brightnessctl -m | cut -d, -f4 | sed 's/%//' | awk '{print int($1 / 3.25)}')
# Make the bar with the special character ─ (it's not dash -)
# https://en.wikipedia.org/wiki/Box-drawing_character
bar=$(seq -s "─" "$backlight" | sed 's/[0-9]//g')
# Send the notification
makoctl dismiss
notify-send -t 1000 "mon: $bar"
notify-send -t 1000 "mon: $bar"
}
case $1 in


+ 2
- 2
bin/volume View File

@ -1,13 +1,13 @@
#!/bin/sh
send_notification() {
volume=$(ponymix --sink get-volume | awk '{print int($1 / 3.4)}')
volume=$(ponymix --sink get-volume | awk '{print int($1 / 3.25)}')
# Make the bar with the special character ─ (it's not dash -)
# https://en.wikipedia.org/wiki/Box-drawing_character
bar=$(seq -s "─" "$volume" | sed 's/[0-9]//g')
# Send the notification
makoctl dismiss
notify-send -t 1000 "vol: $bar"
notify-send -t 1000 "vol: $bar"
}
case $1 in


+ 26
- 62
config/doom/config.org View File

@ -43,11 +43,16 @@ and options I want:
properties)))))
#+END_SRC
I'm playing with the [[https://www.ibm.com/plex/][IBM Plex]] font right now. I like it a lot, but my font of
choice has been known to change.
As my university education dragged on and I began to do things with formal logic,
I needed a font with good support for unicode characters. Right now that's [[https://github.com/cormullion/juliamono][Julia
Mono]]. I use the [[https://www.ibm.com/plex/][IBM Plex]] fonts for variable pitch. I used to use IBM Plex Mono,
but it doesn't format some things properly...
I've also disabled bold fonts because I cannot get them to render properly in
Emacs.
#+BEGIN_SRC emacs-lisp
(defvar hzl/monospace-font
(hzl/xft-font-string "IBM Plex Mono" 10
(hzl/xft-font-string "Julia Mono" 10
'((hintstyle . 3)
(hinting . true)
(lcdfilter . 3)
@ -61,6 +66,7 @@ choice has been known to change.
(setq doom-font hzl/monospace-font)
(setq doom-variable-pitch-font hzl/variable-pitch-font)
(setq doom-themes-enable-bold nil)
#+END_SRC
** Colorscheme
I've been using [[https://github.com/morhetz/gruvbox][Gruvbox]] Light recently. After years and years of dark themes, I
@ -108,6 +114,23 @@ so.
mpdel-tablist-mode)
'emacs))
#+END_SRC
** Arbitrary Unicode input
While I like Agda's input mode for Unicode input, it's not practical everywhere,
and I occasionally need to put Unicode into non-Agda files (namely Racket when
writing DSLs using Unicode characters). DrRacket's approach is pretty good, so I
stole a package to emulate it.
#+BEGIN_SRC emacs-lisp :tangle ~/.config/doom/packages.el
(package! dr-racket-like-unicode
:recipe (:host github :repo "david-christiansen/dr-racket-like-unicode"))
#+END_SRC
Bind it to C-\ everywhere, because I haven't found any situation where this
breaks anything:
#+BEGIN_SRC emacs-lisp
(use-package! dr-racket-like-unicode
:config (map! :i "C-\\" #'dr-racket-like-unicode-char))
#+END_SRC
* Productivity, papers, etc
For the boring stuff that's not /quite/ programming.
** TeXcount
@ -151,52 +174,6 @@ We tell it to run the auto-setup function and use PDFs:
(auctex-latexmk-setup)
(setq auctex-latexmk-inherit-TeX-pdf-mode t))
#+END_SRC
** =mu4e=
/NOTE: This is not working right now and I am using Thunderbird./
I have two email accounts: my ProtonMail account (linked to my deadname) and my
personal mailserver.
Tell =mu4e= to use =offlineimap=. =mbsync= doesn't behave with [[https://github.com/emersion/hydroxide/][Hydroxide]].
#+BEGIN_SRC emacs-lisp
(setq +mu4e-backend 'offlineimap)
#+END_SRC
Tell it where I save my mail:
#+BEGIN_SRC emacs-lisp
(setq mu4e-maildir "/home/hazel/var/mail/"
mu4e-attachment-dir "/home/hazel/var/mail/attachments")
#+END_SRC
Set a few QoL fixes, because mu4e's default viewer kinda sucks:
#+BEGIN_SRC emacs-lisp
(setq mu4e-view-use-gnus t)
(when (fboundp 'imagemagick-register-types)
(imagemagick-register-types))
#+END_SRC
We tell it how I save my email, too:
#+BEGIN_SRC emacs-lisp
(set-email-account! "Knights of the Lambda Calculus"
'((mu4e-sent-folder . "/lambdamail/Sent")
(mu4e-drafts-folder . "/lambdamail/Drafts")
(mu4e-trash-folder . "/lambdamail/Junk")
(mu4e-refile-folder . "/lambdamail/All Mail")
(smtpmail-smtp-user . "hazel@knightsofthelambdacalcul.us")
(user-mail-address . "hazel@knightsofthelambdacalcul.us"))
t)
(set-email-account! "ProtonMail"
'((mu4e-sent-folder . "/protonmail/Sent")
(mu4e-drafts-folder . "/protonmail/Drafts")
(mu4e-trash-folder . "/protonmail/Trash")
(mu4e-refile-folder . "/protonmail/All Mail")
(smtpmail-smtp-user . "me@qtp2t.club")
(smtpmail-smtp-service . 1025)
(smtpmail-stream-type . nil)
(user-mail-address . "me@qtp2t.club"))
t)
#+END_SRC
** Org-mode
Set the bullets to pretty stuff:
#+BEGIN_SRC emacs-lisp
@ -297,16 +274,3 @@ place, it's /still/ miles ahead of RLS.
(after! rustic
(setq rustic-lsp-server 'rust-analyzer))
#+END_SRC
** Shen
A really cool experimental, portable, and typed Lisp. I like it a lot, but I
don't know much about it on the merit that it's locked behind a paywall of a
book that I can't afford nor pirate.
#+BEGIN_SRC emacs-lisp :tangle ~/.config/doom/packages.el
(package! shen-mode)
#+END_SRC
Also load the mode for Qi, Shen's predecessor that I actually have the book
for:
#+BEGIN_SRC emacs-lisp
(load-file (concat (getenv "XDG_CONFIG_HOME") "/doom/lisp/qi-mode.el"))
#+END_SRC

+ 5
- 4
config/doom/init.el View File

@ -1,4 +1,4 @@
;;; init.el -*- lexical-binding: t; -*-
;; init.el -*- lexical-binding: t; -*-
;; ,;' `:. NOTE: THERE ARE TWO BFGS IN HELL
;; :: _ ;;
;; `:_|_;'
@ -13,6 +13,7 @@
doom-dashboard
doom-quit
hl-todo
ligatures
modeline
nav-flash
ophints
@ -79,11 +80,11 @@
+present
+pretty)
python
racket
(racket +xp)
(rust +lsp)
(scala +lsp)
scheme
sh
;scheme
;sh
:email
(mu4e +gmail)


+ 1
- 1
config/waybar/style.css View File

@ -1,6 +1,6 @@
* {
font-size: 12px;
font-family: "IBM Plex Mono", "FontAwesome";
font-family: "IBM Plex Sans", "FontAwesome";
}
window#waybar {


+ 1
- 1
config/zathura/zathurarc View File

@ -2,7 +2,7 @@ set window-title-home-tilde true
set statusbar-basename true
set selection-clipboard clipboard
set font "IBM Plex Mono 10"
set font "Julia Mono 10"
set completion-bg "#fbf1c7"
set completion-fg "#3c3836"


+ 11
- 6
machines/hyacinth/default.nix View File

@ -67,17 +67,17 @@
hazel.desktop.sway = {
outputs = {
eDP-1 = {
bg = "~/usr/img/papes/desktop/roses.jpg tile";
bg = "~/usr/img/papes/desktop/clouds.jpg fill";
res = "1920x1080";
pos = "0 0";
pos = "1920 0";
};
HDMI-A-1 = {
bg = "~/usr/img/papes/desktop/pipes.png fill";
bg = "~/usr/img/papes/desktop/roses.jpg tile";
res = "1920x1080";
pos = "1920 0";
pos = "0 0";
};
};
lockBg = "~/usr/img/papes/desktop/lol_furries.png";
lockBg = "~/usr/img/papes/desktop/clouds.jpg";
};
# various tools
@ -125,10 +125,15 @@
programs.adb.enable = true;
users.users.hazel.extraGroups = [ "adbusers" ];
# gamer
hazel.home.home.packages = with pkgs; [
steam-run
appimage-run
xboxdrv
minecraft
mcrcon
unstable.pcsx2
kdenlive
citrix_workspace
];
}

+ 1
- 1
modules/desktop/apps/alacritty.nix View File

@ -27,7 +27,7 @@ with lib; {
font = let
mkFontSetting = x: {
family = "IBM Plex Mono";
family = "Julia Mono";
style = x;
};
in {


+ 1
- 1
modules/desktop/core/mako.nix View File

@ -20,7 +20,7 @@ with lib; {
programs.mako = {
enable = true;
font = "IBM Plex Mono 10";
font = "IBM Plex Sans 10";
backgroundColor = "#cc241d";
textColor = "#fbf1c7";


+ 1
- 1
modules/desktop/core/wofi.nix View File

@ -23,7 +23,7 @@ with lib; {
window {
background-color: #d5c4a1;
margin: 10px;
font-family: 'IBM Plex Mono';
font-family: 'IBM Plex Sans';
padding: 10px;
border: 2px solid #cc241d;
}


+ 1
- 0
modules/desktop/settings/fonts.nix View File

@ -13,6 +13,7 @@ let
source-sans-pro
font-awesome_4
plex
unstable.julia-mono
]);
extrafonts = (with pkgs; [


+ 2
- 2
modules/desktop/settings/gtk.nix View File

@ -27,8 +27,8 @@ with lib; {
name = "Papirus";
};
theme = {
package = pkgs.ant-theme;
name = "Ant";
package = pkgs.arc-theme;
name = "Arc";
};
};


+ 3
- 3
modules/desktop/sway.nix View File

@ -86,7 +86,7 @@ with lib; {
systemMode = "system: (x) exit (l) lock (h) suspend (r) reboot (s) shutdown (i) reload";
launchMode = "launch: (b) firefox (e) emacs (f) files (m) ncmpcpp";
locker = ''swaylock -f --clock --font "IBM Plex Mono" -i "${cfg.lockBg}" \
locker = ''swaylock -f --clock --font "Julia Mono" -i "${cfg.lockBg}" \
--effect-blur 5x5 --timestr "%I:%M" \
--text-color "${colors.fg}" --ring-color "${colors.mut}" \
--inside-color "${colors.bg}" --line-color "${colors.fg}" \
@ -224,7 +224,7 @@ with lib; {
smartGaps = true;
};
fonts = [ "IBM Plex Mono 10" ];
fonts = [ "Julia Mono 10" ];
colors = rec {
focused = {
background = colors.hl;
@ -253,7 +253,7 @@ with lib; {
bars = if i3RsCfg.enable then [{
position = "top";
fonts = [ "FontAwesome" "IBM Plex Mono 10" ];
fonts = [ "FontAwesome" "Julia Mono 10" ];
workspaceNumbers = false;
trayOutput = "none";
statusCommand = "i3status-rs ~/.config/i3status-rust/status.toml";


+ 1
- 0
modules/lang/lisp.nix View File

@ -29,6 +29,7 @@ with lib; {
# the good shit
racket
z3 # for rosette
];
programs.zsh.shellAliases = { "sbcl" = "rlwrap sbcl"; };


+ 2
- 1
modules/system/desktop.nix View File

@ -13,6 +13,7 @@ let
source-sans-pro
font-awesome_4
plex
unstable.julia-mono
]);
extrafonts = (with pkgs; [
@ -60,7 +61,7 @@ with lib; {
fontconfig = {
enable = true;
defaultFonts = {
monospace = [ "IBM Plex Mono 10" ];
monospace = [ "Julia Mono 10" ];
sansSerif = [ "IBM Plex Sans 10" ];
serif = [ "IBM Plex Serif 10" ];
};


+ 0
- 53
modules/system/fonts.nix View File

@ -1,53 +0,0 @@
{ config, pkgs, lib, ... }:
let
plex = pkgs.runCommand "ibm-plex" {
src = pkgs.fetchzip {
url = "https://github.com/IBM/plex/releases/download/v5.0.0/TrueType.zip";
sha256 = "sha256-KKw9pk5YmWpaMKnYKhjwHynHxx8c0F8U/fgoU9qimHY=";
};
} "mkdir -p $out/share/fonts/truetype; cp $src/**/*.ttf $out/share/fonts/truetype";
basefonts = (with pkgs; [
corefonts
source-code-pro
source-sans-pro
font-awesome_4
plex
]);
extrafonts = (with pkgs; [
dejavu_fonts
noto-fonts
roboto
roboto-slab
source-code-pro
emacs-all-the-icons-fonts
]);
cfg = config.hazel.fonts;
in
with lib; {
options = {
hazel.fonts = {
enable = mkOption {
default = false;
type = with types; bool;
};
};
};
config = mkIf cfg.enable {
fonts = {
fonts = basefonts ++ extrafonts ++ [];
fontconfig = {
enable = true;
defaultFonts = {
monospace = [ "IBM Plex Mono 10" ];
sansSerif = [ "IBM Plex Sans 10" ];
serif = [ "IBM Plex Serif 10" ];
};
};
};
};
}

+ 2
- 2
modules/tools/emacs.nix View File

@ -42,9 +42,9 @@ with lib; {
programs.emacs = {
enable = true;
extraPackages = epkgs: [
epkgs.emacs-libvterm # doom vterm module
epkgs.emacs # doom vterm module
];
package = pkgs.unstable.emacs;
package = emacsPgtkGcc;
};
# run the emacs daemon


+ 3
- 3
nix/sources.json View File

@ -53,10 +53,10 @@
"homepage": "",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "12f98ef0d91e4b0ac25d3b5a003794cc8a54db6d",
"sha256": "03fl4jimgm4glm9szn5kr96qhxx7yl1hlxkbhmcj4c3lr852f1g6",
"rev": "88d77bca47d0e8e6fc4fe5585df1e368852e640a",
"sha256": "14kg9c7ivfa999byrsp8mv01c8f9qn6vkbq0sba2cyd4v0zg6h97",
"type": "tarball",
"url": "https://github.com/nix-community/emacs-overlay/archive/12f98ef0d91e4b0ac25d3b5a003794cc8a54db6d.tar.gz",
"url": "https://github.com/nix-community/emacs-overlay/archive/88d77bca47d0e8e6fc4fe5585df1e368852e640a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"go-rice": {


+ 46
- 32
nix/sources.nix View File

@ -12,36 +12,29 @@ let
else
pkgs.fetchurl { inherit (spec) url sha256; };
fetch_tarball = pkgs: spec:
if spec.builtin or true then
builtins_fetchTarball { inherit (spec) url sha256; }
else
pkgs.fetchzip { inherit (spec) url sha256; };
fetch_tarball = pkgs: name: spec:
let
ok = str: ! builtins.isNull (builtins.match "[a-zA-Z0-9+-._?=]" str);
# sanitize the name, though nix will still fail if name starts with period
name' = stringAsChars (x: if ! ok x then "-" else x) "${name}-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = spec:
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
fetch_builtin-tarball = spec:
builtins.trace
''
WARNING:
The niv type "builtin-tarball" will soon be deprecated. You should
instead use `builtin = true`.
$ niv modify <package> -a type=tarball -a builtin=true
''
builtins_fetchTarball { inherit (spec) url sha256; };
fetch_local = spec: spec.path;
fetch_builtin-url = spec:
builtins.trace
''
WARNING:
The niv type "builtin-url" will soon be deprecated. You should
instead use `builtin = true`.
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
$ niv modify <package> -a type=file -a builtin=true
''
(builtins_fetchurl { inherit (spec) url sha256; });
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
@ -72,13 +65,23 @@ let
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs spec
else if spec.type == "tarball" then fetch_tarball pkgs spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
else if spec.type == "builtin-url" then fetch_builtin-url spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
let
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else ersatz;
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
@ -87,13 +90,23 @@ let
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatStrings = builtins.concatStringsSep "";
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, sha256 }@attrs:
builtins_fetchTarball = { url, name, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball { inherit url; }
fetchTarball { inherit name url; }
else
fetchTarball attrs;
@ -115,13 +128,13 @@ let
then abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = fetch config.pkgs name spec; }
spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? ./sources.json
, sources ? builtins.fromJSON (builtins.readFile sourcesFile)
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
, pkgs ? mkPkgs sources
}: rec {
# The sources, i.e. the attribute set of spec name to spec
@ -130,5 +143,6 @@ let
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }

Loading…
Cancel
Save