Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/moni-dz/nix-config

NixOS/NixOS-WSL/nix-darwin configuration using Nix Flakes and flake-parts
https://github.com/moni-dz/nix-config

agenix flake-parts nix nix-config nix-darwin nix-dotfiles nix-flakes nixos nixos-configuration sway wsl wsl2

Last synced: 2 months ago
JSON representation

NixOS/NixOS-WSL/nix-darwin configuration using Nix Flakes and flake-parts

Awesome Lists containing this project

README

        

#+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-24.05-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 24.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 .#starcruiser

# After rebooting
home-manager switch --flake .#moni@starcruiser
#+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@turncoat
#+end_src

*** Caveats

* You probably should replace [[https://github.com/fortuneteller2k/nix-config/blob/master/hosts/starcruiser/hardware-configuration.nix][hosts/starcruiser/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;= you find.
* 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/default.nix][hosts/default.nix]].

** Description

NixOS/nix-darwin/home-manager configuration that I use daily.

See also:
* [[https://github.com/nix-community/home-manager][home-manager]]
* [[https://nixos.wiki/wiki/Flakes][flakes]]
* [[https://flake.parts][flake-parts]], for the flake modules at [[https://github.com/fortuneteller2k/nix-config/blob/master/modules/parts][modules/parts]]
* [[https://github.com/fortuneteller2k/nixpkgs-f2k][nixpkgs-f2k]], my package collection
* [[https://github.com/LnL7/nix-darwin][nix-darwin]], for =hosts/riscake=
* [[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://nixos.wiki/wiki/NixOS_modules][NixOS modules on NixOS Wiki]]
* [[https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules][Writing NixOS modules]]
* [[https://www.youtube.com/watch?v=UeBX7Ide5a0][Nix Flakes talk by Eelco Dolstra on NixCon]]
* [[https://flake.parts/module-arguments.html][flake.parts module arguments]]

*** 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.

*** Why =flake-parts=?

=flake-parts= allow reusable configuration powered by the module system everyone knows and loves.

See [[https://github.com/fortuneteller2k/nix-config/blob/master/modules/parts][modules/parts]], and it's implementation in [[https://github.com/fortuneteller2k/nix-config/blob/master/hosts/default.nix][my system configurations]] and [[https://github.com/fortuneteller2k/nix-config/blob/master/users/default.nix][my home configurations]].

** Appearance

[[assets/starcruiser.png]]
[[assets/turncoat.png]]