Skip to content

Instantly share code, notes, and snippets.

Avatar

Linus Heckemann lheckemann

View GitHub Profile
View colmena-gpg-secrets.nix
{ config, pkgs, lib, ... }:
let basePath = ../secrets; in
{
options.secrets = with lib; with types; mkOption {
type = attrsOf (submodule ({name, ...}: {
options = {
user = mkOption {
type = str;
description = "Owner of the secret";
default = "root";
View install-nixos.sh
#!/usr/bin/env bash
set -exuo pipefail
PROGRAM_NAME="$0"
inst() {
local system="" host="" action="install" from="auto" mount=""
local -a nixCopyArgs
while [[ "$#" -gt 0 ]] ; do
case "$1" in
@lheckemann
lheckemann / boot.log
Last active Mar 11, 2022
Boot log for XORO HST280
View boot.log
CPU will restart.
Bootrom start
Boot Media: eMMC (Default Speed)
Decrypt auxiliary code ...OK
lsadc voltage min: 000001C4, max: 000001C5, aver: 000001C4, index: 0000000A
Enter boot auxiliary code
Auxiliary code - v1.00
View copy-nixpkgs.nix
{ config, pkgs, lib, ... }: {
options.copy-nixpkgs = lib.mkEnableOption "copying the nixpkgs used to build the system to it, and placing it in NIX_PATH";
config = lib.mkIf config.copy-nixpkgs {
nix.nixPath = ["nixpkgs=/var/lib/nixpkgs"];
systemd.tmpfiles.rules = ["L+ /var/lib/nixpkgs - - - - ${pkgs.path}"];
};
}
View hass-podman.nix
{ pkgs, config, lib, ... }:
let
hassConfig = (pkgs.formats.yaml {}).generate "home-assistant-configuration" {
config = {};
frontend = {};
history = {};
image = {};
input_boolean = {};
input_datetime = {
good_morning = {
View btrfs-sd-image.nix
{ pkgsPath ? <nixpkgs>
, pkgs ? import pkgsPath { system = "aarch64-linux"; } }:
let
thirtythree = import (pkgs.path + "/nixos") {
configuration = {
nixpkgs.system = "aarch64-linux";
imports = [
./configuration.nix ./firmware.nix
];
boot.loader.grub.enable = false;
@lheckemann
lheckemann / unwipefs.py
Created Jun 23, 2021
Accidentally wipefs'd a bit too much? Fear not! As long as you kept its output.
View unwipefs.py
#!/usr/bin/env python3
import os
import sys
import re
import codecs
import subprocess
parse = re.compile(r'^(?P<device>.+): (?P<count>[0-9]+) bytes were erased at offset (?P<offset>0x[0-9a-f]+) \((?P<type>.+)\):(?P<bytes>( [0-9a-f][0-9a-f])+)$')
@lheckemann
lheckemann / module.nix
Created Jun 18, 2021 — forked from elseym/module.nix
kotenpflaumen
View module.nix
{ config, pkgs, lib, unstable, ... }:
with lib;
let
cfg = config.pflaumen.dns.server;
fmt = pkgs.formats.knotConf {};
overlay = _: flip recursiveUpdate { inherit formats; };
formats.knotConf = {}: rec {
View weird-routing.nix
{ pkgs ? import <nixpkgs> {} }:
let
inherit (pkgs) lib;
defaults = {
options.networking.interfaces = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule {
useDHCP = false;
});
};
};
View aarch64-vm.nix
{ pkgsPath ? <nixpkgs> }:
let
pkgs = import pkgsPath {};
pkgsAarch64 = import pkgsPath { system = "aarch64-linux"; };
iso = (pkgsAarch64.nixos {
imports = [ (pkgsPath + "/nixos/modules/installer/cd-dvd/installation-cd-base.nix") ];
users.users.root.openssh.authorizedKeys.keyFiles = [(builtins.fetchurl https://github.com/lheckemann.keys)];
}).config.system.build.isoImage;