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 / 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";

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 / 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 {
@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 / 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 / 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 / pass.md
Created April 27, 2020 12:14 — forked from abtrout/pass.md
Using password-store with git repository synching

Password-store keeps your passwords (or any other sensitive information) saved in GnuPG encrypted files organized in ~/.password-store. For more information about GPG, consult the GNU Privacy Handbook.

Getting started

To get started, install pass and generate a keypair.

$ brew install pass
$ gpg --gen-key
$ gpg --list-keys
@mtrsk
mtrsk / configuration.nix
Created June 21, 2020 20:22 — forked from evanjs/configuration.nix
nixpkgs terraria module - add home config
{ config, lib, pkgs, ... }:
{
services.sshd.enable = true;
services.terraria = {
enable = true;
home = "/srv/terraria";
};
nixpkgs.config.allowUnfree = true;
networking.firewall.allowedTCPPorts = [ 80 ];
@mtrsk
mtrsk / shell.nix
Created June 24, 2020 20:14
Multiple Python versions with poetry2nix
{ pkgs ? import <nixpkgs> {} }:
let
makeEnv = python: pkgs.poetry2nix.mkPoetryEnv {
python = python;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
overrides = [
pkgs.poetry2nix.defaultPoetryOverrides
(self: super: {
@mtrsk
mtrsk / podman-shell.nix
Created June 25, 2020 12:14 — forked from adisbladis/podman-shell.nix
Use podman within a nix-shell
{ pkgs ? import <nixpkgs> {} }:
let
# To use this shell.nix on NixOS your user needs to be configured as such:
# users.extraUsers.adisbladis = {
# subUidRanges = [{ startUid = 100000; count = 65536; }];
# subGidRanges = [{ startGid = 100000; count = 65536; }];
# };