Skip to content

Instantly share code, notes, and snippets.

View mtrsk's full-sized avatar
🛠️
Tinkering

Marcos Benevides mtrsk

🛠️
Tinkering
View GitHub Profile
@mtrsk
mtrsk / Nuget2Nix.fsx
Created April 24, 2020 14:23 — forked from steinuil/Nuget2Nix.fsx
Code for the .NET packaging post
open System
open System.IO
open System.Net
open System.Text.Json
open System.Collections.Generic
open System.Security.Cryptography
/// Taken from hash.cc in the nix codebase
/// https://github.com/NixOS/nix/blob/a7540294cfae82c098e8691cd5212a9184add574/src/libutil/hash.cc
module Base32 =
@mtrsk
mtrsk / overlays.nix
Last active September 3, 2019 13:57
Using Nix overlays for local Python Packages. Mostly stolen ideas from https://gist.github.com/Denommus/0a72f25ce858d6a68a0f53bd825c418d
self: super:
let
py-override = {
packageOverrides = python-self: python-super: {
altgraph = python-super.buildPythonPackage rec {
pname = "altgraph";
version = "0.16.1";
doCheck = false;
@mtrsk
mtrsk / shell.nix
Created July 19, 2019 12:45 — forked from aabs/shell.nix
A simple nix-shell script to establish an environment for Phoenix, Elixir and PostgreSQL development
{ nixpkgs ? import <nixpkgs> {}
, version ? "0.1"
, proxy ? "http://10.183.23.58:3128"
}:
with nixpkgs;
let
elixir = beam.packages.erlangR21.elixir_1_7;
nodejs = nodejs-10_x;
@mtrsk
mtrsk / shell.nix
Created July 19, 2019 12:45 — forked from aabs/shell.nix
nix shell for python dev
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
inherit (lib) optional optionals;
proxy = "<your proxy if you need one>";
in
mkShell {

Standard project structure

This is a project structure I’ve found useful. Looking for any thoughts/comments/feedback. Roughly, I found a tension between the style nixpkgs expects and the style conducive to development, so I extracted the common portion into a derivation.nix which is used by the remaining .nix files. This setup allows me to use nix build, nix-shell, overlays, Hydra, alternate packaging schemes, cross-compiling, etc.

@mtrsk
mtrsk / ipfs-service.nix
Created April 23, 2019 22:10
Nixos Systemd Daemons
{lib, options, pkgs, config, ...}:
{
systemd.services.ipfs-daemon = {
description = "IPFS Daemon";
wantedBy = [ "default.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "forking";
User = "usul";