Install NixOS, clone the repository inside /etc/nixos, create a configuration.nix
file pointing to the target machine configuration.
MACHINE='gonzalo-dell'
cat <<NIX >/etc/nixos/configuration.nix
{ config, pkgs, options, ... }: {
imports =
[
"/etc/nixos/machines/${MACHINE}.nix"
];
}
NIX
Run nixos-rebuild
to apply changes.
sudo nixos-rebuild switch --flake .#{hostname}
- https://blog.nobbz.dev/posts/2022-12-12-getting-inputs-to-modules-in-a-flake/
- https://www.youtube.com/watch?v=AGVXJ-TIv3Y
flake.nix
├─ ./configuration.nix
│ └─ machines/gonzalo-dell.nix
│ └─ machines/gonzalo-dell-hardware.nix
│ └─ modules/
│ │ ├─ virtualization.nix
│ │ └─ virtualbox.nix #not used
│ └─ system/
│ │ ├─ apps.nix # Stable Applications installed
│ │ ├─ unstable-apps.nix # Unstable Applications installed
│ │ └─ commons.nix
│ └─ declaratives/
│ │ ├─ unstable.nix # to make unstable available
│ │ └─ python.nix # not used
│
├─ ./cachix.nix
├─ ./cachix/
│ └─getseadaltas.nix
│
└─ ./home
├─ zsh.nix
├─ discord.nix
├─ vscode.nix
└─ git.nix
setfacl -Rm u:[user]:rwx /etc/nixos/
code /etc/nixos
- How to manage channels and paths in flakes: https://ayats.org/blog/channels-to-flakes
- How to manage multiple inputs in flakes: https://blog.nobbz.dev/posts/2022-12-12-getting-inputs-to-modules-in-a-flake/
- How to manage multiple inputs in flakes with overlays: nix-community/home-manager#1538
- How to start and understand flakes: https://www.youtube.com/watch?v=AGVXJ-TIv3Y
- Flakes first steps: https://blog.kubukoz.com/flakes-first-steps/
- Nix shells and nix Develop article: https://blog.ysndr.de/posts/guides/2021-12-01-nix-shells/
- Nix intro: https://ayats.org/blog/nix-intro
- Nix installation community: https://nix-community.github.io/home-manager/index.html#ch-nix-flakes
- nixpkgs vs import inputs: https://discourse.nixos.org/t/using-nixpkgs-legacypackages-system-vs-import/17462
- https://github.com/michaelpj/nixos-config
- https://github.com/JorelAli/nixos/blob/master/configuration.nix
- https://github.com/NobbZ/nixos-config
- https://github.com/MatthiasBenaets/
- https://github.com/viperML
- Move registry, nixPaths, homemanager to different modules. Can try out flakes.parts as well.
- Make cachix work to cache build.
- Move pkgs configuration to modules, as it's evil to pass it to nixosSystem: https://discourse.nixos.org/t/allowunfree-predicate-does-not-apply-to-self-packages/21734/37
- Update initial part of README.md