delete emac 3

This commit is contained in:
ponymushama 2024-07-23 18:01:37 +08:00
parent a74ddd2ee8
commit 136be145fc
17 changed files with 2 additions and 4828 deletions

1
README.md Normal file
View file

@ -0,0 +1 @@
# ponymushama nixos-config

View file

@ -1,110 +0,0 @@
#+title: NixOS Config
#+author: Emmet
[[https://gitlab.com/librephoenix/nixos-config][Main Repo Link (GitLab)]]
[[https://github.com/librephoenix/nixos-config][Mirror Repo Link (GitHub)]]
[[https://codeberg.org/librephoenix/nixos-config][Mirror Repo Link (Codeberg)]]
** What is this repository?
These are my dotfiles (configuration files) for my NixOS setup(s).
Here is my main setup:
[[desktop.png]]
** My Themes
[[https://github.com/danth/stylix#readme][Stylix]] (and [[https://github.com/SenchoPens/base16.nix#readme][base16.nix]], of course) is amazing, allowing you to theme your entire system with base16-themes.
Using this I have [[./themes][55+ themes]] (I add more sometimes) I can switch between on-the-fly. Visit the [[./themes][themes directory]] for more info and screenshots!
** Install
I wrote some reinstall notes for myself [[./install.org][here (install.org)]].
TLDR: You should™ be able to install my dotfiles to a fresh NixOS system with the following experimental script:
#+begin_src sh :noeval
nix-shell -p git --command "nix run --experimental-features 'nix-command flakes' github:ponymushama/nixos-config"
#+end_src
Disclaimer: Ultimately, I can't gaurantee this will work for anyone other than myself, so /use this at your own discretion/. Also my dotfiles are /highly/ opinionated, which you will discover immediately if you try them out.
Potential Errors: I've only tested it working on UEFI with the default EFI mount point of =/boot=. I've added experimental legacy (BIOS) boot support, but it does rely on a quick and dirty script to find the grub device. If you are testing it using some weird boot configuration for whatever reason, try modifying =bootMountPath= (UEFI) or =grubDevice= (legacy BIOS) in =flake.nix= before install, or else it will complain about not being able to install the bootloader.
Note: If you're installing this to a VM, Hyprland won't work unless 3D acceleration is enabled.
Security Disclaimer: If you install or copy my =homelab= or =worklab= profiles, /CHANGE THE PUBLIC SSH KEYS UNLESS YOU WANT ME TO BE ABLE TO SSH INTO YOUR SERVER. YOU CAN CHANGE OR REMOVE THE SSH KEY IN THE RELEVANT CONFIGURATION.NIX/:
- [[./profiles/homelab/configuration.nix][configuration.nix]] for homelab profile
- [[./profiles/worklab/configuration.nix][configuration.nix]] for worklab profile
** Modules
Separate Nix files can be imported as modules using an import block:
#+BEGIN_SRC nix
imports = [ ./import1.nix
./import2.nix
...
];
#+END_SRC
This conveniently allows configurations to be (*cough cough) /modular/ (ba dum, tssss).
I have my modules separated into two groups:
- System-level - stored in the [[./system][system directory]]
- System-level modules are imported into configuration.nix, which is what is sourced into [[./flake.nix][my flake (flake.nix)]]
- User-level - stored in the [[./user][user directory]] (managed by home-manager)
- User-level modules are imported into home.nix, which is also sourced into [[./flake.nix][my flake (flake.nix)]]
More detailed information on these specific modules are in the [[./system][system directory]] and [[./user][user directory]] respectively.
** Patches
In some cases, since I use =nixpgs-unstable=, I must patch nixpkgs. This can be done inside of a flake via:
#+BEGIN_SRC nix
nixpkgs-patched = (import nixpkgs { inherit system; }).applyPatches {
name = "nixpkgs-patched";
src = nixpkgs;
patches = [ ./example-patch.nix ];
};
# configure pkgs
pkgs = import nixpkgs-patched { inherit system; };
# configure lib
lib = nixpkgs.lib;
#+END_SRC
Patches can either be local or remote, so you can even import unmerged pull requests by using =fetchpatch= and the raw patch url, i.e: https://github.com/NixOS/nixpkgs/pull/example.patch.
I currently curate patches local to this repo in the [[./patches][patches]] directory.
** Profiles
I separate my configurations into [[./profiles][profiles]] (essentially system templates), i.e:
- [[./profiles/personal][Personal]] - What I would run on a personal laptop/desktop
- [[./profiles/work][Work]] - What I would run on a work laptop/desktop (if they let me bring my own OS :P)
- [[./profiles/homelab][Homelab]] - What I would run on a server or homelab
- [[./profiles/wsl][WSL]] - What I would run underneath Windows Subystem for Linux
My profile can be conveniently selected in [[./flake.nix][my flake.nix]] by setting the =profile= variable.
More detailed information on these profiles is in the [[./profiles][profiles directory]].
** Nix Wrapper Script
Some Nix commands are confusing, really long to type out, or require me to be in the directory with my dotfiles. To solve this, I wrote a [[./system/bin/phoenix.nix][wrapper script called phoenix]], which calls various scripts in the root of this directory.
TLDR:
- =phoenix sync= - Synchronize system and home-manager state with config files (essentially =nixos-rebuild switch= + =home-manager switch=)
- =phoenix sync system= - Only synchronize system state (essentially =nixos-rebuild switch=)
- =phoenix sync user= - Only synchronize home-manager state (essentially =home-manager switch=)
- =phoenix update= - Update all flake inputs without synchronizing system and home-manager states
- =phoenix upgrade= - Update flake.lock and synchronize system and home-manager states (=phoenix update= + =phoenix sync=)
- =phoenix refresh= - Call synchronization posthooks (mainly to refresh stylix and some dependent daemons)
- =phoenix pull= - Pull changes from upstream git and attempt to merge local changes (I use this to update systems other than my main system)
- =phoenix harden= - Ensure that all "system-level" files cannot be edited by an unprivileged user
- =phoenix soften= - Relax permissions so all dotfiles can be edited by a normal user (use temporarily for git or other operations)
- =phoenix gc= - Garbage collect the system and user nix stores
- =phoenix gc full= - Delete everything not currently in use
- =phoenix gc 15d= - Delete everything older than 15 days
- =phoenix gc 30d= - Delete everything older than 30 days
- =phoenix gc Xd= - Delete everything older than X days
** Star History
Didn't think this would get that many [[https://star-history.com/#librephoenix/nixos-config&Date][stars on GitHub]], yet here we are:
[[https://api.star-history.com/svg?repos=librephoenix/nixos-config&type=Date.png]]

View file

@ -1,5 +1,5 @@
{ {
description = "Flake of LibrePhoenix"; description = "Flake of ponymushama";
outputs = inputs@{ self, ... }: outputs = inputs@{ self, ... }:
let let
@ -52,7 +52,6 @@
(import inputs.nixpkgs { system = systemSettings.system; rocmSupport = (if systemSettings.gpu == "amd" then true else false); }).applyPatches { (import inputs.nixpkgs { system = systemSettings.system; rocmSupport = (if systemSettings.gpu == "amd" then true else false); }).applyPatches {
name = "nixpkgs-patched"; name = "nixpkgs-patched";
src = inputs.nixpkgs; src = inputs.nixpkgs;
patches = [ ./patches/emacs-no-version-check.patch ];
}; };
# configure pkgs # configure pkgs
@ -88,10 +87,6 @@
overlays = [ inputs.rust-overlay.overlays.default ]; overlays = [ inputs.rust-overlay.overlays.default ];
}; };
pkgs-emacs = import inputs.emacs-pin-nixpkgs {
system = systemSettings.system;
};
pkgs-kdenlive = import inputs.kdenlive-pin-nixpkgs { pkgs-kdenlive = import inputs.kdenlive-pin-nixpkgs {
system = systemSettings.system; system = systemSettings.system;
}; };
@ -137,7 +132,6 @@
extraSpecialArgs = { extraSpecialArgs = {
# pass config variables from above # pass config variables from above
inherit pkgs-stable; inherit pkgs-stable;
inherit pkgs-emacs;
inherit pkgs-kdenlive; inherit pkgs-kdenlive;
inherit pkgs-nwg-dock-hyprland; inherit pkgs-nwg-dock-hyprland;
inherit systemSettings; inherit systemSettings;
@ -170,7 +164,6 @@
extraSpecialArgs = { extraSpecialArgs = {
# pass config variables from above # pass config variables from above
inherit pkgs-stable; inherit pkgs-stable;
inherit pkgs-emacs;
inherit systemSettings; inherit systemSettings;
inherit userSettings; inherit userSettings;
inherit inputs; inherit inputs;
@ -202,7 +195,6 @@
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-24.05"; nixpkgs-stable.url = "nixpkgs/nixos-24.05";
emacs-pin-nixpkgs.url = "nixpkgs/f72123158996b8d4449de481897d855bc47c7bf6";
kdenlive-pin-nixpkgs.url = "nixpkgs/cfec6d9203a461d9d698d8a60ef003cac6d0da94"; kdenlive-pin-nixpkgs.url = "nixpkgs/cfec6d9203a461d9d698d8a60ef003cac6d0da94";
nwg-dock-hyprland-pin-nixpkgs.url = "nixpkgs/2098d845d76f8a21ae4fe12ed7c7df49098d3f15"; nwg-dock-hyprland-pin-nixpkgs.url = "nixpkgs/2098d845d76f8a21ae4fe12ed7c7df49098d3f15";
@ -232,64 +224,6 @@
hyprgrass.url = "github:horriblename/hyprgrass/736119f828eecaed2deaae1d6ff1f50d6dabaaba"; hyprgrass.url = "github:horriblename/hyprgrass/736119f828eecaed2deaae1d6ff1f50d6dabaaba";
hyprgrass.inputs.hyprland.follows = "hyprland"; hyprgrass.inputs.hyprland.follows = "hyprland";
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
nix-doom-emacs.inputs.nixpkgs.follows = "emacs-pin-nixpkgs";
nix-straight.url = "github:librephoenix/nix-straight.el/pgtk-patch";
nix-straight.flake = false;
nix-doom-emacs.inputs.nix-straight.follows = "nix-straight";
eaf = {
url = "github:emacs-eaf/emacs-application-framework";
flake = false;
};
eaf-browser = {
url = "github:emacs-eaf/eaf-browser";
flake = false;
};
org-nursery = {
url = "github:chrisbarrett/nursery";
flake = false;
};
org-yaap = {
url = "gitlab:tygrdev/org-yaap";
flake = false;
};
org-side-tree = {
url = "github:localauthor/org-side-tree";
flake = false;
};
org-timeblock = {
url = "github:ichernyshovvv/org-timeblock";
flake = false;
};
org-krita = {
url = "github:librephoenix/org-krita";
flake = false;
};
org-xournalpp = {
url = "gitlab:vherrmann/org-xournalpp";
flake = false;
};
org-sliced-images = {
url = "github:jcfk/org-sliced-images";
flake = false;
};
magit-file-icons = {
url = "github:librephoenix/magit-file-icons/abstract-icon-getters-compat";
flake = false;
};
phscroll = {
url = "github:misohena/phscroll";
flake = false;
};
mini-frame = {
url = "github:muffinmad/emacs-mini-frame";
flake = false;
};
stylix.url = "github:danth/stylix";
rust-overlay.url = "github:oxalica/rust-overlay"; rust-overlay.url = "github:oxalica/rust-overlay";
blocklist-hosts = { blocklist-hosts = {

View file

@ -1,202 +0,0 @@
#+title: Install
#+author: Emmet
These are just some simple install notes for myself (in-case I have to reinstall unexpectedly). You could also use these to try out my config in a VM.
** Automated Install Script (Experimental)
*** Install Directly From Git
I wrote a quick automated install script at [[./install.sh][install.sh]]. It essentially just runs [[Manual Install Procedure][the manual install steps]] and additionally hardens the security of the system-level (root configuration) files using [[./harden.sh][harden.sh]].
I'll eventually™ add the ability to supply arguments to this script as well.
The quickest way to install is running the install script directly from the remote git repo using =nix run=, which is essentially just one of the following:
#+BEGIN_SRC sh :noeval
# Install from gitlab
nix run gitlab:librephoenix/nixos-config
# Or install from github
nix run github:librephoenix/nixos-config
# Or install from codeberg
nix run git+https://codeberg.org/librephoenix/nixos-config
#+END_SRC
This will install the dotfiles to =~/.dotfiles=, but if you'd like to install to a custom directory, just supply it as a positional argument, i.e:
#+BEGIN_SRC sh :noeval
# Install from gitlab
nix run gitlab:librephoenix/nixos-config -- /your/custom/directory
#+END_SRC
The script will ask for sudo permissions at certain points, /but you should not run the script as root/.
If the above =nix run= command gives you an error, odds are you either don't have =git= installed, or you haven't enabled the experimental features in your Nix config (=nix-command= and =flakes=). To get the command to install properly, you can first enter a shell with =git= available using:
#+begin_src sh :noeval
nix-shell -p git
#+end_src
and then running:
#+BEGIN_SRC sh :noeval
nix run --experimental-features 'nix-command flakes' gitlab:librephoenix/nixos-config
#+END_SRC
And if you want a single copy-paste solution:
#+begin_src sh :noeval
nix-shell -p git --command "nix run --experimental-features 'nix-command flakes' gitlab:librephoenix/nixos-config"
#+end_src
This /should/ still work with a custom dotfiles directory too, i.e:
#+begin_src sh :noeval
nix-shell -p git --command "nix run --experimental-features 'nix-command flakes' gitlab:librephoenix/nixos-config -- /your/custom/directory"
#+end_src
At a certain point in the install script it will open =nano= (or whatever your $EDITOR is set to) and ask you to edit the =flake.nix=. You can edit as much or as little of the config variables as you like, and it will continue the install after you exit the editor.
Potential Errors: I've only tested it working on UEFI with the default EFI mount point of =/boot=. I've added experimental legacy (BIOS) boot support, but it does rely on a quick and dirty script to find the grub device. If you are testing it using some weird boot configuration for whatever reason, try modifying =bootMountPath= (UEFI) or =grubDevice= (legacy BIOS) in =flake.nix= before install, or else it will complain about not being able to install the bootloader.
Note: If you're installing this to a VM, Hyprland won't work unless 3D acceleration is enabled.
Disclaimer: If you install my =homelab= or =worklab= profiles /CHANGE THE PUBLIC SSH KEYS UNLESS YOU WANT ME TO BE ABLE TO SSH INTO YOUR SERVER. YOU CAN CHANGE OR REMOVE THE SSH KEY IN THE RELEVANT CONFIGURATION.NIX/:
- [[./profiles/homelab/configuration.nix][configuration.nix]] for homelab profile
- [[./profiles/worklab/configuration.nix][configuration.nix]] for worklab profile
*** Install From Local Git Clone
The dotfiles can be installed after cloning the repo into =~/.dotfiles= using:
#+BEGIN_SRC sh :noeval
git clone https://gitlab.com/librephoenix/nixos-config.git ~/.dotfiles
~/.dotfiles/install.sh
#+END_SRC
or with a custom directory:
#+BEGIN_SRC sh :noeval
git clone https://gitlab.com/librephoenix/nixos-config.git /your/custom/directory
/your/custom/directory/install.sh
#+END_SRC
If you install to a custom directory, make sure to edit the =userSettings.dotfilesDir= in the [[./flake.nix][flake.nix]], or else my [[./system/bin/phoenix.nix][phoenix wrapper script]] won't work.
At a certain point in the install script it will open =nano= (or whatever your =$EDITOR= is set to) and ask you to edit the =flake.nix=. You can edit as much or as little of the config variables as you like, and it will continue the install after you exit the editor.
Potential Errors: I mainly only test this on UEFI, but I've added experimental legacy (BIOS) boot support. Keep in mind, it does rely on a quick and dirty script to find the grub device. If you are testing it using some weird boot configuration for whatever reason, try modifying =bootMountPath= (UEFI) or =grubDevice= (legacy BIOS) in =flake.nix= before install, or else it will complain about not being able to install the bootloader.
Note: If you're installing this to a VM, Hyprland won't work unless 3D acceleration is enabled.
Disclaimer: If you install my =homelab= or =worklab= profiles /CHANGE THE PUBLIC SSH KEYS UNLESS YOU WANT ME TO BE ABLE TO SSH INTO YOUR SERVER. YOU CAN CHANGE OR REMOVE THE SSH KEY IN THE RELEVANT CONFIGURATION.NIX/:
- [[./profiles/homelab/configuration.nix][configuration.nix]] for homelab profile
- [[./profiles/worklab/configuration.nix][configuration.nix]] for worklab profile
*** Automatic Install Script Limitations
At this time, this only works on an existing NixOS install. It also only works if the dotfiles are cloned into =~/.dotfiles=. It also only works on UEFI, not on BIOS :(
Future upgrade plans:
- [ ] Be able to install directly from NixOS iso
- [ ] Be able to install just home-manager config to a non-NixOS Linux distro
- [ ] Be able to detect EFI mount point for systemd-boot?
- [X] +Be able to detect UEFI or BIOS and switch config as needed+
- [ ] ??? (open up an issue if you think there is anything else I should try to figure out)
** Manual Install Procedure
If you instead want to install this manually to see all the steps (kind of like an Arch install before the archinstall script existed), you can follow this following procedure:
*** Clone Repo and Modify Configuration
Start by cloning the repo:
#+BEGIN_SRC sh :noeval
git clone https://gitlab.com/librephoenix/nixos-config.git ~/.dotfiles
#+END_SRC
Any custom directory should also work:
#+BEGIN_SRC sh :noeval
git clone https://gitlab.com/librephoenix/nixos-config.git /your/custom/directory
#+END_SRC
If you install to a custom directory, make sure to edit the =userSettings.dotfilesDir= in the beginning [[./flake.nix][flake.nix]], or else my [[./system/bin/phoenix.nix][phoenix wrapper script]] won't work.
#+BEGIN_SRC nix :noeval
...
let
...
# ----- USER SETTINGS ----- #
dotfilesDir = "/your/custom/directory"; # username
...
#+END_SRC
To get the hardware configuration on a new system, either copy from =/etc/nixos/hardware-configuration.nix= or run:
#+BEGIN_SRC sh :noeval
sudo nixos-generate-config --show-hardware-config > ~/.dotfiles/system/hardware-configuration.nix
#+END_SRC
Also, if you have a differently named user account than my default (=emmet=), you /must/ update the following lines in the let binding near the top of the [[./flake.nix][flake.nix]]:
#+BEGIN_SRC nix :noeval
...
let
...
# ----- USER SETTINGS ----- #
username = "YOURUSERNAME"; # username
name = "YOURNAME"; # name/identifier
...
#+END_SRC
There are many more config options there that you may also want to change as well.
The build will fail if you are booting from BIOS instead of UEFI, unless change some of the system settings of the flake. Change =bootMode= to "bios" and set the =grubDevice= appropriately for your system (i.e. =/dev/vda= or =/dev/sda=).
#+begin_src nix :noeval
...
let
# ---- SYSTEM SETTINGS ---- #
...
bootMode = "bios"; # uefi or bios
grubDevice = "/dev/vda"; # device identifier for grub; find this by running lsblk
...
#+end_src
Note: If you're installing this to a VM, Hyprland won't work unless 3D acceleration is enabled.
Disclaimer: If you install my =homelab= or =worklab= profiles /CHANGE THE PUBLIC SSH KEYS UNLESS YOU WANT ME TO BE ABLE TO SSH INTO YOUR SERVER. YOU CAN CHANGE OR REMOVE THE SSH KEY IN THE RELEVANT CONFIGURATION.NIX/:
- [[./profiles/homelab/configuration.nix][configuration.nix]] for homelab profile
- [[./profiles/worklab/configuration.nix][configuration.nix]] for worklab profile
*** Rebuild and Switch System Config
Once the variables are set, then switch into the system configuration by running:
#+BEGIN_SRC sh :noeval
sudo nixos-rebuild switch --flake ~/.dotfiles#system
#+END_SRC
or for your own custom directory:
#+BEGIN_SRC sh :noeval
sudo nixos-rebuild switch --flake /your/custom/directory#system
#+END_SRC
*** Intall and Switch Home Manager Config
Home manager can be installed and the configuration activated with:
#+BEGIN_SRC sh :noeval
nix run home-manager/master -- switch --flake ~/.dotfiles#user
#+END_SRC
or for your own custom directory:
#+BEGIN_SRC sh :noeval
nix run home-manager/master -- switch --flake /your/custom/directory#user
#+END_SRC
** FAQ
*** =home-manager switch --flake .#user= Command Fails
If it fails with something to the effect of "could not download {some image file}" then that just means that one of my themes is having trouble downloading the background image. To conserve on space in the repo, my themes download the relevant wallpapers directly from their source, but that also means that if the link is broken, =home-manager switch= fails.
I have included a script in the [[./themes][themes directory]] named [[./themes/background-test.sh][background-test.sh]] which performs a rough test on every theme background url, reporting which are broken.
If you're having this error, navigate to the [[./flake.nix][flake.nix]] and select any theme with a good background wallpaper link. As long as it is able to download the new wallpaper, it should be able to build.
*** Do I have to put the configuration files in =~/.dotfiles=?
No. You can put them in literally any directory you want. I just prefer to use =~/.dotfiles= as a convention. If you change the directory, do keep in mind that the above scripts must be modified, replacing =~/.dotfiles= with whatever directory you want to install them to. Also, you may want to modify the =dotfilesDir= variable in =flake.nix=.
*** So I cloned these dotfiles into ~/.dotfiles, and now there are system-level files owned by my user account.. HOW IS THIS SECURE?!
If you're worried about someone modifying your system-level (root configuration) files as your unpriveleged user, see [[./harden.sh][harden.sh]].
*** I installed this to a VM and when I log in, it crashes and sends me back to the login manager (SDDM)?
Enable 3D acceleration for your virtual machine. Hyprland doesn't work without it.
*** It fails installing with some weird errors about grub or a bootloader?
It will 100% fail if you test it with a non-default boot configuration. It might even give this error otherwise! If this is the case, try modifying =bootMountPath= (UEFI) or =grubDevice= (legacy BIOS) in =flake.nix= before installing again.
*** The install seems to work, but when I login, I'm missing a lot of stuff (partial install)
This can happen if you run the autoinstall script on a system that already has a desktop environment, or if any other (non-Nix-store-symlink) config files are in the way of the config files generated by home-manager. In these cases, home-manager refuses to build anything, even if there's just one file in the way. If you try running =nix run home-manager/master -- switch --flake ~/.dotfiles#user=, it should throw an error at the end with something like:
#+begin_example
Existing file '/home/user/.gtkrc-2.0' is in the way of '/nix/store/6p3hzdbzhad8ra5j1qf4b2b3hs6as6sf-home-manager-files/.gtkrc-2.0'
Existing file '/home/user/.config/Trolltech.conf' is in the way of '/nix/store/6p3hzdbzhad8ra5j1qf4b2b3hs6as6sf-home-manager-files/.config/Trolltech.conf'
Existing file '/home/user/.config/user-dirs.conf' is in the way of '/nix/store/6p3hzdbzhad8ra5j1qf4b2b3hs6as6sf-home-manager-files/.config/user-dirs.conf'
...
#+end_example
The current solution to this is to delete or move the files mentioned so that home-manager can evaluate. Once the files are out of the way, just run =nix run home-manager/master -- switch --flake ~/.dotfiles#user= again and it should work!

View file

@ -17,6 +17,3 @@ pgrep .waybar-wrapped &> /dev/null && echo "Restarting waybar" && killall .wayba
pgrep fnott &> /dev/null && echo "Restarting fnott" && killall fnott && echo "Running fnott" && fnott &> /dev/null & disown; pgrep fnott &> /dev/null && echo "Restarting fnott" && killall fnott && echo "Running fnott" && fnott &> /dev/null & disown;
pgrep hyprpaper &> /dev/null && echo "Reapplying background via hyprpaper" && killall hyprpaper && echo "Running hyprpaper" && hyprpaper &> /dev/null & disown; pgrep hyprpaper &> /dev/null && echo "Reapplying background via hyprpaper" && killall hyprpaper && echo "Running hyprpaper" && hyprpaper &> /dev/null & disown;
pgrep nwggrid-server &> /dev/null && echo "Restarting nwggrid-server" && killall nwggrid-server && echo "Running nwggrid-wrapper" && nwggrid-wrapper &> /dev/null & disown; pgrep nwggrid-server &> /dev/null && echo "Restarting nwggrid-server" && killall nwggrid-server && echo "Running nwggrid-wrapper" && nwggrid-wrapper &> /dev/null & disown;
# emacs
pgrep emacs &> /dev/null && echo "Reloading emacs stylix theme" && echo "Running emacsclient --no-wait --eval \"(load-theme 'doom-stylix t nil)\"" && emacsclient --no-wait --eval "(load-theme 'doom-stylix t nil)" &> /dev/null;

View file

@ -1,23 +0,0 @@
#+title: Doom Emacs
* What is Doom Emacs?
[[https://github.com/doomemacs/doomemacs][Doom Emacs]] is a distribution of the [[https://www.gnu.org/software/emacs/][Emacs Text Editor]] designed for [[https://www.vim.org/][Vim]] users. I like to use Emacs due to its extensibility and extra features it is capable of (besides text editing). Some of these extra features include:
- [[https://orgmode.org/][Org Mode]] (Hierarchical text-based document format)
- [[https://www.orgroam.com/][Org Roam]] (A second brain / personal wiki)
- [[https://orgmode.org/][Org Agenda]] (Calendar and todo list)
- [[https://magit.vc/][magit]] (Git Client)
[[https://raw.githubusercontent.com/librephoenix/nixos-config-screenshots/main/app/doom.png]]
I have found Emacs to be incredibly efficient, and transferring my workflow to fit inside of Emacs has allowed me to get much more work done. I primarily use Emacs for writing, note-taking, task/project management and organizing information.
* My Config
This directory includes my Doom Emacs configuration, which consists of:
- [[./config.el][config.el]] - Main configuration
- [[./init.el][init.el]] - Doom modules (easy sets of packages curated by Doom)
- [[./packages.el][packages.el]] - Additional packages from Melpa (Emacs package manager).
- [[./themes/doom-stylix-theme.el.mustache][doom-stylix-theme.el.mustache]] - Mustache Doom Emacs template to be used with stylix, requires my [[../../style/stylix.nix][stylix.nix module]] as well
- [[./doom.nix][doom.nix]] - Loads Nix Doom Emacs and my configuration into my flake when imported
- A few other [[./scripts][random scripts]]
My full config is a [[./doom.org][literate org document (doom.org)]].

File diff suppressed because it is too large Load diff

View file

@ -1,146 +0,0 @@
{ config, lib, pkgs-emacs, pkgs-stable, inputs, userSettings, systemSettings, ... }:
let
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt"));
dashboardLogo = ./. + "/nix-" + themePolarity + ".webp";
in
{
imports = [
inputs.nix-doom-emacs.hmModule
../git/git.nix
../../shell/sh.nix
../../shell/cli-collection.nix
];
programs.doom-emacs = {
enable = false;
emacsPackage = pkgs-emacs.emacs29-pgtk;
doomPrivateDir = ./.;
# This block from https://github.com/znewman01/dotfiles/blob/be9f3a24c517a4ff345f213bf1cf7633713c9278/emacs/default.nix#L12-L34
# Only init/packages so we only rebuild when those change.
doomPackageDir = let
filteredPath = builtins.path {
path = ./.;
name = "doom-private-dir-filtered";
filter = path: type:
builtins.elem (baseNameOf path) [ "init.el" "packages.el" ];
};
in pkgs-emacs.linkFarm "doom-packages-dir" [
{
name = "init.el";
path = "${filteredPath}/init.el";
}
{
name = "packages.el";
path = "${filteredPath}/packages.el";
}
{
name = "config.el";
path = pkgs-emacs.emptyFile;
}
];
# End block
};
home.file.".emacs.d/themes/doom-stylix-theme.el".source = config.lib.stylix.colors {
template = builtins.readFile ./themes/doom-stylix-theme.el.mustache;
extension = ".el";
};
home.packages = (with pkgs-emacs; [
emacs-lsp-booster
nil
nixfmt
file
wmctrl
jshon
aria
hledger
hunspell hunspellDicts.en_US-large
(pkgs-emacs.mu.override { emacs = emacs29-pgtk; })
emacsPackages.mu4e
isync
msmtp
(python3.withPackages (p: with p; [
pandas
requests
epc lxml
pysocks
pymupdf
markdown
]))
]) ++ (with pkgs-stable; [
nodejs
nodePackages.mermaid-cli
]);
services.mbsync = {
enable = true;
package = pkgs-stable.isync;
frequency = "*:0/5";
};
home.file.".emacs.d/org-yaap" = {
source = "${inputs.org-yaap}";
recursive = true;
};
home.file.".emacs.d/org-side-tree" = {
source = "${inputs.org-side-tree}";
recursive = true;
};
home.file.".emacs.d/org-timeblock" = {
source = "${inputs.org-timeblock}";
recursive = true;
};
home.file.".emacs.d/org-nursery" = {
source = "${inputs.org-nursery}";
};
home.file.".emacs.d/org-krita" = {
source = "${inputs.org-krita}";
};
home.file.".emacs.d/org-xournalpp" = {
source = "${inputs.org-xournalpp}";
};
home.file.".emacs.d/org-sliced-images" = {
source = "${inputs.org-sliced-images}";
};
home.file.".emacs.d/magit-file-icons" = {
source = "${inputs.magit-file-icons}";
};
home.file.".emacs.d/dashboard-logo.webp".source = dashboardLogo;
home.file.".emacs.d/scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh" = {
source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh;
executable = true;
};
home.file.".emacs.d/phscroll" = {
source = "${inputs.phscroll}";
};
home.file.".emacs.d/mini-frame" = {
source = "${inputs.mini-frame}";
};
home.file.".emacs.d/system-vars.el".text = ''
;;; ~/.emacs.d/config.el -*- lexical-binding: t; -*-
;; Import relevant variables from flake into emacs
(setq user-full-name "''+userSettings.name+''") ; name
(setq user-username "''+userSettings.username+''") ; username
(setq user-mail-address "''+userSettings.email+''") ; email
(setq user-home-directory "/home/''+userSettings.username+''") ; absolute path to home directory as string
(setq user-default-roam-dir "''+userSettings.defaultRoamDir+''") ; absolute path to home directory as string
(setq system-nix-profile "''+systemSettings.profile+''") ; what profile am I using?
(setq system-wm-type "''+userSettings.wmType+''") ; wayland or x11?
(setq doom-font (font-spec :family "''+userSettings.font+''" :size 20)) ; import font
(setq dotfiles-dir "''+userSettings.dotfilesDir+''") ; import location of dotfiles directory
'';
}

File diff suppressed because it is too large Load diff

View file

@ -1,175 +0,0 @@
(doom! :input
;;chinese
;;japanese
;;layout ; auie,ctsrnm is the superior home row
:completion
company ; the ultimate code completion backend
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life
vertico ; the search engine of the future
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
;;doom-dashboard ; a nifty splash screen for Emacs
doom-quit ; DOOM quit-message prompts when you quit Emacs
(emoji +unicode) ; 🙂
hl-todo ; highlight todo/fixme/note/deprecated/hack/review
;;hydra
;;indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again
;;minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink cursor line after big motions
neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;;tabs ; a tab bar for Emacs
treemacs ; a project drawer, like neotree but cooler
unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
;;vi-tilde-fringe ; fringe tildes to mark beyond EOB
window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
word-wrap ; soft wrapping with language-aware indent
:emacs
(dired +ranger) ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
ibuffer ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
vterm ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
(spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools
;;ansible
;;biblio ; Writes a PhD for you (citation needed)
;;debugger ; stepping through code, to help you add bugs
;;direnv
docker
;;editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
lookup ; navigate your code and its documentation
(lsp) ; M-x vscode
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
;;prodigy ; managing external services & code builders
rgb ; creating color strings
;;taskrunner ; taskrunner for all your projects
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
;;upload ; map local to remote projects via ssh/ftp
:os
;;(:if IS-MAC macos) ; improve compatibility with macOS
tty ; improve the terminal Emacs experience
:lang
;;agda ; types of types of types of types...
;;beancount ; mind the GAAP
;;cc ; C > C++ == 1
;;clojure ; java with a lisp
common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans
data ; config/data formats
;;(dart +flutter) ; paint ui and not much else
;;dhall
;;elixir ; erlang done right
;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
;;ess ; emacs speaks statistics
;;factor
;;faust ; dsp, but you get to keep your soul
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
(gdscript +lsp) ; the language you waited for
;;(go +lsp) ; the hipster dialect
(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
json ; At least it ain't XML
(java +lsp) ; the poster child for carpal tunnel syndrome
javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
(nix +lsp) ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
(org +roam2) ; organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs
;;raku ; the artist formerly known as perl6
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
web ; the tubes
yaml ; JSON, but readable
;;zig ; C, but simpler
:email
(mu4e +org)
;;notmuch
;;(wanderlust +gmail)
:app
calendar
;;emms
;;everywhere ; *leave* Emacs!? You must be joking
;;irc ; how neckbeards socialize
rss ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought
:config
;;literate
(default +bindings +smartparens))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View file

@ -1,36 +0,0 @@
(package! embark :pin "0908eea")
(package! dashboard)
(package! direnv)
(package! org :pin "5bdfc02c6fa1b9ad4f075ac1ad1e4086ead310db")
(package! org-modern)
(package! org-super-agenda)
(package! emacsql :pin "c1a4407")
(package! org-roam-ui)
(package! org-transclusion)
(package! org-download)
(package! org-yt)
(package! toc-org)
(package! lister)
(package! all-the-icons-ibuffer)
(package! all-the-icons-dired)
(package! all-the-icons-completion)
(package! ox-reveal)
(package! magit-todos)
(package! hledger-mode)
(package! rainbow-mode)
(package! crdt)
(package! ess)
(package! openwith)
(package! ob-mermaid)
(package! focus)
(package! olivetti)
(package! async)
(package! centered-cursor-mode)
(package! elfeed)
(package! elfeed-protocol)
(package! docker-tramp :disable t)
(package! org-ql)
(package! persist)
(package! sudo-edit)
(package! solaire-mode :disable t)
(package! el-patch)

View file

@ -1,20 +0,0 @@
#!/bin/sh
if [ $(echo $XDG_SESSION_TYPE) == "wayland" ]; then
FILENAME="$(wl-paste)"
FILTEREDFILENAME=$(echo "$FILENAME" | sed "s+file:+./+")
echo "$FILTEREDFILENAME"
if [[ -f "$FILTEREDFILENAME" ]]; then
wl-copy < "$FILTEREDFILENAME"
fi
elif [ $(echo $XDG_SESSION_TYPE) == "x11" ]; then
FILENAME="$(xclip -o)"
FILTEREDFILENAME=$(echo "$FILENAME" | sed "s+file:+./+")
if [[ -f "$FILTEREDFILENAME" ]]; then
TYPE=$(file -b --mime-type "$FILTEREDFILENAME")
xclip -selection clipboard -t "$TYPE" -i "$FILTEREDFILENAME"
exit
fi
else
exit
fi
exit

View file

@ -1,177 +0,0 @@
;;; doom-stylix-theme.el --- stylix template created from doom-one -*- lexical-binding: t; no-byte-compile: t; -*-
;;
;; Author: Emmet K <https://gitlab.com/librephoenix>
;; Maintainer: Emmet K <https://gitlab.com/librephoenix>
;; Source: https://github.com/doomemacs/themes
;;
;;; Commentary:
;;
;; Stylix template for Doom Emacs.
;;
;;; Code:
(require 'doom-themes)
;;
;;; Variables
(defgroup doom-stylix-theme nil
"Options for the `doom-one' theme."
:group 'doom-themes)
(defcustom doom-stylix-brighter-modeline nil
"If non-nil, more vivid colors will be used to style the mode-line."
:group 'doom-stylix-theme
:type 'boolean)
(defcustom doom-stylix-brighter-comments nil
"If non-nil, comments will be highlighted in more vivid colors."
:group 'doom-stylix-theme
:type 'boolean)
(defcustom doom-stylix-padded-modeline doom-themes-padded-modeline
"If non-nil, adds a 4px padding to the mode-line.
Can be an integer to determine the exact padding."
:group 'doom-stylix-theme
:type '(choice integer boolean))
;;
;;; Theme definition
(def-doom-theme doom-stylix
"A theme generated from current stylix theme."
;; name default 256 16
((bg '("#{{base00-hex}}" "black" "black" ))
(fg '("#{{base05-hex}}" "#bfbfbf" "brightwhite" ))
;; These are off-color variants of bg/fg, used primarily for `solaire-mode',
;; but can also be useful as a basis for subtle highlights (e.g. for hl-line
;; or region), especially when paired with the `doom-darken', `doom-lighten',
;; and `doom-blend' helper functions.
(bg-alt '("#{{base01-hex}}" "black" "black" ))
(fg-alt '("#{{base07-hex}}" "#2d2d2d" "white" ))
;; These should represent a spectrum from bg to fg, where base0 is a starker
;; bg and base8 is a starker fg. For example, if bg is light grey and fg is
;; dark grey, base0 should be white and base8 should be black.
(base0 '("#{{base00-hex}}" "black" "black" ))
(base1 '("#{{base01-hex}}" "#1e1e1e" "brightblack" ))
(base2 '("#{{base01-hex}}" "#2e2e2e" "brightblack" ))
(base3 '("#{{base02-hex}}" "#262626" "brightblack" ))
(base4 '("#{{base03-hex}}" "#3f3f3f" "brightblack" ))
(base5 '("#{{base04-hex}}" "#525252" "brightblack" ))
(base6 '("#{{base05-hex}}" "#6b6b6b" "brightblack" ))
(base7 '("#{{base06-hex}}" "#979797" "brightblack" ))
(base8 '("#{{base07-hex}}" "#dfdfdf" "white" ))
(grey base4)
(red '("#{{base08-hex}}" "#ff6655" "red" ))
(orange '("#{{base09-hex}}" "#dd8844" "brightred" ))
(green '("#{{base0B-hex}}" "#99bb66" "green" ))
(teal '("#{{base0C-hex}}" "#44b9b1" "brightgreen" ))
(yellow '("#{{base0A-hex}}" "#ECBE7B" "yellow" ))
(blue '("#{{base0E-hex}}" "#51afef" "brightblue" ))
(dark-blue '("#{{base0E-hex}}" "#2257A0" "blue" ))
(magenta '("#{{base0F-hex}}" "#c678dd" "brightmagenta"))
(violet '("#{{base0F-hex}}" "#a9a1e1" "magenta" ))
(cyan '("#{{base0D-hex}}" "#46D9FF" "brightcyan" ))
(dark-cyan '("#{{base0C-hex}}" "#5699AF" "cyan" ))
;; These are the "universal syntax classes" that doom-themes establishes.
;; These *must* be included in every doom themes, or your theme will throw an
;; error, as they are used in the base theme defined in doom-themes-base.
(highlight blue)
(vertical-bar (doom-darken base1 0.1))
(selection dark-blue)
(builtin magenta)
(comments (if doom-stylix-brighter-comments dark-cyan base5))
(doc-comments (doom-lighten (if doom-stylix-brighter-comments dark-cyan base5) 0.25))
(constants violet)
(functions magenta)
(keywords blue)
(methods cyan)
(operators blue)
(type yellow)
(strings green)
(variables (doom-lighten magenta 0.4))
(numbers orange)
(region `(,(doom-lighten (car bg-alt) 0.15) ,@(doom-lighten (cdr base1) 0.35)))
(error red)
(warning yellow)
(success green)
(vc-modified orange)
(vc-added green)
(vc-deleted red)
;; These are extra color variables used only in this theme; i.e. they aren't
;; mandatory for derived themes.
(modeline-fg fg)
(modeline-fg-alt base5)
(modeline-bg (if doom-stylix-brighter-modeline
(doom-darken blue 0.45)
(doom-darken bg-alt 0.1)))
(modeline-bg-alt (if doom-stylix-brighter-modeline
(doom-darken blue 0.475)
`(,(doom-darken (car bg-alt) 0.15) ,@(cdr bg))))
(modeline-bg-inactive `(,(car bg-alt) ,@(cdr base1)))
(modeline-bg-inactive-alt `(,(doom-darken (car bg-alt) 0.1) ,@(cdr bg)))
(-modeline-pad
(when doom-stylix-padded-modeline
(if (integerp doom-stylix-padded-modeline) doom-stylix-padded-modeline 4))))
;;;; Base theme face overrides
(((line-number &override) :foreground base4)
((line-number-current-line &override) :foreground fg)
((font-lock-comment-face &override)
:background (if doom-stylix-brighter-comments (doom-lighten bg 0.05)))
(mode-line
:background modeline-bg :foreground modeline-fg
:box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg)))
(mode-line-inactive
:background modeline-bg-inactive :foreground modeline-fg-alt
:box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-inactive)))
(mode-line-emphasis :foreground (if doom-stylix-brighter-modeline base8 highlight))
;;;; css-mode <built-in> / scss-mode
(css-proprietary-property :foreground orange)
(css-property :foreground green)
(css-selector :foreground blue)
;;;; doom-modeline
(doom-modeline-bar :background (if doom-stylix-brighter-modeline modeline-bg highlight))
(doom-modeline-buffer-file :inherit 'mode-line-buffer-id :weight 'bold)
(doom-modeline-buffer-path :inherit 'mode-line-emphasis :weight 'bold)
(doom-modeline-buffer-project-root :foreground green :weight 'bold)
;;;; elscreen
(elscreen-tab-other-screen-face :background "#{{base01-hex}}" :foreground "#{{base06-hex}}")
;;;; ivy
(ivy-current-match :background dark-blue :distant-foreground base0 :weight 'normal)
;;;; LaTeX-mode
(font-latex-math-face :foreground green)
;;;; markdown-mode
(markdown-markup-face :foreground base5)
(markdown-header-face :inherit 'bold :foreground red)
((markdown-code-face &override) :background (doom-lighten base3 0.05))
;;;; org-mode
(org-block :background (doom-darken bg 0.05 ) :extend t)
(org-code :background (doom-darken bg 0.05 ) :extend t)
;;;; rjsx-mode
(rjsx-tag :foreground red)
(rjsx-attr :foreground orange)
;;;; solaire-mode
(solaire-mode-line-face
:inherit 'mode-line
:background modeline-bg-alt
:box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-alt)))
(solaire-mode-line-inactive-face
:inherit 'mode-line-inactive
:background modeline-bg-inactive-alt
:box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-inactive-alt))))
;;;; Base theme variable overrides-
())
;;; doom-stylix-theme.el ends here