nixos-config/README.org

54 lines
2.1 KiB
Org Mode
Raw Normal View History

2023-04-23 05:50:54 +05:30
#+title: NixOS Config
2023-04-23 02:29:37 +05:30
#+author: librephoenix
2023-05-06 17:46:35 +05:30
[[https://gitlab.com/librephoenix/nixos-config][Main Repo Link (GitLab)]]
[[https://github.com/librephoenix/nixos-config-mirror][Mirror Repo Link (GitHub)]]
2023-04-23 05:50:54 +05:30
* What is this repository?
2023-06-02 03:30:22 +05:30
These are my dotfiles (configuration files) for my NixOS setup(s).
2023-04-23 02:29:37 +05:30
* 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:
2023-04-23 05:28:48 +05:30
#+BEGIN_SRC sh :noeval
sudo nixos-generate-config --dir /dotfiles/path/system
#+END_SRC
2023-04-23 02:29:37 +05:30
Then, I can switch into the system configuration by running:
#+BEGIN_SRC sh :noeval
cd /dotfiles/path
sudo nixos-rebuild switch --flake .#snowfire
2023-04-23 02:29:37 +05:30
#+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
2023-06-02 03:30:22 +05:30
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
2023-04-23 02:29:37 +05:30
Then, my home-manager configuration can be installed with:
#+BEGIN_SRC sh :noeval
2023-06-02 03:30:22 +05:30
home-manager switch --flake .#emmet
2023-04-23 02:29:37 +05:30
#+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