• Stars
    star
    171
  • Rank 222,266 (Top 5 %)
  • Language
    Nix
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kickstart your Nix environment.

kickstart.nix

Kickstart your Nix environments.

Test flake Test home-manager Test languages Test systems

kickstart.nix

Guides

Templates

Guides

Setup Linux

Guide for setting up Nix on non-NixOS based Linux systems.

  1. Install nixpkgs with official script:

Note

The offical docs suggest using daemon mode to install with this approach. Nix currently does not support SELINUX enabled.

sh <(curl -L https://nixos.org/nix/install) --daemon
  1. Edit /etc/nix/nix.conf to enable the following settings:
experimental-features = nix-command flakes
  1. Create a new directory for your flake.nix configuration:
mkdir -p ~/kickstart.nix
cd ~/kickstart.nix
  1. Using nix flake init generate the kickstart.nix template locally:
nix flake init -t github:ALT-F4-LLC/kickstart.nix#home-manager
  1. Update following value(s) in flake.nix configuration:

Important

Both homeDirectory and username must be updated with your user home directory and username. Once updated, remove throw before each value to remove errors while switching.

homeManagerModule = import ./module/home-manager.nix {
  homeDirectory = throw "<enter homeDirectory in flake.nix>"; # TODO: home directory of the user
  username = throw "<enter username in flake.nix>"; # TODO: username of the user
};
  1. Run home-manager from nixpkgs to build and switch environments:

Important

This template supports the following systems: aarch64-darwin, aarch64-linux, x86_64-darwin and x86_64-linux.

# for ARM systems running macOS
nix run nixpkgs#home-manager -- build --flake .#aarch64-darwin
nix run nixpkgs#home-manager -- switch --flake .#aarch64-darwin

# for ARM systems running Linux
nix run nixpkgs#home-manager -- build --flake .#aarch64-linux
nix run nixpkgs#home-manager -- switch --flake .#aarch64-linux

# for Intel systems running macOS
nix run nixpkgs#home-manager -- build --flake .#x86_64-darwin
nix run nixpkgs#home-manager -- switch --flake .#x86_64-darwin

# for Intel systems running Linux
nix run nixpkgs#home-manager -- build --flake .#x86_64-linux
nix run nixpkgs#home-manager -- switch --flake .#x86_64-linux

Congrats! You've setup Home Manager on your existing operating system!

Be sure to explore the files below to get started customizing:

  • module/home-manager.nix for Home Manager related settings
  • flake.nix for flake related settings

Setup macOS

Guide for setting up Nix on macOS based systems.

  1. Install nixpkgs with official script:
sh <(curl -L https://nixos.org/nix/install)
  1. Install nix-darwin with official steps:
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer
  1. Answer the following with y to edit your default configuration.nix file:
Would you like to edit the default configuration.nix before starting? [y/n] y
  1. Add the following to configuration.nix to enable nix-command and flakes features:
nix.settings.experimental-features = [ "nix-command" "flakes" ];
  1. Answer the following with y to setup <darwin> in nix-channel (though it won't be used):
Would you like to manage <darwin> with nix-channel? [y/n] y
  1. Create a new directory for your flake.nix configuration:
mkdir -p ~/kickstart.nix
cd ~/kickstart.nix
  1. Using nix flake init generate the kickstart.nix template locally:
nix flake init -t github:ALT-F4-LLC/kickstart.nix#darwin
  1. Update the following value(s) in flake.nix configuration:

Important

The username value must be updated with your system username. Once updated, remove throw to remove error while switching.

let
    username = throw "<username>"; # TODO: replace with user name and remove throw 
in
  1. Switch to kickstart.nix environment for your system with flake configuration:
darwin-rebuild switch --flake ".#aarch64" # M Series Chipsets
darwin-rebuild switch --flake ".#x86_64" # Intel Chipsets

Congrats! You've setup Nix with Home Manager on macOS!

Be sure to explore the files below to get started customizing:

  • system/darwin.nix for all nix-darwin related settings
  • module/configuration.nix for Nix related settings
  • module/home-manager.nix for Home Manager related settings
  • flake.nix for flake related settings

Setup NixOS

Guide for setting up NixOS based systems.

  1. Install NixOS using the latest ISO image for your system.

  2. Add the following to /etc/nixos/configuration.nix to enable nix-command and flakes features:

nix.extraOptions = "experimental-features = nix-command flakes";
  1. Update you system to reflect the changes:
sudo nixos-rebuild test
sudo nixos-rebuild switch
  1. Create a new directory for your flake.nix configuration:
mkdir -p ~/kickstart.nix
cd ~/kickstart.nix
  1. Using nix flake init generate the kickstart.nix template of your choice locally:
nix flake init -t github:ALT-F4-LLC/kickstart.nix#nixos-desktop
nix flake init -t github:ALT-F4-LLC/kickstart.nix#nixos-minimal
  1. Update the following value(s) in flake.nix configuration:
  • For desktop flake template:

Important

Both username and password must be updated with your user username. Once updated, remove throw before each value to remove errors while switching. If you'd rather use a hashed password replace password with hashedPassword with your password hash.

let
    nixos-system = import ./system/nixos.nix {
        inherit inputs;
        username = throw "<username>"; # REQUIRED: replace with user name and remove throw
        password = throw "<password>"; # REQUIRED: replace with password and remove throw
        desktop = "gnome"; # optional: "gnome" by default, or "plasma5" for KDE Plasma
    };
in
  • For minimal flake template:
let
    nixos-system = import ./system/nixos.nix {
        inherit inputs;
        username = throw "<username>"; # REQUIRED: replace with user name and remove throw
        password = throw "<password>"; # REQUIRED: replace with password and remove throw
    };
in
  1. Switch to kickstart.nix environment for your system with flake configuration:

Important

We use --impure due to how /etc/nixos/hardware-configuration.nix is generated and stored on the system after installation. To avoid using this flag, copy hardware-configuration.nix file locally and replace import in the template see example.

  • For aarch64 platforms:
sudo nixos-rebuild test --flake ".#aarch64" --impure # M Series Chipsets
sudo nixos-rebuild switch --flake ".#aarch64" --impure # M Series Chipsets
  • For x86_64 platforms:
sudo nixos-rebuild test --flake ".#x86_64"  --impure # Intel Chipsets
sudo nixos-rebuild switch --flake ".#x86_64" --impure # Intel Chipsets

Congrats! You've setup NixOS with Home Manager!

Be sure to explore the files below to get started customizing:

  • module/configuration.nix for more NixOS system related settings
  • module/home-manager.nix for Home Manager related settings
  • system/nixos.nix for NixOS system related settings
  • flake.nix for flake related settings

Languages

Bash

Used for Bash scripts.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#bash

C++ (cmake)

Used for C++ projects using CMake as a build system.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#cpp-cmake

Go (module)

Used for modern Go apps setup with go.mod system. To build legacy Go apps, use go-pkg template.

Important

Be sure to update go.mod with proper repository after running init command.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#go-mod

Go (package)

Used for legacy Go apps not setup with go.mod system. To build modern Go apps, use go-mod template.

Important

Be sure to update deps.nix with vendor dependencies after running init command (read more).

nix flake init -t github:ALT-F4-LLC/kickstart.nix#go-pkg

Lua (application)

Used for Lua script applications. This template creates a shell script wrapper which executes your Lua code. See flake.nix for more.

Note

We wrap Lua because we are using an interpreted language which requires both binary and code to run. This is similar to console scripts in the python-app template.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#lua-app

Node.js (backend)

Used for Node.js backend applications. The template builds using npm, and does not assume you use TypeScript.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#nodejs-backend

To update your dependencies, install/upgrade them as normal via NPM, then use the prefetch-npm-deps package from nixpkgs to generate a new npmDepsHash value for packages.default in the Flake.

$ nix shell 'nixpkgs#prefetch-npm-deps' -c prefetch-npm-deps package-lock.json
...
sha256-nTTzkQEdnwWEQ/3uy8hUbPsRvzM53xuoJHoQhR3E/zk=

Tip

To add TypeScript, install it with npm install --save-dev typescript, add a build script to package.json that calls tsc, and then remove dontNpmBuild = true; from packages.default in your Flake.

OCaml

Used for OCaml applications.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#ocaml

Python (application)

Used for runnable Python apps setup with setup.py and includes wrapped console scripts that can be executed from CLI. To build re-useable Python packages, use python-pkg template.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#python-app

Python (package)

Used for Python packages setup with setup.py that can be re-used within other Nix-built applications or packages. To build runnable Python apps, use python-app template.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#python-pkg

Rust

Used for Rust applications.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#rust

Dart

Used for Dart applications.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#dart

Zig

Used for Zig applications.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#zig

Haskell

Used for Haskell applications.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#haskell

Systems

Home Manager

Home Manager template allows you to run Nix with Home Manager on non-NixOS based Linux systems.

Tip

This setup is ideal for developers interested in running Linux distros other than NixOS.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#nixos-minimal

macOS

macOS template allows you to run Nix tools on native Apple hardware.

Tip

This setup is ideal for developers already using macOS.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#darwin

NixOS (desktop)

NixOS desktop template includes base operating system with GNOME (default) windows manager included. You can also use plasma5 by changing desktop value in flake.nix file.

Tip

This setup is ideal for getting started moving to NixOS as your main desktop.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#nixos-desktop

NixOS (headless)

NixOS headless (minimal) template includes base operating system without any windows manager.

Tip

This setup is ideal for servers and other headless tasks.

nix flake init -t github:ALT-F4-LLC/kickstart.nix#nixos-minimal

More Repositories

1

dotfiles

TheAltF4Stream dotfiles and environment.
Jinja
150
star
2

symphony

Open source cloud platform. Built live on The Alt-F4 Stream.
Go
73
star
3

dotfiles.nix

Neovim configuration for TheAltF4Stream as a plugin.
Nix
70
star
4

vorpal

Maintain your entire supply chain with one magical tool.
Rust
41
star
5

thealtf4stream.nvim

Neovim configuration for TheAltF4Stream as a plugin.
Lua
15
star
6

fem-eci-presentation

Presentation from Enterprise Cloud Infrastructure on Frontend Masters.
14
star
7

build-configs

CLI for generating build configurations.
Go
10
star
8

presentation-devops-for-developers

Presentation for Frontend Masters "DevOps for Developers" course.
TypeScript
10
star
9

fem-eci-terraform-tfe

Example organization Terraform Enterprise automation from Enterprise Cloud Infrastructure on Frontend Masters.
HCL
9
star
10

quirk-sdk

Quirk.gg SDK for use with Developer Tools features. Built live on The Alt-F4 Stream.
7
star
11

vms.nix

NixOS virtual machine images for ALT-F4 LLC
Nix
6
star
12

vaultsync

Vault helper utility used to sync remote state for local development. Built live on The Alt-F4 Stream.
Go
6
star
13

docker-zx

Dockerfile for running zx scripts.
Dockerfile
5
star
14

example-nix-python

Example project in Python using Nix.
Nix
5
star
15

fem-eci-terraform-github

Example organization GitHub automation from Enterprise Cloud Infrastructure on Frontend Masters.
HCL
4
star
16

dotfiles-test

Source code from "How To Automate Your Dev Setup" video.
Shell
4
star
17

fem-bsda-presentation

Presentation from Backend Systems Design: Architecture on Frontend Masters.
HTML
4
star
18

fem-eci-terraform-aws-network

Example organization AWS network automation from Enterprise Cloud Infrastructure on Frontend Masters.
HCL
3
star
19

tasks

Super cool task manager CLI tool.
3
star
20

example-web-frameworks

This repo includes a variety of current frameworks and bundlers.
CSS
3
star
21

fem-eci-terraform-aws-cluster

Example organization AWS ECS cluster automation from Enterprise Cloud Infrastructure on Frontend Masters.
HCL
2
star
22

fem-eci-terraform-product-service

Example organization product service automation from Enterprise Cloud Infrastructure on Frontend Masters.
HCL
2
star
23

terraform-github-repository

Terraform module which creates GitHub repository resources.
HCL
2
star
24

fem-eci-service

Example organization product service from Enterprise Cloud Infrastructure on Frontend Masters.
Go
2
star
25

example-docker-application

Sample application created on TheAltF4Stream on Twitch for reference.
JavaScript
2
star
26

docker-nginx-proxy

TypeScript
2
star
27

example-aks-cluster

Example Azure Kubernetes service cluster in Terraform.
HCL
1
star
28

vorpal-sdk

Supported language SDKs for Vorpal.
Rust
1
star