Skip to content

luochen1990/nixos-config

Repository files navigation

My NixOS

Suppose you choosed to use a profile named "pocket-nixos":

cd /path/of/dir/which/contains/flake-dot-nix
nixos-rebuild switch --flake .#pocket-nixos

Bootstrap

Since flake is not supported by default yet, we might need to build a NixOS version which support flake first.

ln -s /path/to/this/repo/profiles/bootstrap/configuration.nix /etc/nixos/configuration.nix

To be more complete, this bootstrap NixOS provides following supports:

  1. offline nixos & nixpkgs manual
  2. nix flake support so you can run nixos-rebuild switch --flake
  3. visit Internet to download packages and clone repos
  4. debug network issue
  5. IM (telegram) client to get help from community

Directory Structure

├── flake.nix                           # entrypoint as a Nix Flake
├── profiles/                           # each subdirectory of `profiles/` contains a profile
│   ├── example-nixos/                  # the directory name implies `profileName`
│   │   ├── configuration.nix           # this file import mods from `common/` and `facts/` to get a full configuration of NixOS
│   │   └── hardware-configuration.nix  # the file generated by `sudo nixos-generate-config --show-hardware-config`
├── fact/                               # each subdirectory of fact/ contains facts of a specific aspect
│   ├── user/                           # config for specific user
│   ├── network/                        # config for specific network environment
│   ├── device/                         # config for specific hardware device (monitor, cpu, gpu etc.)
│   └── storage/                        # config for specific disk
├── common/                             # general things that works for everyone
└── README.md

naming rules:

  • configuration.nix: NixOS Configuration (See man configuration.nix)
  • *.mod.nix: NixOS Module (See man configuration.nix) to be imported by configuration.nix
  • *.drv.nix: Nix Derivation to be used by nix-build
  • *.pkg.nix: argument of callPackage

Troubleshooting

If there is problem when logging into GUI system, try add this line to disable wayland:

programs.sway.enable = false

And also try to disable sddm to use lightdm

services.xserver.displayManager.sddm.enable = false;

If there is following error message when you type a command which havn't installed yet:

unable to open database file at /run/current-system/sw/bin/command-not-found

type execute following command to fix it:

sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
sudo nix-channel --update

and confirm it with:

command-not-found hello

(or replace hello with some else command which haven't installed yet)

About

LC's personal NixOS Configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages