Skip to content

Instantly share code, notes, and snippets.

View AleXoundOS's full-sized avatar

AleXoundOS

  • Tbilisi, Georgia
  • 21:08 (UTC +04:00)
View GitHub Profile
@AleXoundOS
AleXoundOS / shell.nix
Last active April 6, 2019 21:23
nix shell configuration for building stack project with zlib dependency using binary GHC distribution
with (import <nixpkgs> {});
let
buildInputs = [haskell.compiler.ghc822Binary pkgconfig zlib];
in stdenv.mkDerivation {
name = "myUsbZlibEnv";
inherit buildInputs;
# For unknown reason libz.so cannot be found for linking without this
@AleXoundOS
AleXoundOS / find-fixed-outputs.nix
Last active September 27, 2019 06:17 — forked from LnL7/find-fixed-outputs.nix
Find fixed output derivations
# Copyright (c) 2003-2019 Eelco Dolstra, Daiderd Jordan, Alexander Tomokhov and
# the Nixpkgs/NixOS contributors.
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
# This expression returns a list of all fixed output derivations used by ‘expr’.
# eg.
# $ nix-instantiate find-fixed-outputs.nix --eval --strict --json --arg expr '(import <nixpkgs> {}).hello'
@AleXoundOS
AleXoundOS / ubootRock64.nix
Created February 8, 2020 20:44
uboot nix derivation for Rock64 with CONFIG_BAUDRATE=115200
{ lib, buildUBoot, fetchFromGitHub, armTrustedFirmwareRK3328 }:
let
rkbin = fetchFromGitHub {
owner = "ayufan-rock64";
repo = "rkbin";
rev = "f79a708978232a2b6b06c2e4173c5314559e0d3a";
sha256 = "0h7xm4ck3p3380c6bqm5ixrkxwcx6z5vysqdwvfa7gcqx5d6x5zz";
};
in buildUBoot {
extraMakeFlags = [ "all" "u-boot.itb" ];
@AleXoundOS
AleXoundOS / packet-iscsi.nix
Created September 7, 2020 09:06 — forked from bgamari/packet-iscsi.nix
A NixOS module for using Packet's iSCSI-based block storage infrastructure.
{ pkgs, config, lib, ... }:
let
packet-block-storage =
pkgs.stdenv.mkDerivation {
name = "packet-block-storage";
src = pkgs.fetchFromGitHub {
owner = "packethost";
repo = "packet-block-storage";
rev = "4be27cbca7a924b4de7af059d5ac30c2aa5c9e6f";
@AleXoundOS
AleXoundOS / patchwork4.hs
Last active April 6, 2023 13:28
haskell-diagrams simple patchwork 4
#! /usr/bin/env nix-shell
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [ diagrams-cairo (diagrams.overrideAttrs (def: { buildInputs = def.buildInputs ++ [ diagrams-cairo ]; configureFlags = def.configureFlags ++ [ \"-f cairo\" ]; })) ])"
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
-- import Diagrams.Backend.SVG.CmdLine
import Diagrams.Backend.Cairo.CmdLine
import Diagrams.Prelude
@AleXoundOS
AleXoundOS / MqttPublish.hs
Last active February 13, 2024 03:10
simple MQTT publish/subscribe over TLS shebang programs written in Haskell
#! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/cbe419ed4c8f98bd82d169c321d339ea30904f1f.tar.gz --tarball-ttl 4294967295
#! nix-shell -p "haskellPackages.ghcWithPackages (p: with p; [net-mqtt data-default])"
#! nix-shell -i "runhaskell -Wall"
-- This program builds itself and publishes given message to MQTT broker.
-- Copyright (C) 2024 Alexander Tomokhov
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@AleXoundOS
AleXoundOS / directory-contents-sha256.sh
Created October 22, 2023 14:23
reproducible tar (e.g. for comparing the whole contents of directories recursively)
# /usr/bin/env bash
set -o nounset
tar --sort=name --mtime=0 --owner=0 --group=0 --numeric-owner -c "$1" | sha256sum
with import ./. {};
let
extraSources = [];
lib = pkgs.lib;
optionsListVisible =
lib.filter (opt: opt.visible && !opt.internal)
(lib.optionAttrSetToDocList options);