Skip to content

Instantly share code, notes, and snippets.

@JayRovacsek
JayRovacsek / nix.md
Last active December 29, 2024 10:18
Nix Rough Edges

⚠️ VCS Aware ⚠️

Before reading the below, note that nix is version control system aware; if you embark on the below and migrate to source control you will be bitten by this at-least once. tldr is that when VCS exists, nix will use the current state of it to filter during evaluation.

Given the following structure

.
@JayRovacsek
JayRovacsek / net.nix
Created December 31, 2023 23:58 — forked from duairc/net.nix
IP address arithmetic and validation in Nix
{ lib ? null, ... }:
let
net = {
ip = {
# add :: (ip | mac | integer) -> ip -> ip
#
# Examples:
@JayRovacsek
JayRovacsek / README.md
Created June 5, 2022 04:53 — forked from timcharper/README.md
Macvlan using systemd

Before

yum install -y systemd-networkd
modprobe macvlan # make sure this returns no errors

Put config files in place

eth0.network and mac0.{netdev,network} go in /etc/systemd/network/

@JayRovacsek
JayRovacsek / kvm.nix
Created September 14, 2021 10:19 — forked from Nekroze/kvm.nix
NixOS Declarative KVM Guests
## Builder for NixOS configurations defined at the end of the file to be built into KVM VM's
{ system ? builtins.currentSystem }:
let
loadcfg = cfgfile: { config, pkgs, ...}: {
imports = [ <nixos/modules/virtualisation/qemu-vm.nix> cfgfile ];
config = {
networking.extraHosts = ''
176.32.0.254 template
'';
@JayRovacsek
JayRovacsek / nixos.md
Last active April 16, 2022 04:34 — forked from martijnvermaat/nixos.md
Installation of NixOS with encrypted root