Skip to content

Instantly share code, notes, and snippets.

@globin
globin / configuration.nix
Created November 2, 2015 12:36
configuration.nix
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
boot = {
loader.grub = {
@globin
globin / comm.nix
Created October 25, 2015 14:27
IM service
{ pkgs, ... }:
{
# 9001 == weechat relay
networking.firewall.allowedTCPPorts = [ 9001 ];
systemd.services.comm = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "forking";
@globin
globin / config
Created September 25, 2015 14:51
.i3/config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@globin
globin / hydra.nix
Last active August 29, 2015 14:25
hydra
{ nixpkgs
, supportedSystems ? [ "x86_64-linux" ]
, system ? builtins.currentSystem
}:
with import <nixpkgs/pkgs/top-level/release-lib.nix> { inherit supportedSystems; };
let
jobs = mapTestOn (pkgsFor system);
in
@globin
globin / configuration.nix
Created March 13, 2015 14:46
ENABLE_CRYPTODISK grub2
{ config, pkgs, ... }:
{
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
# Define on which hard drive you want to install Grub.
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.enableCryptodisk = true;
boot.initrd.luks.devices = [ { name = "luksroot"; device = "/dev/sda2"; preLVM = true; } ];
@globin
globin / struct_gen.rs
Created October 26, 2014 16:32
struct_gen.rs
8:21: 8:33 error: cannot borrow immutable field as mutable
8 s_def.fields.push(Spanned {
^~~~~~~~~~~~
@globin
globin / struct_gen.rs
Created October 26, 2014 16:31
struct_gen.rs
8:21: 8:33 error: cannot borrow immutable field as mutable
8 s_def.fields.push(Spanned {
^~~~~~~~~~~~
@globin
globin / main.rs
Last active August 29, 2015 14:06
Cloneable Trait Object
extern crate http;
extern crate url;
extern crate semver;
extern crate serialize;
use std::os;
use std::str;
use std::cmp::max;
use std::io::File;
use std::sync::Future;
@globin
globin / function.rs
Last active August 29, 2015 14:06
FromIterator
fn packagist_versions_from_json<'a>(&self, json: &'a Json) -> Option<Version> {
json.find_path(&[&"package".to_string(), &"versions".to_string()])
.and_then(|versions_json| versions_json.as_object())
.and_then(|versions_map| {
versions_map.keys().map(|version_string| {
println!("version {}, {}", version_string, Version::parse(version_string.as_slice()));
Version::parse(version_string.as_slice()).ok()
}).fold(None, |a, b| {
match (a, b) {
==> host1: Forcing shutdown of VM...
==> host1: Destroying VM and associated drives...
==> host1: Running cleanup tasks for 'puppet' provisioner...
==> host2: Forcing shutdown of VM...
==> host2: Destroying VM and associated drives...
==> host2: Running cleanup tasks for 'puppet' provisioner...
Bringing machine 'host2' up with 'virtualbox' provider...
Bringing machine 'host1' up with 'virtualbox' provider...
==> host2: Importing base box 'hashicorp/precise64'...
==> host2: Matching MAC address for NAT networking...