Check nixpkgs/pkgs/build-support/trivial-builders.nix for more information about:
- runCommand / runCommandCC
- writeTextFile / writeTextDir
- writeScript / writeScriptBin
- writeShellScript / writeshellScriptBin
- writeShellApplication
- ...
function Get-ScoopRoot { | |
$scoopdir = & { | |
$env:SCOOP, (scoop config 'rootPath'), "$env:USERPROFILE\scoop" | Where-Object { -not [String]::IsNullOrEmpty($_) } | Select-Object -First 1 | |
} 6>$null | |
$scoopdir | |
} | |
function Get-ScoopPackageVersions { | |
param ( | |
[Parameter(Position = 1, Mandatory = $true)] |
# Adapted from https://github.com/bennofs/nix-index/blob/master/command-not-found.sh | |
command_not_found_handle () { | |
if [ -n "${MC_SID-}" ] || ! [ -t 1 ]; then | |
>&2 echo "$1: command not found" | |
return 127 | |
fi | |
echo -n "searching nix-index..." | |
ATTRS=$(@nix-locate@ --minimal --no-group --type x --type s --top-level --whole-name --at-root "/bin/$1") |
# Module for configuring libvirt with static NixOS networking | |
# instead of using libvirt managed bridge. | |
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
cfg = config.virtualisation.libvirtd.networking; | |
v6Enabled = cfg.ipv6.network != null; | |
v6PLen = toInt (elemAt (splitString "/" cfg.ipv6.network) 1); |
Check nixpkgs/pkgs/build-support/trivial-builders.nix for more information about:
I wanted to write a module that generates multiple systemd services and timers to scrub some zfs pools at certain intervals. The default scrub config does not support individual scrub intervals for each pool.
I want the config to look like this:
{
services.zfs-auto-scrub = {
tank = "Sat *-*-* 00:00:00";
exec startlxde |
# Edit this configuration file to define what should be installed on | |
# your system. Help is available in the configuration.nix(5) man page | |
# and in the NixOS manual (accessible by running ‘nixos-help’). | |
{ config, pkgs, ... }: | |
{ | |
################################################################################ | |
# System |
:def hoogle \x -> return $ ":!hoogle --count=15 \"" ++ x ++ "\"" | |
:def doc \x -> return $ ":!hoogle --info \"" ++ x ++ "\"" | |
:set -Wall | |
:set -fno-warn-type-defaults -ferror-spans -freverse-errors -fprint-expanded-synonyms | |
:set prompt "\ESC[0;32m%s\n\ESC[m[ghci]\ESC[38;5;172mλ \ESC[m" | |
:set prompt-cont " \ESC[38;5;172m> \ESC[m" |
Internet connection and DNS routing are broken from WSL2 instances, when some VPNs are active. The workaround breaks down into two problems:
This problem is tracked in multiple microsoft/WSL issues including, but not limited to: