Skip to content

Instantly share code, notes, and snippets.

View mtrsk's full-sized avatar
🛠️
Tinkering

Marcos Benevides mtrsk

🛠️
Tinkering
View GitHub Profile

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 / 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 / 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; }];
# };
@mtrsk
mtrsk / analysis.draft.md
Created August 8, 2020 18:59 — forked from MattPD/analysis.draft.md
Program Analysis Resources (WIP draft)
{ pkgs ? import <nixpkgs> {}}:
let
jupyterPort = pkgs.config.jupyterPort;
fhs = pkgs.buildFHSUserEnv {
name = "julia-fhs";
targetPkgs = pkgs: with pkgs;
[
git
gitRepo
{ config, lib, pkgs, ...}:
with lib;
let
cfg = config.services.batteryNotifier;
in {
options = {
services.batteryNotifier = {
enable = mkOption {