Skip to content

Instantly share code, notes, and snippets.

View bennofs's full-sized avatar
🎯
Focusing

Benno Fünfstück bennofs

🎯
Focusing
View GitHub Profile
@bennofs
bennofs / example.nix
Created October 17, 2015 22:52
default to different mtl + explicit override
let
# First, let's get a haskellPackages set to play around with
haskellPackages = (import <nixpkgs> {}).haskellPackages;
# Change the default mtl
haskellPackagesMtl = haskellPackages.override {
overrides = self: super: {
mtl = super.mtl_2_1_3_1;
};
};
@bennofs
bennofs / reflex.org
Created October 28, 2015 17:03
reflex notes

Module overview

Reflex.Class: generic definition of FRP, operations on Events / Behaviors

provides functions for working with events and behaviors

should be imported by users of an FRP-based framework

does not deal with connecting to the outside world, for example creating events from external sources

Reflex.Dynamic: discrete behaviors

Provides the Dynamic data type, a combination of Behavior and Event

Behavior always contains the current value, Event is fired whenever current value changes

-> Behavior is only updated at the end of the current frame, after event propagation

Reflex.Host.Class: generic framework implementation support

@bennofs
bennofs / acme-year-2014.nix
Created November 12, 2015 16:13
haskell package overriding
{ mkDerivation, base, stdenv, time }:
mkDerivation {
pname = "acme-year";
version = "2014";
sha256 = "0zml370s8zv9y60hggv0hlwb3rhmixhdp37cz496dbpffdkw70my";
libraryHaskellDepends = [ base ];
testHaskellDepends = [ base time ];
homepage = "http://github.com/joeyadams/hs-acme-year";
description = "Get the current year";
license = stdenv.lib.licenses.publicDomain;
@bennofs
bennofs / $ stack --nix build
Created May 10, 2016 15:41
Stack solver weird behavior
Cabal file warning in /data/code/cabal/cabal-install/cabal-install.cabal: Ignoring unknown section type: custom-setup
Cabal file warning in /data/code/cabal/cabal-install/cabal-install.cabal: Ignoring unknown section type: custom-setup
No packages found in snapshot which provide a "ghc" executable, which is a build-tool dependency of "HTTP"
Missing build-tools may be caused by dependencies of the build-tool being overridden by extra-deps.
This should be fixed soon - see this issue https://github.com/commercialhaskell/stack/issues/595
While constructing the BuildPlan the following exceptions were encountered:
-- Failure when adding dependencies:
network-uri: needed (==2.6.*), couldn't resolve its dependencies
@bennofs
bennofs / doc.md
Last active March 25, 2025 18:15
Overview of the NixOS X11 session modules

How X11 is started

In the following example, sddm will be used as a display manager. The process is however similar for other display managers in nixpkgs and a summary that applies to all nixpkgs display managers is given at the end.

  1. Systemd unit "display-manager.service" starts services.x11.displayManager.job.execCmd (the display manager)

    Code reference: <nixpkgs>/nixos/modules/services/x11/xserver.nix

  2. services.x11.displayManager.job.execCmd is set to the path of the sddm binary from the sddm package in the nix store. So SDDM will start and read its configuration from /etc/sddm.conf.

with (import <nixpkgs> {}); # get nixpkgs
let
intero = null; # derivation to build intero goes here
interoFor = interoEnv: stdenv.mkDerivation {
buildInputs = [ makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
for binary in ${intero}/bin/*; do
let
nixpkgs = (import <nixpkgs> {}).pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "964665eb1c75e0bb596e08a92a6c872b5ae06a31";
sha256 = "11f0hrc9ayba0qqbwrxp7i4nk6vr0vn21943b6c3x8ffdhsl0jzx";
};
in import nixpkgs {}
{
packageOverrides = pkgs: {
haskell = pkgs.haskell // {
packages = pkgs.haskell.packages // {
ghc7103 = pkgs.haskell.packages.ghc7103 // {
Glob = pkgs.haskell.lib.overrideCabal pkgs.haskell.packages.ghc7103.Glob (args: {
buildDepends = (args.buildDepends or []) ++ [pkgs.haskell.packages.ghc7103.semigroups];
});
};
};
{
packageOverrides = pkgs: {
haskell = pkgs.haskell // {
packages = pkgs.haskell.packages // {
ghc7103 = pkgs.haskell.packages.ghc7103.override {
overrides = self: super: {
Glob = pkgs.haskell.lib.overrideCabal super.Glob (args: {
buildDepends = (args.buildDepends or []) ++ [self.semigroups];
});
};
@bennofs
bennofs / default.nix
Last active August 7, 2017 19:50
Nix self/super override challenges. Solutions: https://gist.github.com/bennofs/65af82328bbd0c0e5db19d2a99070cc7
let
# Imports
nixpkgs = import <nixpkgs> {};
inherit (nixpkgs) lib;
inherit (lib) mapAttrs fix extends;
# Helpers
makeExtendable = base:
fix base // {
extend = f: makeExtendable (extends f base);