Skip to content

Instantly share code, notes, and snippets.

View deepfire's full-sized avatar

Kosyrev Serge deepfire

View GitHub Profile
@deepfire
deepfire / ceph-benaco.nix
Created January 20, 2024 14:15 — forked from nh2/ceph-benaco.nix
Open-sourcing Benaco's NixOS Ceph service module
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.ceph-benaco;
inherit (pkgs.callPackage ../helpers.nix {}) ensureUnitExists;
in

Keybase proof

I hereby claim:

  • I am deepfire on github.
  • I am serge_kosyrev (https://keybase.io/serge_kosyrev) on keybase.
  • I have a public key ASD2nUFY_nUScYAt147A-oLj5TQzYeKs2vakDKy0_n2XjAo

To claim this, I am signing this object:

@deepfire
deepfire / Ix.hs
Last active March 31, 2018 23:30
Index into an HList by another
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UnicodeSyntax #-}
import GHC.TypeLits
import GHC.Types
@deepfire
deepfire / SOP.hs
Last active March 30, 2018 01:27
ghci SOP.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
import GHC.Types
import GHC.TypeLits
###
### GHC HEAD in nix-shell Nano-HOWTO
###
#
# 1. Choose GHC git REVision
# 2. Determine Nix hash (requires `nix-prefetch-scripts`) of the GHC source tree for the chosen revision:
nix-prefetch-git git://git.haskell.org/ghc.git --fetch-submodules --rev $REV
@deepfire
deepfire / gist:67fe4c73e25aee0b32417b9e5bb162e3
Last active August 31, 2017 01:38
Alternative decode for systemd String/[Word8] strings
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, UnicodeSyntax #-}
module Foo where
import Data.Foldable (asum)
import Data.Aeson as AE
import Data.Aeson.Types as AE
import qualified Data.ByteString.Lazy as BL
import Data.ByteString.Lazy.Char8 (ByteString)
import qualified Data.ByteString.Lazy.UTF8 as LBU
with import <nixpkgs> {};
let vendorgl = linuxPackages.nvidia_x11.overrideAttrs (oldAttrs: rec {
libsOnly = true;
kernel = null;
name = "nvidia-x11-367.27-${pkgs.linuxPackages.kernel.version}";
src = fetchurl {
url = "http://download.nvidia.com/XFree86/Linux-x86_64/367.27/NVIDIA-Linux-x86_64-367.27.run";
sha256 = "0000000000000000000000000000000000000000000000000000";
};
});
@deepfire
deepfire / nix-builds
Created August 28, 2016 16:19
nix-builds: suspend/resume/observe the nix-build demon activity
#!/bin/sh
mapcflip () {
local xs=$1; shift
local x
for x in $(echo $xs | sed 's/,/ /g')
do
$(echo $@ | sed s/%/$x/)