{"id":14967941,"url":"https://github.com/matthiasbenaets/nix-config","last_synced_at":"2025-05-15T11:03:02.908Z","repository":{"id":37234565,"uuid":"455680411","full_name":"MatthiasBenaets/nix-config","owner":"MatthiasBenaets","description":"My Personal Nix, NixOS and Nix-Darwin System Configuration Flake","archived":false,"fork":false,"pushed_at":"2025-04-07T06:38:43.000Z","size":40753,"stargazers_count":680,"open_issues_count":0,"forks_count":61,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-07T09:11:08.463Z","etag":null,"topics":["dotfiles","flake","home-manager","nix","nix-darwin","nixos"],"latest_commit_sha":null,"homepage":"https://www.youtube.com/watch?v=AGVXJ-TIv3Y","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MatthiasBenaets.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-04T20:02:14.000Z","updated_at":"2025-04-07T06:38:47.000Z","dependencies_parsed_at":"2024-07-17T18:29:35.970Z","dependency_job_id":"ba7c1495-ffd1-41d7-99f7-353231be1ce7","html_url":"https://github.com/MatthiasBenaets/nix-config","commit_stats":{"total_commits":270,"total_committers":5,"mean_commits":54.0,"dds":"0.014814814814814836","last_synced_commit":"39e08efb17f2e4e2e099421a4f7dafbe63eafbd9"},"previous_names":["matthiasbenaets/nix-config"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthiasBenaets%2Fnix-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthiasBenaets%2Fnix-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthiasBenaets%2Fnix-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthiasBenaets%2Fnix-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatthiasBenaets","download_url":"https://codeload.github.com/MatthiasBenaets/nix-config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248912415,"owners_count":21182274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotfiles","flake","home-manager","nix","nix-darwin","nixos"],"created_at":"2024-09-24T13:38:57.817Z","updated_at":"2025-04-14T15:55:21.142Z","avatar_url":"https://github.com/MatthiasBenaets.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+title: Matthias' NixOS \u0026 Nix-Darwin System Configuration Flake\n#+description: General information about my flake and how to set it up\n#+author: Matthias Benaets\n\n#+attr_org: :width 600\n[[file:rsc/Header.svg]]\n\n* Table of Content\n:PROPERTIES:\n:TOC:      :include all :depth 2 :force (depth) :ignore (this)\n:END:\n:CONTENTS:\n- [[#system-components][System Components]]\n- [[#nixos-installation-guide][NixOS Installation Guide]]\n- [[#nix-installation-guide][Nix Installation Guide]]\n- [[#nix-darwin-installation-guide][Nix-Darwin Installation Guide]]\n- [[#guides][Guides]]\n- [[#faq][FAQ]]\n:END:\n\n* System Components\n|                 | *NixOS - Wayland* | *NixOS - Wayland/Xorg* | *NixOS - Xorg*   | *Darwin*                |\n|-----------------+-------------------+------------------------+------------------+-------------------------|\n| *DM*            | /                 | GDM                    | LightDM          | /                       |\n| *WM/DE*         | Hyprland          | Gnome                  | Bspwm            | AeroSpace               |\n| *Compositor*    | Hyprland          | Mutter                 | Picom (jonaburg) | /                       |\n| *Bar*           | Eww + Waybar      | /                      | Polybar          | /                       |\n| *Hotkeys*       | Hyprland          | /                      | Sxhkd            | Raycast                 |\n| *Launcher*      | Wofi              | Gnome                  | Rofi             | Raycast                 |\n| *GTK Theme*     | Orchis-Dark       | Adwaita                | Orchis-Dark      | /                       |\n| *Notifications* | Swaync            | Gnome                  | Dunst            | /                       |\n| *Terminal*      | Kitty             | Kitty                  | Kitty            | Kitty                   |\n| *Used by host*  | Beelink, XPS      | Work                   | VM \u0026 Probook     | MacBook{Intel, AirM1, AirM3} |\n\nThere are some other desktop environments/window manager (See NixOS - Other). Just link to correct ~default/home.nix~ in ~./hosts/\u003chost\u003e/default and home.nix~.\nThere is also a general Nix config with hostname ~pacman~ that can be used on pretty much any disto.\n\nComponents relevant to all hosts:\n| *Shell*    | Zsh    |\n| *Terminal* | Kitty  |\n| *Editors*  | Neovim |\n\n* NixOS Installation Guide\nThis flake currently has *3* host setups\n 1. Beelink \u0026 XPS\n    - UEFI boot w/ systemd-boot\n 2. Work \u0026 Probook\n    - UEFI boot w/ grub\n 4. vm\n    - Legacy boot w/ grub\n\nFlakes can be build with:\n- ~$ sudo nixos-rebuild switch --flake \u003cpath\u003e#\u003chostname\u003e~\n- example ~$ sudo nixos-rebuild switch --flake .#desktop~\n\n** Partitioning\nThis will depend on the host chosen.\n*** UEFI\n*In these commands*\n- Partition Labels:\n  - Boot = \"boot\"\n  - Home = \"nixos\"\n- Partition Size:\n  - Boot = 512MiB\n  - Swap = 8GiB\n  - Home = Rest\n- No Swap: Ignore line 3 \u0026 7\n\n#+begin_src\n  # parted /dev/sda -- mklabel gpt\n  # parted /dev/sda -- mkpart primary 512MiB -8GiB\n  # parted /dev/sda -- mkpart primary linux-swap -8GiB 100%\n  # parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB\n  # parted /dev/sda -- set 3 esp\n  # mkfs.ext4 -L nixos /dev/sda1\n  # mkswap -L /dev/sda2\n  # mkfs.fat -F 32 -n boot /dev/sda3\n#+end_src\n\n*** Legacy\n*In these commands*\n- Partition Label:\n  - Home \u0026 Boot = \"nixos\"\n  - Swap = \"swap\"\n- Partition Size:\n  - Swap = 8GiB\n  - Home = Rest\n- No swap: Ignore line 3 and 5\n\n#+begin_src\n  # parted /dev/sda -- mklabel msdos\n  # parted /dev/sda -- mkpart primary 1MiB -8GiB\n  # parted /dev/sda -- mkpart primary linux-swap -8GiB 100%\n  # mkfs.ext4 -L nixos /dev/sda1\n  # mkswap -L /dev/sda2\n#+end_src\n\n** Installation\n*** UEFI\n*In these commands*\n- Mount partition with label ... on ...\n  - \"nixos\" -\u003e ~/mnt~\n  - \"boot\" -\u003e ~/mnt/boot~\n#+begin_src\n  # mount /dev/disk/by-label/nixos /mnt\n  # mkdir -p /mnt/boot\n  # mount /dev/disk/by-label/boot /mnt/boot\n#+end_src\n\n*** Legacy\n#+begin_src\n  # mount /dev/disk/by-label/nixos /mnt\n#+end_src\n\n*** Mounting Extras\n*In these commands*\n  - ~/mnt/ssd~\n- Label of storage:\n  - ssd2\n- If storage has no label:\n  - ~mount /dev/disk/by-uuid/ssd2 /mnt/ssd~\n#+begin_src\n  # mkdir -p /mnt/ssd\n  # mount /dev/disk/by-label/ssd2 /mnt/ssd\n#+end_src\n\n*** Generate\n*In these commands*\n- Swap is enable:\n  - Ignore if no swap or enough RAM\n- Configuration files are generated @ ~/mnt/etc/nixos~\n  - If you are me, you don't need to do this. Hardware-configuration.nix already in flake.\n- Clone repository\n#+begin_src\n  # swapon /dev/sda2\n  # nixos-generate-config --root /mnt\n  # nix-env -iA nixos.git\n  # git clone https://github.com/matthiasbenaets/nixos-config /mnt/etc/nixos/\u003cname\u003e\n\n  Optional if you are not me\n  # cp /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/nixos-config/hosts/\u003chost\u003e/.\n#+end_src\n\n*** Possible Extra Steps\n1. Switch specific host hardware-configuration.nix with generated ~/mnt/etc/nixos/hardware-configuration.nix~\n2. Change existing network card name with the one in your system\n   - Look in generated hardware-configuration.nix\n   - Or enter ~$ ip a~\n3. Change username in flake.nix\n4. Set a ~users.users.${user}.initialPassword = ...~\n   - Not really recommended. It's maybe better to follow last steps\n5. If you are planning on using the doom-emacs alternative home.nix, don't forget to rebuild after the initial installation when you link to this nix file.\n   - This is because userActivationScript is used for this setup and this will time out during the rebuild.\n   - It will automatically install if ~$HOME/.emacs.d~ does not exist\n     - If this dir already exist, move or delete it.\n\n*** Install\n*In these commands*\n- Move into cloned repository\n  - in this example ~/mnt/etc/nixos/\u003cname\u003e~\n- Available hosts:\n  - desktop\n  - laptop\n  - vm\n#+begin_src\n  # cd /mnt/etc/nixos/\u003cname\u003e\n  # nixos-install --flake .#\u003chost\u003e\n#+end_src\n\n** Finalization\n1. Set a root password after installation is done\n2. Reboot without liveCD\n3. Login\n   1. If initialPassword is not set use TTY:\n      - ~Ctrl - Alt - F1~\n      - login as root\n      - ~# passwd \u003cuser\u003e~\n      - ~Ctrl - Alt - F7~\n      - login as user\n4. Optional:\n   - ~$ sudo mv \u003clocation of cloned directory\u003e \u003cprefered location\u003e~\n   - ~$ sudo chown -R \u003cuser\u003e:users \u003cnew directory location\u003e~\n   - ~$ sudo rm /etc/nixos/configuration.nix~ - This is done because in the past it would auto update this config if you would have auto update in your configuration.\n   - or just clone flake again do apply same changes.\n5. Dual boot:\n   - OSProber probably did not find your Windows partition after the first install\n   - There is a high likelihood it will find it after:\n     - ~$ sudo nixos-rebuild switch --flake \u003cconfig path\u003e#\u003chost\u003e~\n6. Rebuilds:\n   - ~$ sudo nixos-rebuild switch --flake \u003cconfig path\u003e#\u003chost\u003e~\n   - For example ~$ sudo nixos-rebuild switch --flake ~/.setup#matthias~\n\n* Nix Installation Guide\nThis flake currently has *1* host\n  1. pacman\n\nThe Linux distribution must have the nix package manager installed.\n~$ sh \u003c(curl -L https://nixos.org/nix/install) --daemon~\nTo be able to have an easy reproducible setup when using the nix package manager on a non-NixOS system, home-manager is a wonderful tool to achieve this.\nSo this is how it is set up in this flake.\n\n** Installation\n*** Initial\n*In these commands*\n- Get git\n- Clone repository\n- First build of the flake\n  - This is done so we can use the home-manager command is part of PATH.\n\n#+begin_src\n  $ nix-env -iA nixpkgs.git\n  $ git clone https://github.com/matthiasbenaets/nixos-config ~/.setup\n  $ cd ~/.setup\n  $ nix build --extra-experimental-features 'nix-command flakes' .#homeConfigurations.\u003chost\u003e.activationPackage\n  $ ./result/activate\n#+end_src\n\n*** Rebuild\nSince home-manager is now a valid command we can rebuild the system using this command. In this example it is build from inside the flake directory:\n- ~$ home-manager switch --flake \u003cconfig path\u003e#\u003chost\u003e~\nThis will rebuild the configuration and automatically activate it.\n\n** Finalization\n*Mostly optional or already correct by default*\n1. NixGL gets set up by default, so if you are planning on using GUI applications that use OpenGL or Vulkan:\n   - ~$ nixGLIntel \u003cpackage\u003e~\n   - or add it to your aliases file\n2. Every rebuild, and activation-script will run to add applications to the system menu.\n   - it's pretty much the same as adding the path to XDG_DATA_DIRS\n   - if you do not want to or if the locations are different, change this.\n\n* Nix-Darwin Installation Guide\nThis flake currently has *1* host\n  1. macbook\n\nThe Apple computer must have the nix package manager installed.\nIn terminal run command: ~$ sh \u003c(curl -L https://nixos.org/nix/install)~\n\n** Setup\n*In these commands*\n- Create a nix config directory\n- Allow experimental features to use flakes\n\n#+begin_src\n  $ mkdir ~/.config/nix\n  $ echo \"experimental-features = nix-command flakes\" \u003e\u003e ~/.config/nix/nix.conf\n#+end_src\n\n** Installation\n*** Initial\n*In these commands*\n- Get git\n- Clone repository\n- First build of the flake on Darwin\n  - This is done because the darwin command is not yet available\n\n#+begin_src\n  $ nix-env -iA nixpkgs.git\n  $ git clone https://github.com/matthiasbenaets/nixos-config ~/.setup\n  $ cd ~/.setup\n  $ nix build .#darwinConfigurations.\u003chost\u003e.system\n  $ ./result/sw/bin/darwin-rebuild switch --flake .#\u003chost\u003e\n#+end_src\n\n~/result~ is located depending on where you build the system.\n\n*** Rebuild\nSince darwin is now added to the PATH, you can build it from anywhere in the system. In this example it is rebuilt from inside the flake directory:\n- ~$ darwin-rebuild switch --flake .#\u003chost\u003e~\nThis will rebuild the configuration and automatically activate it.\n\n** Finalization\n*Mostly optional or already correct by default*\n1. Change default shell for Terminal or iTerm.\n   - ~Terminal/iTerm \u003e Preferences \u003e General \u003e Shells open with: Command \u003e /bin/zsh~\n2. Disable Secure Keyboard Entry. Needed for Skhd.\n   - ~Terminal/iTerm \u003e Secure Keyboard Entry~\n3. Install XCode to get complete development environment.\n   - ~$ xcode-select --install~\n\n* Guides\n- [[./nixos.org][NixOS general guide]]\n- [[./nix.org][Nix on other Linux distributions]]\n- [[./darwin.org][Nix on MacOS with Nix-Darwin]]\n- [[./contrib.org][Contribution to nixpkgs]]\n- [[./shell.org][Using nix shells]]\n\n* FAQ\n- What is NixOS?\n  - NixOS is a Linux distribution built on top of the Nix package manager.\n  - It uses declarative configurations and allow reliable system upgrades.\n- What is a Flake?\n  - Flakes are an upcoming feature of the Nix package manager.\n  - Flakes allow you to specify your major code dependencies in a declarative way.\n  - It does this by creating a flake.lock file. Some major code dependencies are:\n    - nixpkgs\n    - home-manager\n- What is Nix-Darwin?\n  - Nix-Darwin is a way to use Nix modules on macOS using the Darwin Unix-based core set of components.\n  - Just like NixOS, it allows to build declarative reproducible configurations.\n- Should I switch to NixOS?\n  - Is water wet?\n- Where can I learn about everything Nix?\n  - Nix and NixOS\n    - [[file:nixos.org][My General Setup Guide]]\n    - [[https://nixos.org/][Website]]\n    - [[https://nixos.org/learn.html][Manuals]]\n    - [[https://nixos.org/manual/nix/stable/introduction.html][Manual 2]]\n    - [[https://search.nixos.org/packages][Packages]] and [[https://search.nixos.org/options?][Options]]\n    - [[https://wiki.nixos.org/][Official Wiki]]\n    - [[https://wiki.nixos.org/wiki/Resources][Wiki Resources]]\n    - [[https://nixos.org/guides/nix-pills/][Nix Pills]]\n    - [[https://www.ianthehenry.com/posts/how-to-learn-nix/][Some]] [[https://christine.website/blog][Blogs]]\n    - [[https://wiki.nixos.org/wiki/Configuration_Collection][Config Collection]]\n  - Home-manager\n    - [[https://github.com/nix-community/home-manager][Official Repo]]\n    - [[https://nix-community.github.io/home-manager/][Manual]]\n    - [[https://nix-community.github.io/home-manager/options.xhtml][Appendix A Nix]]\n    - [[https://nix-community.github.io/home-manager/nixos-options.xhtml][Appendix B HM]]\n    - [[https://nix-community.github.io/home-manager/nix-darwin-options.xhtml][Appendix C Darwin]]\n    - [[https://wiki.nixos.org/wiki/Home_Manager][NixOS wiki]]\n  - Flakes\n    - [[https://wiki.nixos.org/wiki/Flakes][NixOS wiki]]\n    - [[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html][Manual]]\n    - [[https://www.tweag.io/blog/2020-05-25-flakes/][Some]] [[https://christine.website/blog/nix-flakes-3-2022-04-07][Blogs]]\n  - Nix-Darwin\n    - [[file:darwin.org][My General Setup Guide]]\n    - [[https://github.com/LnL7/nix-darwin/][Official Repo]]\n    - [[https://daiderd.com/nix-darwin/manual/index.html][Manual]]\n    - [[https://github.com/LnL7/nix-darwin/wiki][Mini-Wiki]]\n  - Videos\n    - [[https://youtu.be/AGVXJ-TIv3Y][My Personal Mini-Course]]\n    - [[https://www.youtube.com/watch?v=QKoQ1gKJY5A\u0026list=PL-saUBvIJzOkjAw_vOac75v-x6EzNzZq][Wil T's Playlist]]\n    - [[https://www.youtube.com/watch?v=NYyImy-lqaA\u0026list=PLRGI9KQ3_HP_OFRG6R-p4iFgMSK1t5BHs][Burke Libbey's Nixology]]\n    - [[https://www.youtube.com/user/elitespartan117j27/videos][John Ringer's Channel]]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthiasbenaets%2Fnix-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthiasbenaets%2Fnix-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthiasbenaets%2Fnix-config/lists"}