Git Product home page Git Product logo

pinpox / nixos Goto Github PK

View Code? Open in Web Editor NEW
176.0 3.0 9.0 3.15 MB

My NixOS Configurations

Home Page: https://pablo.tools

License: GNU General Public License v3.0

Nix 60.36% Shell 3.62% HTML 1.90% JavaScript 0.07% CSS 3.02% Mustache 1.80% Lua 21.36% Python 2.23% Jsonnet 0.54% Vim Script 4.60% Scheme 0.51%
nix nixos nixos-configuration dotfiles configuration-management config nix-dotfiles flake secrets

nixos's Introduction

nixos

Configuration checks: Build Status

All Module options are documeted at: https://pinpox.github.io/nixos/

This repository includes all configurations for my NixOS machines. Feel free to use parts of it as you please, but keep it mind it is intended mostly for personal use. I've written posts about certain aspects of this setup on my personal blog.

Initial Setup

The structure of this repository is meant to allow easy manual deployment. Individual hosts are defined in /machines/<hostname> and will import re-usable parts of the configuration as needed.

Deployment is managed with lollypops Secrets are stored in pass.

TL;DR To use a host configuration on a fresh install, make sure that:

  • The hostname is set correctly (hostname <machine name>)
  • You are connected to the internet and have access rights to the repository
  • Pass has the necessary secrets for the machine
  • The machine's config is up-to-date

Then backup the generated hardware-configuration.nix file:

# Overwrite hardware-configuration.nix file with the generated one
cp /etc/nixos/hardware-configuration.nix \
   ./machines/$(hostname)/hardware-configuration.nix

# Commit and push the new file
git commit -am"Add hardware-configuration for $(hostname)" && git push

TODO: update

It is also possible to build on the system itself when logged in, e.g. to get additional debug information.

cd /var/src/machine-config
sudo nixos-rebuild --flake ".#kartoffel" switch

Current Hosts

Configuration Type Location VPN IP Description
kartoffel Desktop local 192.168.7.3 Desktop
ahorn Desktop local 192.168.7.2 Notebook
birne Server local 192.168.7.4 Local NAS
porree Server netcup.de 192.168.7.1 Server for pablo.tools
mega Server netcup.de 192.168.7.6 Server for megaclan3000.de
kfbox Server netcup.de 192.168.7.5 Server for 0cx.de

The services running on each host are documented in the host-specific README.md files.

Deployment

Default Deployment

Deployment is handled with lollypops.

TODO Update/document

First Deployment

If the system has not been configured to use flakes (e.g. fresh install), the first deployment will have to be build on a machine that has. This can be done from any of the other hosts that have the repository. The configuration will the have the necessary options set, so that flakes works from now on with the normal lollypops deployment.

# bash, zsh doesn't always work correctly
sudo nixos-rebuild --flake .#new-hostname --target-host <new-host-ip> --build-host localhost switch

Contributing?

While contributions don't make much sense for a personal configuration repository, I'm always happy to get hints, tips and constructive criticism. If you find something that could be done in a better way, please let me know!

nixos's People

Contributors

cjlarose avatar mayniklas avatar pinpox avatar sternenseemann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nixos's Issues

Push only paths to cache that are not in cache.nixos.org

nix build -L --option keep-going true --out-link $BUILDDIR/gcroots.tmp/result '.#nixosConfigurations.ahorn.config.system.build.toplevel'
rm -rf $BUILDDIR/gcroots && mv $BUILDDIR/gcroots.tmp $BUILDDIR/gcroots
nix path-info --json -r $BUILDDIR/gcroots/result* > $BUILDDIR/path-info.json
jq -r 'map(select(.ca == null and .signatures == null)) | map(.path) | .[]' < $BUILDDIR/path-info.json > $BUILDDIR/paths
# cachix push --jobs 32 mic92 < $BUILDDIR/paths
xargs -I npath nix copy --no-check-sigs --to ssh://bob -L -v npath < $BUILDDIR/paths

Add all packages to an overlay

Currently custom package definitions are stored in /packages. This is mainly used to work around temporarily broken packages in nixpkgs (maintain own version, until fix hits unstable) or to add own packages that are not worth submitting to nixpkgs itself e.g. personal scripts.

It would be nicer to add all these to an overlay so they can be uniformly used.
A example for a flake-based overlay and it's usage can be seen here

Setup restic for all hosts

Backups

General

  • empty backup module
  • paths specified in other modules

Locations

  • birne
  • contabo

Data

By modules

default-desktop
  • /home
  • /root

Exclude:

  • /
default-server
  • TODO
filebrowser
  • /var/lib/filebrowser
fonts
  • ~/.local/share/fonts
hedgedoc
  • /var/lib/hedgedoc/uploads
  • /var/lib/hedgedoc/db.sqlite
home-assistant
  • TODO
http2irc
  • /var/lib/http2irc
mattermost
  • /var/lib/mattermost
  • postgres
miniflux
  • postgres
minio
  • /mnt/data/minio/config
  • /mnt/data/minio/data
monitoring
  • /var/lib/loki
  • /var/lib/grafana
  • /var/lib/prometheus2
nextcloud
  • TODO
ntfy-sh
  • /var/lib/ntfy-sh
thelounge
  • /var/lib/thelounge
home-manager/zk
  • ~/Notes

By hosts

ahorn
birne
bob
kartoffel
kfbox
porree

Rework mmonit module

module comments: use systemd StateDirectory and Dynamic user to get rid of init and explicit users. In nixpkgs, you'd want an option to open the firewall instead of just doing it

@ryantm on IRC

Configure borgbackup

Backup is not set up yet for some hosts

  • kartoffel
  • ahorn
  • kfbox
  • mega
  • porree
  • birne

Other TODO's:

Use flake inputs for zsh plugins

The plugins in shell.nix are currently loaded from GitHub using a pinned rev. This has the downside, that they are not updated when updating the flake inputs. It should be possible to use flake inputs to get these and then just include them from there.

Fix firefox-extensions

The firefox extensinos where installed from NUR and are currently commented out, as nur is not yet working.

Make wireguard a module

Wireguard's should be separated in a module.

  • Consider separate config for server or option to select
  • Add an option to set the public key (and maybe ip?)
  • Consider a central registry of variables like vars.nix to manage wireguard clients (ip and key)

Setup birne

Host birne is running on arch, migrate to nixos

Integrate home-manager

Home manager is currently a separate repository. It should be integrated with flakes

  • add repository as flake
  • create separate home configuration for servers (without the GUI stuff)
  • deploy where needed on current machines
  • update readme

Setup mega

Host mega is running on ubuntu server, consider migration to nixos

Setup kfbox

Host kfbox is running on arch, migrate to nixos

Update readme on how to create new hosts

The Creating new Hosts section was written before the use of flakes. New instructions should be written.
The old documentation for reference:

# Creating new Hosts. [TODO, this section is outdated!]

The following describes how to create new hosts to be included in this project
structure. It assumes a working NixOS installation on a new machine. The
following steps further assume you are logged in as root (e.g. via SSH)

## Preliminary Checks

- Check that hostname is set
- Check machine is connected to the internet
- Check timezone is correct
- Check nix-channel is correct

## Create Secrets

The following will create a new set of keys to be added to the `/secrets`
directory of this host.

```bash
# Create SSH keys
ssh-keygen -t ed25519 -f /secrets/$(hostname)/ssh/id_ed25519

# Create wireguard keys
# Use if `wireguard` is not installed: nix-shell -p pkgs.wireguard
wg genkey > /secrets/$(hostname)/wireguard/privatekey
wg pubkey < /secrets/$(hostname)/wireguard/privatekey > /secrets/$(hostname)/wireguard/publickey

# Create borg passphrase
# Use if `pwgen` is not installed: nix-shell -p pkgs.pwgen
pwgen 20 > /secrets/$(hostname)/borg/repo-passphrase

TODO add to pass

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.