Skip to content

Instantly share code, notes, and snippets.

@cleverca22
cleverca22 / LICENSE
Last active January 5, 2025 01:11
simple chacha20 implementation in c
/*
* Copyright (c) 2025 Michael Bishop
*
* 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:
{ lib, config, pkgs, ... }:
{
imports = [ ./iscsi-boot.nix ];
fileSystems = {
"/" = { device = "UUID=132e7c5b-b4a9-4154-8105-4479e17f4f5b"; fsType = "ext4"; };
"/boot/" = { device = "UUID=fdac080d-d111-455c-a890-bc3e5e08c2d5"; fsType = "ext4"; };
};
boot = {
loader = {
@cleverca22
cleverca22 / configuration.nix
Last active February 5, 2024 00:06
NixOS virtualbox guest additions
# ...
virtualisation.virtualbox.guest.enable = true;
nixpkgs.config.packageOverrides = pkgs: {
linuxPackages = pkgs.linuxPackages // {
virtualboxGuestAdditions = pkgs.callPackage ./virtualbox-guest.nix {};
};
};
# ...
start:
alias FlushSwitch d0
alias FlushRegulator d1
alias Furnace d2
alias FillSwitch d3
alias FillRegulator d4
loop:
l r0 FillSwitch Open
s FillRegulator On r0
l r0 FlushSwitch Open
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
inherit (lib) optional optionals;
erlang = pkgs.beam.interpreters.erlangR24;
elixir = pkgs.beam.packages.erlangR24.elixir_1_13;
nodejs = pkgs.nodejs-18_x;
mkdir -pv $out/repository/{$DIR1,$DIR2}
function tryfetch {
if [ ! -e "$2" ] ; then
echo trying "$1"
curl -fk "$1" > "$2" || (echo failed; rm "$2")
else
true
fi
}
for mirror in $mirrors; do
[root@laptop:~]# nix-instantiate '<nixos>' -A system
waiting for the big garbage collector lock...
warning: you did not specify ‘--add-root’; the result might be removed by the garbage collector
/nix/store/gjyr1f2mp052bdh4j6vxy95m8jl7s04w-nixos-system-laptop-16.09pre82105.7465bcd.drv
[clever@laptop:~]$ nix-copy-closure --to root@amd /nix/store/gjyr1f2mp052bdh4j6vxy95m8jl7s04w-nixos-system-laptop-16.09pre82105.7465bcd.drv
Password:
copying 241 missing paths (3.87 MiB) to ‘root@amd’...
[clever@amd-nixos:~]$ nix-copy-closure --to root@router /nix/store/gjyr1f2mp052bdh4j6vxy95m8jl7s04w-nixos-system-laptop-16.09pre82105.7465bcd.drv
@cleverca22
cleverca22 / Main.hs
Created July 26, 2021 18:27
New Project
{-# LANGUAGE OverloadedStrings #-}
module Escrow where
import Language.Marlowe.Extended
main :: IO ()
main = print . pretty $ contract
-- We can set explicitRefunds True to run Close refund analysis
-- but we get a shorter contract if we set it to False
{config,pkgs,...}:
let
myVim = pkgs.vim_configurable.customize {
name = "vim";
vimrcConfig = {
customRC = ''
syntax on
set nu
set foldmethod=syntax
rec {
test1 = builtins.scopedImport { __nixPath = [ { path = test4; prefix="ssh-config-file"; } ] ++ __nixPath; };
test2 = test1 <nixpkgs/pkgs/build-support/fetchgit/private.nix>;
pkgs = import <nixpkgs> {};
test3 = pkgs.callPackage test2 {};
test4 = pkgs.writeText "sshd_config" ''
# empty file, use programs.ssh.knownHosts in configuration.nix not StrictHostKeyChecking no
'';
test5 = test3 {
url = "git@github.com:cleverca22/not-os.git";