Skip to content

Instantly share code, notes, and snippets.

{ config, lib, ... }:
with lib;
{
# Add support for Grub secrets
config = mkIf (config.boot.loader.grub.enable && config.boot.initrd.secrets != {}) {
boot.loader = {
supportsInitrdSecrets = mkForce true;
grub.extraInitrd = "/boot/grub/secrets-initrd.gz";
@msteen
msteen / default.nix
Created March 22, 2020 17:48
NodeJS outside of Nix within NixOS
{
environment.systemPackages = with pkgs; [ nodejs-12_x ];
environment.shellInit = ''
# Workaround for not being able to install packages globally.
export PATH="/opt/npm/bin:$PATH"
'';
}
{ # Limits
# We increase to inotify limits since the defaults are easily exceeded.
boot.kernel.sysctl = {
"fs.inotify.max_user_instances" = 4096;
"fs.inotify.max_user_watches" = 524288;
};
# Be very generous with resource restrictions.
# Should be lower than the value defined in /proc/sys/fs/file-max.
# The domain * excludes root, so we need repeat it for root.
@msteen
msteen / find_zettel_orphans.rb
Last active April 29, 2020 15:35 — forked from DivineDominion/find_zettel_orphans.rb
In a directory of Zettel notes, find all those without incoming links
#!/usr/bin/env ruby
require 'set'
# Change the path here:
# ARCHIVE = '~/Archive/'
ARCHIVE = '/admin/fork/The-Archive-Demo-Notes'
EXTENSIONS = %w{.md .txt .markdown .mdown .text}
#################################################################
@msteen
msteen / print-lezer-tree.ts
Last active February 28, 2024 09:02
Print Lezer Trees
// MIT License
//
// Copyright (c) 2021 Matthijs Steen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: