Skip to content

Instantly share code, notes, and snippets.

@m1cr0man
m1cr0man / flake.nix
Last active October 5, 2024 13:18
The simplest Nix Flake for nixos-rebuild
# This can be built with nixos-rebuild --flake .#myhost build
{
description = "the simplest flake for nixos-rebuild";
inputs = {
nixpkgs = {
# Using the nixos-unstable branch specifically, which is the
# closest you can get to following the equivalent channel with flakes.
url = "github:NixOS/nixpkgs/nixos-unstable";
};
@m1cr0man
m1cr0man / acme2.nix
Created November 26, 2021 19:21
NixOS acme selfsigned CA service failure test
let
commonConfig = ./common/acme/client;
dnsServerIP = nodes: nodes.dnsserver.config.networking.primaryIPAddress;
dnsScript = {pkgs, nodes}: let
dnsAddress = dnsServerIP nodes;
in pkgs.writeShellScript "dns-hook.sh" ''
set -euo pipefail
echo '[INFO]' "[$2]" 'dns-hook.sh' $*
@m1cr0man
m1cr0man / README.md
Created June 27, 2021 15:05
Mailman 3 API Import/Export for migration

Mailman 3 Import/Export script

Useful for database backend migrations and/or backup and restore operations.

Requires Python 3.6+ and AIOHTTP 3.7.4+

Run it on your mailman server. You may need to edit the API credentials if you changed the defaults.

@m1cr0man
m1cr0man / cmd.sh
Last active January 4, 2020 13:42
configuration for nixos-generate
export NIX_PATH=nixpkgs=$(pwd)/nixpkgs # Using current nixos-unstable
nixos-generate -f kexec -c kexec_configuration.nix 2>&1 | tee generate.log
@m1cr0man
m1cr0man / legoacme.nix
Created November 4, 2019 15:22
Implementation of NixOS/nixpkgs#63613 supporting wildcards
# Taken from https://github.com/NixOS/nixpkgs/pull/63613
# Also incoroporates patches from https://github.com/NixOS/nixpkgs/pull/63613#issuecomment-531471460
# TODO delete this when PR is merged, and switch usages of legoCerts to certs
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.security.acme;
directory = "/var/lib/acme";
@m1cr0man
m1cr0man / httpd.conf
Created October 6, 2019 22:58
NixOS php-fpm and apache - the crucial lines!
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/phpfpm-nextcloud/nextcloud.sock|fcgi://localhost/"
</FilesMatch>
@m1cr0man
m1cr0man / configuration.nix
Created September 29, 2019 14:44
Glusterfs override
{ pkgs, ... }:
{
services.glusterfs = {
enable = true;
};
services.nfs.server.enable = true;
nixpkgs.overlays = [
(self: super: {
@m1cr0man
m1cr0man / override.nix
Created June 16, 2019 12:01
Building nodejs package with native dependencies
{pkgs ? import /root/nixpkgs {
inherit system;
}, system ? builtins.currentSystem}:
let
nodePackages = import ./default.nix {
inherit pkgs system;
};
in
nodePackages // {
@m1cr0man
m1cr0man / ModManager.yaml
Last active June 8, 2019 20:11
[1.0] Rimworld Planetary Domination Collection
Version: 1
Name: m1cr0pack_5
Mods:
- Id: 1544705976
Name: ModCheck
- Id: Core
Name: Core
- Id: 962732083
Name: RuntimeGC
- Id: 1507748539
@m1cr0man
m1cr0man / localpip.sh
Created December 30, 2018 15:29
Script to link binaries from virtualenv to a dir in PATH
#!/bin/bash
IGNORED="
activate
activate.csh
activate.fish
activate_this.py
easy_install
easy_install-3.6
pip