Giter Site home page Giter Site logo

nixcfg's Introduction

my nixos config

Despite the generalized documentation, this configuration is built and maintained only for my personal use.

Not everything is done "the Nix way". However, Nix provides me with the ability to spin up my personal/development environments on any of my systems with minimal effort, whether NixOS, Debian/other, and WSL2 or bare metal.

Installation

NixOS (System + Home Manager)

These instructions should be roughly the same for NixOS-WSL and pure NixOS.

Install NixOS

WSL2

Download and import a NixOS tarball into WSL2. I used this one but I think it's also possible to build your own.

wsl --import <distro-name> <install-path> <tarball-path>
Setup the configuration

In NixOS, clone the repo:

nix-shell -p git --run 'git clone https://github.com/nomnivore/nixcfg ~/nixcfg'
cd ~/nixcfg

Switch to the new configuration:

sudo nixos-rebuild switch --flake .#nixos

As an alternative, you can also use this command to build from the remote repo:

sudo nixos-rebuild switch --flake github:nomnivore/nixcfg#nixos

#nixos can be substituted with another flake output to build a different system, or omitted to match your system's hostname.

If you're on WSL2, you'll need to run these commands instead:

sudo nixos-rebuild boot --flake .#nixos

In PowerShell:

wsl -t <distro-name>
wsl -d <distro-name> --user root exit
wsl -t <distro-name>

Then in NixOS, copy over the config repo and remove the default user directory:

cd ~
cp -r /home/nixos/nixcfg ~/nixcfg
sudo rm -rf /home/nixos

ref: https://nix-community.github.io/NixOS-WSL/how-to/change-username.html

All done! ✨

Other distros (Home Manager)

Tested to work on Ubuntu/Debian, but should work on nearly any distro.

Install Nix

Install Nix according to these instructions: https://nix.dev/install-nix

You may need to ensure you have curl and xz-utils to run the install script.

Debian with APT:

sudo apt-get install curl xz-utils

On WSL2 with systemd enabled:

curl -L https://nixos.org/nix/install | sh -s -- --daemon \
&& exec $SHELL

You can verify the installation by running:

nix --version

Install Home Manager

Official Instructions

Add the channel for home-manager that matches the version in flake.nix:

nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz home-manager
nix-channel --update

Install:

nix-shell '<home-manager>' -A install

Clone and switch

Clone the repo:

nix-shell -p git --run 'git clone https://github.com/nomnivore/nixcfg ~/nixcfg'
cd ~/nixcfg

Use Home Manager to switch to the desired user environment:

home-manager switch --flake .#USER \
  --extra-experimental-features nix-command \
  --extra-experimental-features flakes

The build/install process may take some time and unpack over 10GB of data.

You might need to change your default shell for the best experience:

echo $(which zsh) | sudo tee -a /etc/shells
chsh -s $(which zsh)
exec zsh

All done! ✨

nixcfg's People

Contributors

nomnivore avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.