nixos-config/install.org

76 lines
3.7 KiB
Org Mode
Raw Normal View History

2023-06-11 20:56:47 +05:30
#+title: Install
#+author: Emmet
These are just some simple install notes for myself (in-case I have to reinstall unexpectedly).
** Automated Install Script (Experimental)
I wrote a quick automated install script at [[./install.sh][install.sh]]. It essentially just runs the following manual install steps and 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.
It can either be run after cloning the dotfiles to =~/.dotfiles= with:
#+BEGIN_SRC sh :noeval
git clone https://gitlab.com/librephoenix/nixos-config.git ~/.dotfiles
~/.dotfiles/install.sh
#+END_SRC
or it can be run directly from git using nix-run:
#+BEGIN_SRC sh :noeval
nix-run gitlab:librephoenix/nixos-config
#+END_SRC
At this time, this only works on an existing NixOS install.
Future plans:
- [ ] Be able to install directly from NixOS iso
- [ ] Be able to install just home-manager config to a non-NixOS Linux distro
- [ ] ??? (open up an issue if you think there is anything else I should try to figure out)
** Manual Install Notes
2023-10-29 00:20:27 +05:30
To get this running on a NixOS system, start by cloning the repo:
2023-06-11 20:56:47 +05:30
#+BEGIN_SRC sh :noeval
2023-06-29 22:01:35 +05:30
git clone https://gitlab.com/librephoenix/nixos-config.git ~/.dotfiles
2023-06-11 20:56:47 +05:30
#+END_SRC
2023-10-29 00:20:27 +05:30
To get the hardware configuration on a new system, either copy from =/etc/nixos/hardware-configuration.nix= or run:
2023-06-11 20:56:47 +05:30
#+BEGIN_SRC sh :noeval
sudo nixos-generate-config --show-hardware-config > ~/.dotfiles/system/hardware-configuration.nix
2023-06-11 20:56:47 +05:30
#+END_SRC
2023-10-29 00:20:27 +05:30
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
...
2023-10-29 00:34:38 +05:30
let
...
2023-10-29 00:20:27 +05:30
# ----- 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.
Once the variables are set, then switch into the system configuration by running:
2023-06-11 20:56:47 +05:30
#+BEGIN_SRC sh :noeval
sudo nixos-rebuild switch --flake ~/.dotfiles#system
2023-06-11 20:56:47 +05:30
#+END_SRC
Home manager can be installed and the configuration activated with:
2023-06-11 20:56:47 +05:30
#+BEGIN_SRC sh :noeval
nix run home-manager/master -- switch --flake ~/.dotfiles#user
2023-06-11 20:56:47 +05:30
#+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.
2024-02-25 23:13:35 +05:30
*** 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.
*** 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]].