Improved documentation for my config

This commit is contained in:
Emmet 2023-06-11 10:26:47 -05:00
parent 4a44c06a43
commit 2615d4d255
5 changed files with 144 additions and 45 deletions

View file

@ -5,54 +5,30 @@
[[https://github.com/librephoenix/nixos-config-mirror][Mirror Repo Link (GitHub)]]
* What is this repository?
** What is this repository?
These are my dotfiles (configuration files) for my NixOS setup(s).
Here is my main setup:
[[themes/ayu-dark/ayu-dark.png]]
* Notes for Myself
To get this running on a NixOS system, I will start by cloning the repo:
#+BEGIN_SRC sh :noeval
git clone https://gitlab.com/librephoenix/nixos-config.git /path/to/my/config/folder
** Install
I wrote some reinstall notes for myself [[./install.org][here (install.org)]].
** Modules
Separate Nix files can be imported as modules using an import block:
#+BEGIN_SRC nix
imports = [ import1.nix
import2.nix
...
];
#+END_SRC
To get the hardware configuration on a new system, I can other copy from =/etc/nixos/hardware-configuration.nix= or run:
#+BEGIN_SRC sh :noeval
sudo nixos-generate-config --dir /dotfiles/path/system
#+END_SRC
This conveniently allows configurations to be separated and swapped around quickly.
Then, I can switch into the system configuration by running:
#+BEGIN_SRC sh :noeval
cd /dotfiles/path
sudo nixos-rebuild switch --flake .#snowfire
#+END_SRC
I have my modules separated into two groups:
- System-level - stored in the [[./system][system directory]]
- System-level modules are imported into [[./system/configuration.nix][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 [[./user/home.nix][home.nix]], which is also sourced into [[./flake.nix][my flake (flake.nix)]]
Home manager can be installed with:
#+BEGIN_SRC sh :noeval
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
#+END_SRC
If home-manager starts to not cooperate, it may be because the unstable branch of nixpkgs is in the Nix channel list. This can be fixed via:
#+BEGIN_SRC sh :noeval
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
#+END_SRC
Home-manager may also not work without re-logging back in after it has been installed.
Once home-manager is running, my home-manager configuration can be installed with:
#+BEGIN_SRC sh :noeval
home-manager switch --flake .#emmet
#+END_SRC
This loads in my convenience script =phoenix=, which replaces frequently used nix and nixos commands with more user friendly ones, namely:
- =phoenix sync= to build and switch system and home configuration
- =phoenix sync system= to build and switch only system configuration
- =phoenix sync user= to build and switch only home configuration
- =phoenix update= to update flake inputs
- =phoenix gc= to garbage collect
- If no argument is given, it cleans anything older than 30 days
- If a time argument is supplied (i.e. 10d), it cleans stuff older than that (10 days in this example)
- If the argument =full= is given, it deletes /all/ previous generations
More detailed information on these specific modules are in the [[./system][system directory]] and [[./user][user directory]] respectively.

View file

@ -1,5 +1,5 @@
{
description = "No, I don't understand how this works, so please don't ask";
description = "Flake of LibrePhoenix";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
@ -59,8 +59,6 @@
myHomeDir = "/home/"+name;
myEmail = email;
myDotfilesDir = dotfilesDir;
myNixConfigurationFilePath = dotfilesDir+"/system/configuration.nix";
myHomeManagerFilePath = dotfilesDir+"/user/home.nix";
myTheme = theme;
myThemePolarity = themePolarity;
myBackgroundUrl = backgroundUrl;

50
install.org Normal file
View file

@ -0,0 +1,50 @@
#+title: Install
#+author: Emmet
These are just some simple install notes for myself (in-case I have to reinstall unexpectedly).
** Install Notes for Myself
To get this running on a NixOS system, I will start by cloning the repo:
#+BEGIN_SRC sh :noeval
git clone https://gitlab.com/librephoenix/nixos-config.git /path/to/my/config/folder
#+END_SRC
To get the hardware configuration on a new system, I can other copy from =/etc/nixos/hardware-configuration.nix= or run:
#+BEGIN_SRC sh :noeval
sudo nixos-generate-config --dir /dotfiles/path/system
#+END_SRC
Then, I can switch into the system configuration by running:
#+BEGIN_SRC sh :noeval
cd /dotfiles/path
sudo nixos-rebuild switch --flake .#snowfire
#+END_SRC
Home manager can be installed with:
#+BEGIN_SRC sh :noeval
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
#+END_SRC
If home-manager starts to not cooperate, it may be because the unstable branch of nixpkgs is in the Nix channel list. This can be fixed via:
#+BEGIN_SRC sh :noeval
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
#+END_SRC
Home-manager may also not work without re-logging back in after it has been installed.
Once home-manager is running, my home-manager configuration can be installed with:
#+BEGIN_SRC sh :noeval
home-manager switch --flake .#emmet
#+END_SRC
This loads in my convenience script =phoenix=, which replaces frequently used nix and nixos commands with more user friendly ones, namely:
- =phoenix sync= to build and switch system and home configuration
- =phoenix sync system= to build and switch only system configuration
- =phoenix sync user= to build and switch only home configuration
- =phoenix update= to update flake inputs
- =phoenix gc= to garbage collect
- If no argument is given, it cleans anything older than 30 days
- If a time argument is supplied (i.e. 10d), it cleans stuff older than that (10 days in this example)
- If the argument =full= is given, it deletes /all/ previous generations

23
system/README.org Normal file
View file

@ -0,0 +1,23 @@
#+title: System-level Nix Modules
#+author: Emmet
** System-level Nix Modules
Separate Nix files can be imported as modules using an import block:
#+BEGIN_SRC nix
imports = [ import1.nix
import2.nix
...
];
#+END_SRC
My system-level Nix modules are organized into this directory:
- [[./hardware-configuration.nix][hardware-configuration]] - Default hardware config generated for my system
- [[./style][style]] - Stylix setup (system-wide base16 theme generation) - Currently broken and needs fixing; last time I tried it doesn't work nicely with home-manager stylix at the same time
** Variables imported from flake.nix
Variables can be imported from [[../flake.nix][flake.nix]] by setting the =specialArgs= block inside the flake (see [[../flake.nix][my flake]] for more details). This allows variables to merely be managed in one place ([[../flake.nix][flake.nix]]) rather than having to manage them in multiple locations.
I currently import the following variables to the system config:
- =myTheme= - base16 theme stored in ../themes to be used
- =myBackgroundUrl= - Direct link to background wallpaper (used for login screen)
- =myBackgroundSha256= - Checksum for background image used when downloading

52
user/README.org Normal file
View file

@ -0,0 +1,52 @@
#+title: User-level Nix Modules
#+author: Emmet
** User-level Nix Modules
Separate Nix files can be imported as modules using an import block:
#+BEGIN_SRC nix
imports = [ import1.nix
import2.nix
...
];
#+END_SRC
My user-level Nix modules are organized into this directory:
- [[./app][app]] - Apps or collections of apps bundled with my configs
- [[./app/browser][browser]] - Used to set default browser
- [[./app/dmenu-scripts][dmenu-scripts]]
- [[./app/doom-emacs][doom-emacs]]
- [[./app/flatpak][flatpak]] - Installs flatpak as a utility (flatpaks must be installed manually)
- [[./app/games][games]] - Gaming setup
- [[./app/git][git]]
- [[./app/keepass][keepass]]
- [[./app/ranger][ranger]]
- [[./app/terminal][terminal]] - Configuration for terminal emulators
- [[./app/virtualization][virtualization]] - Virtualization and compatability layers
- [[./bin][bin]] - My own scripts
- [[./bin/phoenix.nix][phoenix]] - My nix command wrapper
- [[./lang][lang]] - Various bundled programming languages
- I will probably get rid of this in favor of a shell.nix for every project, once I learn how that works
- [[./pkgs][pkgs]] - "Package builds" for packages not in the Nix repositories
- [[./pkgs/pokemon-colorscripts.nix][pokemon-colorscripts]]
- [[./pkgs/rogauracore.nix][rogauracore]] - not working yet
- [[./pkgs/ytsub.nix][ytsub]]
- [[./shell][shell]] - My default bash and zsh configs
- [[./shell/sh.nix][sh]] - bash and zsh configs
- [[./shell/cli-collection.nix][cli-collection]] - Curated useful CLI utilities
- [[./style][style]] - Stylix setup (system-wide base16 theme generation)
- [[./wm][wm]] - Window manager, compositor, and/or wayland compositor setups
- [[./wm/xmonad][xmonad]]
- [[./wm/picom][picom]]
** Variables imported from flake.nix
Variables can be imported from [[../flake.nix][flake.nix]] by setting the =extraSpecialArgs= block inside the flake (see [[../flake.nix][my flake]] for more details). This allows variables to merely be managed in one place ([[../flake.nix][flake.nix]]) rather than having to manage them in multiple locations.
I currently import the following variables to the system config:
- =myName= - Username
- =myHomeDir= - Absolute path to home directory derived from =myName=
- =myEmail= - Email
- =myDotfilesDir= - Path to my dotfiles directory on the system
- =myTheme= - base16 theme stored in ../themes to be used
- =myThemePolarity= - whether theme is =light= or =dark=
- =myBackgroundUrl= - Direct link to background wallpaper (used for login screen)
- =myBackgroundSha256= - Checksum for background image used when downloading