nix-config
nix-config copied to clipboard
NixOS/NixOS-WSL/nix-darwin configuration using Nix Flakes and flake-parts
#+TITLE: [[https://nixos.org][NixOS]] configuration #+AUTHOR: fortuneteller2k #+STARTUP: showeverything
[[assets/nixos-official-logo.png]]
[[https://github.com/nixos/nixpkgs][file:https://img.shields.io/badge/NixOS-22.11-informational?style=flat.svg]]
[[https://github.com/fortuneteller2k/nix-config/actions/workflows/check.yml][https://github.com/fortuneteller2k/nix-config/actions/workflows/check.yml/badge.svg]] [[https://github.com/fortuneteller2k/nix-config/actions/workflows/statix.yml][https://github.com/fortuneteller2k/nix-config/actions/workflows/statix.yml/badge.svg]] [[https://github.com/fortuneteller2k/nix-config/actions/workflows/format.yml][https://github.com/fortuneteller2k/nix-config/actions/workflows/format.yml/badge.svg]]
** Installation
(I highly recommend making your own configuration and copy snippets from mine, but anyway...)
Get the latest NixOS 22.05 image [[https://releases.nixos.org/?prefix=nixos/unstable/][here]], do your partitions (root must be mounted at =/mnt=), then run the following commands: #+begin_src sh
move the output file of this to hosts/*/hardware-configuration.nix
nixos-generate-config
nix-shell -p git nixUnstable git clone https://github.com/fortuneteller2k/nix-config ~ cd ~/nix-config sudo nixos-install --flake '.#superfluous'
After rebooting
home-manager switch --flake '.#moni' #+end_src
For WSL, follow the [[https://github.com/nix-community/NixOS-WSL#quick-start][quickstart guide]], then run the following commands: #+begin_src sh nix shell nixpkgs#git git clone https://github.com/fortuneteller2k/nix-config ~ cd ~/nix-config sudo nixos-rebuild switch --flake '.#turncoat' home-manager switch --flake '.#zero' #+end_src
*** Caveats
- You probably should replace [[https://github.com/fortuneteller2k/nix-config/blob/master/hosts/superfluous/hardware-configuration.nix][hosts/superfluous/hardware-configuration.nix]] with your own with =nixos-generate-config=.
- You might want to change all instances of my username to yours.
- Comment out every =__contentAddressed = true;= in =hosts=.
- You might want to disable =agenix=, for my secret cannot be decrypted without my private key. See [[https://github.com/fortuneteller2k/nix-config/blob/master/hosts/superfluous/default.nix][hosts/superfluous/default.nix]] and [[https://github.com/fortuneteller2k/nix-config/blob/master/users/moni/config/zsh/default.nix][users/moni/config/zsh/default.nix]].
** Description
NixOS configuration that I use daily, it contains the system-wide and home configuration, symlinked to =/etc/nixos=.
See also:
- [[https://github.com/nix-community/home-manager][home-manager]]
- [[https://nixos.wiki/wiki/Flakes][flakes]]
- [[https://github.com/fortuneteller2k/nixpkgs-f2k][nixpkgs-f2k]], my package collection
- [[https://github.com/nix-community/NixOS-WSL][NixOS-WSL]], for =hosts/turncoat=
Resources and configurations I used to base on:
- [[https://github.com/colemickens/nixos-flake-example][colemickens/nixos-flake-example]]
- [[https://git.sr.ht/~dunklecat/nixos-config/tree/master/flake.nix][dunklecat/nixos-config]]
- [[https://www.youtube.com/watch?v=UeBX7Ide5a0][Nix Flakes talk by Eelco Dolstra on NixCon]]
*** Why flakes?
[[https://github.com/jonringer][jonringer]] gave a [[https://discourse.nixos.org/t/what-are-nix-flakes-and-why-should-i-care/12910/3][brief explanation]] as to why one might want to use Nix flakes.
** Appearance
[[assets/starcruiser.png]] [[assets/turncoat.png]]