This dotfiles describes almost everything in nix except AstroNvim. This dotfiles makes home-manager independent from NixOS Modules. Therefore, the parts managed by home-manager are supposed to be available to all linux users. In addition, some NixOS users can make full use of this dotfiles. This dotfiles has been created for successful setup on the ThinkPad X1 Carbon 7th. It has not been tested on other generations of the X1 Carbon, but users with other generations of the X1 Carbon may also be able to set it up successfully.
Target Hardware | ThinkPad X1 Carbon 7th |
Window Manager | KDE Plasma 6 |
Terminal Emulator | Ghostty |
Shell | zsh |
Vim | NixVim |
Prompt | starship |
Fingerprint | Disable |
Bluetooth | Enable |
KDE connect | Enable |
Docker | Enable |
Japanese Input | skk |
TimeZone | Asia/Tokyo |
i18n | en_US.UTF-8 |
command alias | execute comand |
---|---|
.. | cd ../ |
... | cd ../../ |
.... | cd ../../../ |
ls | eza |
ll | eza -l |
tree | eza --tree |
find | fd |
size | fd --size |
ps | procs |
man | tldr |
diff | delta --side-by-side |
neofetch | fastfetch |
nix-develop | nix develop -c $SHELL |
hn (for NixOS user) | cd /etc/nixos && nix run home-manager -- switch --flake .#myHomeConfig |
hm (for not NixOS user) | home-manager switch |
hg | home-manager generations |
nr (for NixOS user) | sudo nixos-rebuild switch |
hs | firefox https://home-manager-options.extranix.com |
ns | firefox https://search.nixos.org |
gc | nix-collect-garbage |
t | typst watch |
net | speedtest |
mobile | scrcpy -d |
clock | tty-clock -c -s |
g | lazygit |
tdf |
|
open | yazi |
tetris | bastet |
cf-net | firefox https://speed.cloudflare.com/ |
- nl [OPTIONS] [URL] [REV]
[OPTIONS]
-f
... Show and copy to clipboard the hash value
-h
... Show and copy to clipboard complete results
[URL]
URL to the repository to be fetched
[REV]
The revision or reference to be fetched
- copypath
Show and copy pwd results to clickboard
- copyfile [FILE]
Show and copy a file content to clickboard
Warning
Please note that some commands have not been checked for execution results.
access following site: https://nixos.org/download/
select "Minimal ISO image"
dd if=<iso path> of=<install media path> bs=1M
dd sample
dd if=./nixos-minimal-24.05.3444.cf05eeada35e-x86_64-linux.iso of=/dev/sda bs=1M
When you don't know the storage device name of the install media, you can check it with the following command.
lsblk
Insert the install media into the target PC to be set up and boot NixOS from the install media.
When you want to know more about the following commands, please refer to the NixOS Manual.
enter root
sudo -i
Networking in the installer
systemctl start wpa_supplicant
wpa_cli
> add_network
0
> set_network 0 ssid "myhomenetwork"
OK
> set_network 0 psk "mypassword"
OK
> set_network 0 key_mgmt WPA-PSK
OK
> enable_network 0
OK
...
(omitted)
> quit
Editing /etc/resolv.conf
nano /etc/resolv.conf
editing /etc/resolv.conf
following
nameserver 1.1.1.1
options edns0
Checking strage device
This command views available storage devices
In this case, the storage device name is described as nvme0n1
lsblk
Partitioning
parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- mkpart root ext4 512MB -8GB
parted /dev/nvme0n1 -- mkpart swap linux-swap -8GB 100%
parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB
parted /dev/nvme0n1 -- set 3 esp on
Formatting
mkfs.ext4 -L nixos /dev/nvme0n1p1
mkswap -L swap /dev/nvme0n1p2
mkfs.fat -F 32 -n boot /dev/nvme0n1p3
Installing
mount /dev/nvme0n1p1 /mnt
mkdir -p /mnt/boot
mount -o umask=077 /dev/nvme0n1p3 /mnt/boot
swapon /dev/nvme0n1p2
Generate configuration files
nixos-generate-config --root /mnt
Setup dotfiles
nix-env -i git
cd /etc
git clone --recursive https://github.com/Myxogastria0808/dotfiles.git
# Delete the original nixos directory.
rm -rf /etc/nixos
ln -s dotfiles nixos
Edit configuration.nix
if you change initial user password or user name
cf: This dotfiles's initial user password is sakura
cf: This dotfiles's user name is hello
editing configuration.nix
following
nano /mnt/etc/nixos/nixos/configuration.nix
(omitted)
...
users.users.<username> = {
...
(omitted)
...
# Genarate following commacnd: mkpasswd -m sha-512
initialHashedPassword="<hashed password>";
...
(omitted)
...
};
...
(omitted)
editing flake.nix
following
nano /mnt/etc/nixos/flake.nix
(omitted)
...
outputs = inputs: {
## home-manager ##
homeConfigurations = {
myHomeConfig = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = import inputs.nixpkgs {
system = "x86_64-linux";
# Enable unfee pkgs
config.allowUnfree = true;
overlays = [
inputs.nur.overlay
# inputs.rust-overlay.overlays.default
];
};
extraSpecialArgs = {
inherit inputs;
username = "<username>";
};
modules = [
./home/home.nix
# inputs.nixvim.homeManagerModules.nixvim
inputs.plasma-manager.homeManagerModules.plasma-manager
];
};
};
...
(omitted)
Install NixOS
cd /mnt/etc/nixos
nixos-install --flake .#nixos
Reboot
reboot now
run folowing commands
cd /home/<username>
git clone https://github.com/Myxogastria0808/dotfiles.git
cd dotfiles
ln -s /etc/nixos /home/hello/dotfiles
nix run home-manager -- switch --flake .#myHomeConfig
reboot
sudo reboot now
set other symbolic link
sudo ln -s /etc/nixos/home/config/zsh/oh-my-zsh $HOME/.config/oh-my-zsh
editing git.nix
following
nano /home/<usernmae>/dotfiles/home/config/git.nix
{ pkgs, ... }: {
home.packages = with pkgs; [
gh
];
programs.git = {
enable = true;
userName = "<github username>";
userEmail = "<github email>";
extraConfig = {
init.defaultBranch = "main";
credential."https://github.com".helper = "!gh auth git-credential";
};
};
}
login github
gh auth login
run tailscale up
Warning
If you are not tailscale user, you have to comment out services.tailscale.enable = true;
(configuration.nix
)
sudo tailscale up
run folowing command
hn
reboot
sudo reboot now
Warning
Please note that we have not checked the execution results of the following commands.
sh /etc/nixos/home/config/scripts/install-hm-nixos.sh
Reference Site
https://nixos.org/manual/nixos/stable/