Skip to content

Instantly share code, notes, and snippets.

{ 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";
#!/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 March 11, 2022 21:10
Boot log for XORO HST280
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
{ 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}"];
};
}
{ pkgs, config, lib, ... }:
let
hassConfig = (pkgs.formats.yaml {}).generate "home-assistant-configuration" {
config = {};
frontend = {};
history = {};
image = {};
input_boolean = {};
input_datetime = {
good_morning = {
{ 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 June 23, 2021 10:05
Accidentally wipefs'd a bit too much? Fear not! As long as you kept its output.
#!/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 June 18, 2021 15:01 — forked from elseym/module.nix
kotenpflaumen
{ config, pkgs, lib, unstable, ... }:
with lib;
let
cfg = config.pflaumen.dns.server;
fmt = pkgs.formats.knotConf {};
overlay = _: flip recursiveUpdate { inherit formats; };
formats.knotConf = {}: rec {
{ pkgs ? import <nixpkgs> {} }:
let
inherit (pkgs) lib;
defaults = {
options.networking.interfaces = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule {
useDHCP = false;
});
};
};
@lheckemann
lheckemann / aarch64-vm.nix
Created January 28, 2021 17:03
AArch64 VM
{ 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;