Skip to content

Instantly share code, notes, and snippets.

Converting ClojureScript projects into Nix packages

JavaScript/NPM

Run ~node2nix~[fn:node2nix] on the repo to convert JavaScript dependencies into Nix-addressable packages

Clojure

Run ~clj2nix~[fn:clj2nix] on the repo to convert Clojure/Java/Maven dependencies into Nix-addressible packages

Converting ClojureScript projects into Nix packages

JavaScript/NPM

Run =node2nix=[fn:node2nix] on the repo to convert JavaScript dependencies into Nix-addressable packages

Clojure

Run =clj2nix=[fn:clj2nix] on the repo to convert Clojure/Java/Maven dependencies into Nix-addressible packages

;; Package-Requires: ((request "0.3.2"))
(require 'request)
(defmacro access (trail value)
(let ((trail_ (reverse trail))
(result value))
(dolist (focus trail_ result)
(pcase focus
(`(vector . ,index) (setq result `(aref ,result ',index)))
(`(object . ,key) (setq result `(alist-get ',key ,result)))))))
(defmacro access (trail value)
(let ((trail_ (reverse trail))
(result value))
(dolist (focus trail_ result)
(pcase focus
(`(vector . ,index) (setq result `(aref ,result ',index)))
(`(object . ,key) (setq result `(alist-get ',key ,result)))))))
(defmacro vector-alist-let (spec value body)
(let ((varlist '())
\begin{circuitikz}[]
\draw (3,0) node[spdt,xscale=-1,yscale=-1] (SwR) {};
\draw (1,0) node[spdt] (SwL) {};
\draw (SwL.out 1) -- (SwR.out 2);
\draw (SwL.out 2) -- (SwR.out 1);
\draw (SwL.in)
-- (0,0) to[sV=220<\volt>] (0,3)
-- (1,3) to[lamp] (3,3) -| (SwR.in);
\end{circuitikz}
[myrl@myrl-zenbook:~]$ nix show-derivation /nix/store/2zid555d7d21gd05nf7jwi1bayav12ln-atk-2.34.1 | nix run nixpkgs.jq -c jq 'keys[]'
"/nix/store/00632dysk5af3g79nj9cnfq6fihln8i2-atk-2.34.1.drv"
[myrl@myrl-zenbook:~]$ nix-store -q --deriver /nix/store/2zid555d7d21gd05nf7jwi1bayav12ln-atk-2.34.1
/nix/store/67jbkkknbj29gbw840z05xkcxq0gaa68-atk-2.34.1.drv
nesting.clone = [{
hardware.nvidiaOptimus.disable = lib.mkForce false;
hardware.nvidia.modesetting.enable = true;
hardware.nvidia.prime = {
sync.enable = true;
nvidiaBusId = "PCI:1:0:0";
intelBusId = "PCI:0:2:0";
};
services.xserver = {
videoDrivers = [ "nvidiaBeta" ];
{ config, pkgs, lib, ... }:
{
boot = {
loader = {
systemd-boot.enable = true;
timeout = 2;
efi.canTouchEfiVariables = true;
};
extraModprobeConfig = ''
#ifndef BUF_HANDLE_H
#define BUF_HANDLE_H
#include<stdlib.h>
#include<stdint.h>
struct buf_handle
{
uint8_t *tail;
ssize_t remaining;
mosh --experimental-remote-ip=remote --ssh='./nixops-mosh-adaptor.sh -d deployment' machine
nixops-mosh deployment machine