Skip to content
/ simple-flake Public template

Setup a flake with home manager using your current configuration.nix

Notifications You must be signed in to change notification settings

fndov/simple-flake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

This flake is designed to be setup using your current configuration.nix.

Benefits of flakes include:

  • A start to code organization
  • Version locking
  • Full reproducibility

Import flow

┌─ flake.nix           (Start)
├─ flake.lock          (Version locking)
├─ configuration.nix   (System configuration)
└─ home.nix            (Home Manager configuration)

Setup

git clone https://github.com/fndov/simple-flake ~/.flake && rm -rf ~/.flake/.git
cp /etc/nixos/configuration.nix ~/.flake/configuration.nix
cp /etc/nixos/hardware-configuration.nix ~/.flake/hardware.nix

Take out the import section for hardware-configuration.nix at the top (the flake does this for you now)

nano ~/.flake/configuration.nix

Input your name

nano ~/.flake/home.nix

Commands

sudo nixos-rebuild switch --flake ~/.flake#home

nixos-rebuild has a few options:

  • switch : switches to the new configuration immediately
  • boot : builds the next generation but does not switch until reboot
  • dry-run : only evaluates the code to see if it works
  • test : switches to the new generation but does not save it to the boot menu
sudo nixos-rebuild switch --flake ~/.flake#home --rollback

Rolls back to the previous generation.

sudo nix-collect-garbage

Deletes all previous generations so you don't run out of space.

sudo nix flake update --flake ~/.flake

Update system.

nix-shell -p cowsay

Installs software to the shell (not the system) and is discarded when the shell (terminal) is closed.

Important links:

How to setup NVIDIA
Copy paste to configuration.nix and add config to { ... }: => { config, ... }:

  hardware.nvidia.open = false;
  hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.production;
  boot.blacklistedKernelModules = [ "nouveau" ];
  services.xserver.videoDrivers = [ "nvidia" ];
  boot.kernelParams = [
    "nvidia_drm"
    "nvidia_modeset"
    "nvidia_uvm"
    "nvidia-drm.fbdev=1"
    "nvidia"
  ];

NixOS packages

NixOS options

Home manager options

About

Setup a flake with home manager using your current configuration.nix

Resources

Stars

Watchers

Forks

Languages