Cleaning up feels so good

This commit is contained in:
Daniel Flanagan 2023-09-15 11:16:38 -05:00
parent fec19d0d9b
commit db74308187
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
5 changed files with 47 additions and 95 deletions

View file

@ -21,20 +21,12 @@ set --export --universal XDG_PICTURES_DIR $NICE_HOME/img
set --export --universal XDG_VIDEOS_DIR $NICE_HOME/video
set --export --universal XDG_GAMES_DIR $NICE_HOME/games
set --export --universal DOTFILES_PATH $XDG_CONFIG_HOME/lytedev-dotfiles
set --export --universal ENV_PATH $XDG_CONFIG_HOME/lytedev-env
set --export --universal FISH_PATH $XDG_CONFIG_HOME/fish
set --export --universal NOTES_PATH $NICE_HOME/doc/notes
set --export --universal SCROTS_PATH $NICE_HOME/img/scrots
set --export --universal USER_LOGS_PATH $NICE_HOME/doc/logs
set --export --universal CDPATH $NICE_HOME
for s in $ENV_PATH/*/config.d.fish
source $s (dirname $s)
end
# vars
set --export --universal LS_COLORS 'ow=01;36;40'
set --export --universal EXA_COLORS '*=0'
@ -78,4 +70,8 @@ end
if has_command rtx
rtx activate fish | source
end
end
for dir in $HOME/.cargo/bin
fish_add_path $dir
end

View file

@ -544,8 +544,6 @@ in
lC = "lc --reverse";
lD = "la --only-dirs";
"cd.." = "d ..";
"cdd" = "d $DOTFILES_PATH";
"cde" = "d $XDG_CONFIG_HOME/lytedev-env";
"cdc" = "d $XDG_CONFIG_HOME";
"cdn" = "d $NOTES_PATH";
"cdl" = "d $XDG_DOWNLOAD_DIR";

102
readme.md
View file

@ -1,97 +1,79 @@
# Nix
The grand unification of configuration.
My grand, declarative, and unified application, service, environment, and
machine configuration, secret, and package management in a single flake. ❤️ ❄️
## Not on NixOS?
**NOTE**: Everything in here is highly specific to my personal preference. I
can't recommend you actually use this in any way, but hopefully some stuff in
here is useful inspiration.
Install Nix using Determinate Systems's installer:
# Quick Start
```bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
You don't have even have to clone this crap yourself. How cool is that!
And [install Home Manager in standalone mode](https://nix-community.github.io/home-manager/index.html#sec-install-standalone):
## NixOS
# NixOS
```bash
```shell_session
nixos-rebuild --flake git+https://git.lyte.dev/lytedev/nix switch
```
## Remotely
## Not NixOS
```shell_session
$ curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
$ nix profile install github:nix-community/home-manager
$ home-manager switch --flake git+https://git.lyte.dev/lytedev/nix
```
# Advanced Usage
## Push NixOS Config
```bash
nixos-rebuild --flake git+https://git.lyte.dev/lytedev/nix#host \
nix run nixpkgs#nixos-rebuild -- --flake 'git+https://git.lyte.dev/lytedev/nix#host' \
--target-host root@host --build-host root@host \
switch
switch --show-trace
```
# Home Manager
<!-- TODO: how to do this with rollbacks if I don't confirm things? -->
This can be used on non-NixOS hosts:
## Provisioning New NixOS Hosts
```bash
home-manager switch --flake .#daniel
```
## Remotely
```bash
ssh daniel@host 'home-manager switch --flake git+https://git.lyte.dev/lytedev/nix#daniel'
```
# Provisioning New NixOS Hosts
Documented below is my process for standing up a new NixOS node configured and
managed by this flake from scratch.
## Network Access
Boot a NixOS ISO and establish network access:
```bash
# plug in ethernet or do the wpa_cli song and dance for wifi access
wpa_cli scan # if you need to
# establish network access
# plug in ethernet or do the wpa_cli song and dance for wifi
wpa_cli scan
wpa_cli scan_results
wpa_cli add_network 0
wpa_cli set_network 0 ssid "MY_SSID"
wpa_cli set_network 0 psk "MY_WIFI_PASSWORD"
wpa_cli enable_network 0
wpa_cli save_config
```
Partition disk(s) and mount up however you like. Preferably, though, use a
[disko configuration](./disko.nix) from this flake like so:
```bash
# TODO: I'm relatively certain this can be simplified to a single `nix run` command
sudo nix-shell --packages git --run "nix run \
# partition disks
nix-shell --packages git --run "sudo nix run \
--extra-experimental-features nix-command \
--extra-experimental-features flakes \
github:nix-community/disko -- \
--flake 'git+https://git.lyte.dev/lytedev/nix#standard' \
--flake 'git+https://git.lyte.dev/lytedev/nix#${PARTITION_SCHEME}' \
--mode disko \
--arg disks '[ \"/dev/your_disk\" ]'"
```
--arg disks '[ \"/dev/${DISK}\" ]'"
And finally install NixOS as specified by this flake:
```bash
# install
nix-shell --packages git \
--run "sudo nixos-install \
--flake 'git+https://git.lyte.dev/lytedev/nix#yourNixosConfig'"
--option substituters https://nix.h.lyte.dev
--flake 'git+https://git.lyte.dev/lytedev/nix#${FLAKE_ATTR}'"
```
**NOTE**: This takes a while, mostly due to building Helix myself on each box. I
really need to figure out a good local caching setup.
**NOTE**: since the disko setup _should_ be included in the nixosConfiguration,
I would like to know how to do this all in one go -- maybe even building my own
live media?
# Other To Dos
# To Do
- Port configuration (lytedev/dotfiles) to home manager where applicable?
- Sway, Kitty, and Helix, come to mind
- Pre-commit checks with `nix flake check`?
- Installation from a live ISO does not fully work yet
- I don't understand Nix well enough to know why stuff is being compiled even when I have a binary cache
- Maybe it detects different CPUs and will recompile certain packages for per-CPU optimizations?
- How does this factor in with "pureness"?
- Custom pre-configured live ISO
- Unify standalone home manager module with NixOS home manager module
- Pre-commit checks with stuff like `nix flake check` and formatting checkers

View file

@ -1,21 +0,0 @@
#!/usr/bin/env fish
set profile_dirs $HOME/.mozilla/firefox/*.dev-edition-default $HOME/.mozilla/firefox/*.default-release
if test (uname) = Darwin
set profile_dirs $HOME/Library/Application\ Support/Firefox/Profiles/*.dev-edition-default $HOME/.mozilla/firefox/*.default-release
end
for p in $profile_dirs
mkdir -p $p/chrome
set user_chrome_css_file $p/chrome/userChrome.css
echo '/* Generated by '(status -f)' -- do not edit manually! */' > $user_chrome_css_file
cat $DOTFILES_PATH/common/firefox/userChrome.d.css >> $user_chrome_css_file
echo >> $user_chrome_css_file
for file_part in $ENV_PATH/*/firefox/userChrome.d.css
cat $file_part >> $user_chrome_css_file
echo >> $user_chrome_css_file
end
echo Built $user_chrome_css_file
end
echo Make sure you set 'toolkit.legacyUserProfileCustomizations.stylesheets' to true in about:config

View file

@ -1,3 +0,0 @@
#!/usr/bin/env sh
d="$(command ls "$ENV_PATH" | sk)" && \
tmux-lyte-session "env-$d" "$ENV_PATH/$d"