Experimental NixOS repo
Find a file
2020-07-14 17:31:09 -06:00
.github/ISSUE_TEMPLATE Update issue templates 2020-01-04 17:21:01 -07:00
cachix cachix: add personal cachix information 2020-07-10 18:28:14 -06:00
hosts hosts#NixOS: add fileSystems to pass checks 2020-07-13 22:04:34 -06:00
lib Revert "utils: now lives in lib.utils globally" 2020-01-05 15:39:59 -07:00
local change formatter to nixfmt 2020-01-03 22:06:31 -07:00
modules modules#steam: create xsession for Steam 2020-07-09 00:05:24 -06:00
overlays retroarch: 1.8.8 -> 1.8.9 2020-06-25 21:52:40 -06:00
pkgs modules#steam: create xsession for Steam 2020-07-09 00:05:24 -06:00
profiles adblocking: update to latest hosts 2020-07-14 17:31:09 -06:00
users niximg: fix nixos user 2020-01-11 00:24:12 -07:00
.envrc direnv: use nix print-dev-env 2020-07-13 20:00:47 -06:00
.gitattributes setup configurations API 2019-12-05 01:58:40 -07:00
.gitignore setup configurations API 2019-12-05 01:58:40 -07:00
cachix.nix cachix: add personal cachix information 2020-07-10 18:28:14 -06:00
configuration.nix configuration.nix: fix modules import 2020-06-14 12:30:40 -06:00
CONTRIBUTING.md CONTRIBUTING.md: break off from README.md 2020-01-04 17:16:59 -07:00
COPYING init 2019-12-02 22:18:30 -07:00
DOC.md DOC.md: fix typo 2020-02-01 20:37:43 -07:00
flake.lock flake: update lock file 2020-07-13 21:48:01 -06:00
flake.nix direnv: use nix print-dev-env 2020-07-13 20:00:47 -06:00
README.md shell.nix: remove rebuild command 2020-07-13 19:56:39 -06:00
shell.nix shell.nix: remove rebuild command 2020-07-13 19:56:39 -06:00

Introduction

A NixOS configuration template using the experimental flakes mechanism. Its aim is to provide a generic repository which neatly separates concerns and allows one to get up and running with NixOS faster than ever.

A core goal is to facilitate a (mostly) seamless transition to flakes. You could start by simply importing your configuration.nix from a module in hosts. There may be some translation if you import anything from the NIX_PATH, e.g. import <nixpkgs> {}, but the majority of any valid NixOS config should work right out of the box. Once your up and running, you may wish to modify your configuration to adhere to the ideals of this project.

⚠ Advisory

Flakes are still an experimental feature, so not everything works yet. However, it has been merged upstream, and for those using cloud deployments, there is now nixops support!

Also, flakes are meant to deprecate nix-channels. I'd recommend not installing any. If your really want them, they should work if you hook them into your NIX_PATH manually.

Flake Talk:

Flake talk at NixConf

Setup

# This is not needed if your using direnv:
nix-shell

# It's recommend to start a new branch:
git checkout -b $new_branch template

# Generate a hardware config:
nixos-generate-config --show-hardware-config > ./hosts/${new_host}.nix

# Edit the new file, removing `not-detected.nix` from the imports.
# In order to maintain purity flakes cannot resolve from the NIX_PATH.

# You could import your existing `configuration.nix`, or the generic
# `./hosts/NixOS.nix` from here. The latter sets up Network Manger,
# an efi bootloader, an empty root password, and a generic user
# named `nixos`.

# Also ensure your file systems are set the way you want:
$EDITOR ./hosts/${new_host}.nix

# Backup your existing config:
mv /etc/nixos /etc/nixos.old

# Ensure this flake can be found in its expected location:
ln -s $PWD /etc/nixos

# A flake is vcs based, so only git aware files are bundled
# adding a new file to staging is enough:
git add ./hosts/${new_host}.nix

# Test your new deployment:
sudo nixos-rebuild $new_host test

# You may wish to start by creating a user:
mkdir users/new-user && $EDITOR users/new-user/default.nix

# Once your satisfied, permanently deploy with:
sudo nixos-rebuild $new_host switch

Please read the doc in order to understand the impetus behind the directory structure.

Additional Capabilities

# Make an iso image based on `./hosts/niximg.nix`:
build-iso

# Install any package the flake exports:
nix profile install ".#packages.x86_64-linux.myPackage"

this flake exports multiple outputs for use in other flakes, or forks of this one:

# external flake.nix
{
  # ...
  inputs.nixflk.url = "github:nrdxp/nixflk";

  outputs = { self, nixpkgs, nixflk }: {

    nixosConfigurations.newConfig = nixflk.nixosConfigurations.someConfig;

    nixosConfigurations.myConfig = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        { nixpkgs.overlays = nixflk.overlays; }
        nixflk.nixosModules.myModule
      ];
    };
  };
}

NUR usage

You can use packages, modules and overlays from the Nix User Repository.

Since NUR packages are completely unchecked, they are not included by default. Check out the NUR branch for usage.

License

This software is licensed under the MIT License.

Note: MIT license does not apply to the packages built by this configuration, merely to the files in this repository (the Nix expressions, build scripts, NixOS modules, etc.). It also might not apply to patches included here, which may be derivative works of the packages to which they apply. The aforementioned artifacts are all covered by the licenses of the respective packages.