Skip to content

Instantly share code, notes, and snippets.

Avatar
🌮

Profpatsch

🌮
View GitHub Profile
View service.nix
{ pkgs }:
{ service-dir }:
let sd = pkgs.lib.escapeShellArg service-dir;
in pkgs.writers.writeDash "service" ''
set -e
CMD=''${1:?please specify command as first argument}
View nix-build-if-changed.py
#!/usr/bin/env python3
# Small wrapper around nix-instantiate and `nix-store --realize`
# that checks whether the output path is already in a cache
# and if it isn’t, builds it.
#
# The arguments you pass will be given to nix-instantiate,
# not to nix-store --realize
# (This might be a TODO for the future).
@Profpatsch
Profpatsch / setup-nix-conf.sh
Created Jun 7, 2020
post-build-hooks in nix on circleci
View setup-nix-conf.sh
#!/bin/sh
set -eu
# copy post-build-hook script to /etc/nix
cp ./upload-to-cache.sh /etc/nix/
chmod a+x /etc/nix/upload-to-cache.sh
# fetch the secret key used to access the S3 cache bucket from the
# environment, and write to disk (it is used to by the
View mini_parse_http.rs
#[derive(Clone, Debug, PartialEq, Eq,)]
struct Parsed<'a> {
protocol: Protocol,
domain: &'a str,
port: &'a str,
rest: &'a str,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
enum Protocol {
@Profpatsch
Profpatsch / el_substitute.rs
Last active May 15, 2020
el_subsitute wrapper
View el_substitute.rs
extern crate errno;
extern crate libc;
extern crate ascii;
use std::ffi::{CStr, CString};
use ascii::AsciiStr;
#[repr(C)]
pub struct Stralloc_C {
s: *mut libc::c_char,
View build-purescript-tmp.nix
{ pkgs }:
let
lib = pkgs.lib;
in
# list of additional packages to add to the packageset
additionalPackages:
# source path of the package (derivation or (filtered) nix path)
assert (lib.all (pkg: pkg ? src) additionalPackages);
# dhall file of that package
@Profpatsch
Profpatsch / release.nix
Last active May 28, 2020
haskell refactor hydra jobset
View release.nix
attrs:
let
nixpkgs = import "${attrs.nixpkgs}/pkgs/top-level/release.nix" attrs;
in {
inherit (nixpkgs) haskellPackages;
}
@Profpatsch
Profpatsch / pass-shell.nix
Created Dec 13, 2019
shell.nix for a pass passwordstore (plus pre-commit hook to prevent leaking unencrypted secrets)
View pass-shell.nix
# sets up the environment in a way that adapts pass and git
# to work with the files in this repository instead of
# the global pass store.
let
pkgs = import <nixpkgs> {};
repository-dir = toString ./.;
git-hook-dir =
let
@Profpatsch
Profpatsch / spaccetthi.nix
Created Nov 18, 2019
Build purescript packages from spacchetthi definitions
View spaccetthi.nix
{ pkgs ? import ./nixpkgs.nix {} }:
with pkgs.lib;
let
dhallFiles = ../src;
# convert dhall packages set to a nix file
spacchettiNix = pkgs.runCommand "spacchetti.nix" {} ''
${pkgs.dhall-nix}/bin/dhall-to-nix \
View execline-table.dhall
-- TODO: loops, parameter handling, heredocs, string-munging
λ(markdownToHtml : Text Text)
let Prelude =
./imports/Prelude/package.dhall
let el =
λ(bash : Text)
λ(execline : Text)
{ bash = bash, execline = execline, note = None Text }
You can’t perform that action at this time.