My NixOS configuration.
Go to file
2020-01-03 17:06:32 -07:00
.git-crypt setup configurations API 2019-12-05 01:58:40 -07:00
hosts niximg: use modulesPath 2020-01-01 19:45:49 -07:00
lib utils: small cleanup 2019-12-21 19:02:22 -07:00
local core: don't import file systems 2020-01-01 19:21:15 -07:00
modules modules#qbittorrent: add openFirewall option 2020-01-01 16:24:36 -07:00
pkgs flake: add packages to outputs 2020-01-01 19:24:09 -07:00
profiles core: empty root passwd by default 2020-01-03 01:02:08 -07:00
secrets users#nrd: init cargo credentials 2019-12-15 02:55:54 -07:00
users/nrd core: empty root passwd by default 2020-01-03 01:02:08 -07:00
.envrc shell.nix: init minimal 2020-01-01 21:01:58 -07: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
configuration.nix legacy: ensure config exists 2020-01-01 17:16:38 -07:00
COPYING init 2019-12-02 22:18:30 -07:00
flake.lock graphical#ffmpeg: build with svt-av1 support 2019-12-30 18:42:36 -07:00
flake.nix flake: add packages to outputs 2020-01-01 19:24:09 -07:00
README.md README.md: expand on aim, and explain secrets 2020-01-03 17:05:26 -07:00
shell.nix shell.nix: add git-crypt dependency 2020-01-03 17:06:32 -07:00

Introduction

This project is under construction as a rewrite of my legacy NixOS configuration, using the experimental flakes mechanism. Its aim is to provide a generic template repository, to neatly separate concerns and allow one to get up and running with NixOS faster. Flakes are still an experimental feature, but once they finally get merged, even more will become possible, including nixops support.

Flake Talk

Usage

Enter a nix-shell either manually or automatically using direnv. This will set up the exerimental nix features that need to be available to use flakes. A basic rebuild command is included in the shell to replace nixos-rebuild for now.

Usage: rebuild [host] {switch|boot|test}

You can specify one of the host configurations from the hosts directory. If omitted, it will default to your systems current hostname.

In addtion:

rebuild iso

Will make a minimal and bootable iso image of the niximg configuration. You can customize the image by editing this file.

You can also install the packages declared in pkgs without needing to install NixOS. For example:

# from top-level
nix profile install ".#packages.x86_64-linux.purs"

Contributing

The purpose of this repository is to allow for simpler modularity and maintainability than was achieved in a previous effort. Flakes, along with a standardized structure, make this simple.

Hosts

Distributions for particular machines should be stored in the hosts directory. Every file in this directory will be added automatically to the available NixOS configurations available in the nixosConfigurations flake output. See the default.nix for implementation details.

Profiles

More abstract configurations that can be reused by multiple machines should go in the profiles directory. It's structure is pretty straight forward. Just have a look to get an idea. Every profile should have a default.nix to easily import it. You can also stick things in the profile's subdirectory which are not automatically imported by its default.nix but are meant to be manually imported from a host (useful for less common, or specialized configurations).

In addition, profiles can depend on other profiles. For example, The graphical profile depends on develop simply by importing it in its default.nix.

Users

User declaration belongs in the users directory. Everything related to your user should be declared here. For convenience, home-manager is available automatically for home directory setup.

Secrets

Anything you wish to keep encrypted goes in the secrets directory. Be sure to run git-crypt init, before committing anything to this repo. Be sure to check out the documentation if your not familiar.

To keep profiles resuable across configurations, secrets should only be imported from the users directory.

Modules and Packages

All modules and pkgs are available for every configuration automatically. Simply add a *.nix file to one of these directories declaring your module or package, and update the corresponding default.nix to point to it. Now you can use your new module or install your new package as usual.

Doing this will also add them to the flake's nixosModules or overlays outputs to import them easily into an external NixOS configuration as well.

Pull Requests

If you'd like to add a package, module, profile or host configuration please be sure to format your code with nixpkgs-fmt before opening a pull-request. The commit message follows the same semantics as nixpkgs. You can use a # symbol to specify abiguities. For example, develop#zsh: <rest of commit message> would tell me that your updating the zsh configuration living under the develop profile.

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.