Giter Club home page Giter Club logo

nix-configs's Introduction

Installation

Install Nix (Linux and macOS) via one of the following installers

The following will install single-user on Linux and multi-user on macOS:

sh <(curl -L https://nixos.org/nix/install)

To install multi-user on Linux:

sh <(curl -L https://nixos.org/nix/install) --daemon

Enable Flakes by creating a file in ~/.config/nix/nix.conf and adding the following:

experimental-features = nix-command flakes

The following will install Nix on either Linux or macOS:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Flakes should already be enabled after install with this method

Clone Repo

nix-shell -P git # If you need access to git
git clone [email protected]:tlein/nix-configs.git ~/.nix-configs

Build Flake

Substitute macos-personal-laptop for current machine's configuration

On Darwin:

cd ~/.nix-configs
nix build ".#darwinConfigurations.macos-personal-laptop.system"
./result/sw/bin/darwin-rebuild switch --flake ".#macos-personal-laptop"

On NixOS:

cd ~/.nix-configs
nix build ".#nixosConfigurations.macos-personal-laptop.system"
sudo ./result/sw/bin/nixos-rebuild switch --flake ".#mac-ospersonal-laptop"

Updating

Updating flake.lock

If the flake.lock needs to be updated:

nix flake update

Rebuilding and Switching

To rebuild after making changes:

On Darwin

darwin-rebuild build --flake ".#macos-personal-laptop"
darwin-rebuild switch --flake ".#macos-personal-laptop"

On NixOS:

sudo nixos-rebuild build --flake ".#macos-personal-laptop"
sudo nixos-rebuild switch --flake ".#macos-personal-laptop"

Creating new configurations

  1. Create a new folder in the hosts folder with the name of the configuration.
  2. Inside that folder, create a configuration.nix with a NixOS or Darwin config, and a home.nix with a home manager config.
  3. Add a new configuration to either the nixosConfigurations or darwinConfigurations block of the flake.nix, specifying the system type, host (the name of the folder from step 1), and user (to install the home manager config to).

Devshell

This flake uses the devshell project to easily setup a dev environment when in this project's directory. It adds a few packages to the environment, as well as aliases to format, lint, and build various images.

To enter the devshell without direnv, run

nix develop

If you use direnv, it should become available anytime you are in the directory after running

direnv allow

nix-configs's People

Contributors

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