Skip to content

Instantly share code, notes, and snippets.

@matejc
matejc / bash
Last active August 29, 2015 14:03
mwahaha
{
meta = {
description = "GNU Bourne-Again Shell, the de facto standard shell on Linux";
homepage = "http://www.gnu.org/software/bash/";
license = "GPLv3+";
longDescription = "Bash is the shell, or command language interpreter, that will\nappear in the GNU operating system. Bash is an sh-compatible\nshell that incorporates useful features from the Korn shell\n(ksh) and C shell (csh). It is intended to conform to the IEEE\nPOSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers\nfunctional improvements over sh for both programming and\ninteractive use. In addition, most sh scripts can be run by\nBash without modification.\n";
maintainers = ["Peter Simons <simons@cryp.to>"];
position = "/home/matej/workarea/nixpkgs/pkgs/shells/bash/default.nix:62";
priority = "10";
};
@matejc
matejc / gist:2e5e0f7a3d801364dd0b
Last active February 15, 2016 13:07
neo's solution?
#!/usr/bin/env bash
MYCOMMAND='while [ true ]; do sleep 1; echo "beje"; done'
# This will take down the whole process tree on ctrl+c
trap "exit" INT TERM
trap "kill 0" EXIT
while true; do
sleep 1;
{ pkgs ? import /home/matej/workarea/nixpkgs {} }:
let
# When upgrading node.nix / node packages:
# fetch package.json from package's repository
# run `npm2nix package.json node.nix`
# and replace node.nix with new one
nodePackages = import /home/matej/workarea/nixpkgs/pkgs/top-level/node-packages.nix {
inherit pkgs;
inherit (pkgs) stdenv nodejs fetchurl fetchgit;
<StreamWriter(gpgi-output(--detach-sign --armor), started daemon 139644666103552)>(gpgi-output(--detach-sign --armor)/write): 10 bytes left
Traceback (most recent call last):
File "/nix/store/xiwsgb5va80dbswcvqmx13992kmj7di9-python2.7-mailpile-0.4.0/lib/python2.7/site-packages/mailpile/crypto/gpgi.py", line 365, in writeout
fd.write(line)
IOError: [Errno 32] Broken pipe
@matejc
matejc / installation
Created November 15, 2014 01:45
haskell packages installation example
nix-env -iA yesod -f packages.nix
@matejc
matejc / packages.nix
Last active August 29, 2015 14:10
generate packages info in Nix
# run it as: nix-instantiate packages.nix --eval --strict --show-trace
let
# set allowBroken and allowUnfree to true, so that we minimize error output later on
pkgs = import <nixpkgs> { config = { allowBroken = true; allowUnfree = true; }; };
# catch exceptions on isDerivation function
tryDrv = a: builtins.tryEval (pkgs.lib.isDerivation a);
isDerivation = a: let t = tryDrv a; in t.success && t.value == true;
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.wal;
servers = {
nginx = import ./nginx.nix;
};
@matejc
matejc / configuration.nix
Last active August 29, 2015 14:21
lid suspend
acpid.enable = true;
acpid.lidEventCommands = ''
if [ ! -f /tmp/suspend.lock ]; then
touch /tmp/suspend.lock;
/run/current-system/sw/bin/systemctl suspend;
else
rm /tmp/suspend.lock;
fi
'';
systemd.services."my-post-suspend" =
{ description = "Post-Suspend Actions";
wantedBy = [ "suspend.target" ];
after = [ "post-sleep.service" ];
script =
''
sleep 3 && systemctl restart docker
'';
serviceConfig.Type = "simple";
};
{ pkgs, config, lib }:
let
somescript = pkgs.writeScriptBin "somescript.sh" ''
#!${pkgs.stdenv.shell}
some shell commands ...
'';
in {