Skip to content

Instantly share code, notes, and snippets.

View domenkozar's full-sized avatar
💭
I may be slow to respond.

Domen Kožar domenkozar

💭
I may be slow to respond.
View GitHub Profile
@domenkozar
domenkozar / nix-error-messages-gig.md
Last active November 28, 2019 16:08
Nix error messages gig

Nix error messaging improvements

The goal is to improve beginner experience in Nix.

1. Create github.com/NixOS/nix-message-catalog

Go through Nix issues, move those related to error messages in our new repo.

2. Display the snippet of code where the error happened based on the source position

{-# LANGUAGE ScopedTypeVariables #-}
import GHC.Stack
import Control.Exception
import Data.Functor
g :: HasCallStack => IO Bool
g = throwIO $ SomeException $ userError "foo"
f :: HasCallStack => IO ()
f = void $ g
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
</head>
<body>
<dev id="pricing-elm"></div>
<div id="footer-elm"></div>
@domenkozar
domenkozar / kiosk-chromium.nix
Last active January 24, 2024 14:05
Boot NixOS into chromium kiosk (tested on NixOS 14.04)
services.xserver = {
enable = true;
monitorSection = ''
Option "NODPMS"
'';
serverLayoutSection = ''
Option "BlankTime" "0"
Option "DPMS" "false"
'';
displayManager.auto.user = "guest";
@domenkozar
domenkozar / backup.nix
Created January 3, 2019 11:42
backup.nix
{ config, pkgs, ... }:
let
uuid = "91434e29-edf5-42b7-b339-43d3a1d58359";
backup = pkgs.writeScript "usb-backup.sh" ''
#!/bin/sh
export DISPLAY=:0.0
SECONDS=0
#!/usr/bin/env nix-shell
#!nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [servant-server servant-auth-server servant-streaming-server ])"
#!nix-shell -I https://github.com/NixOS/nixpkgs/archive/299814b385d2c1553f60ada8216d3b0af3d8d3c6.tar.gz
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ScopedTypeVariables #-}
• No instance for (Servant.Auth.Server.Internal.AddSetCookie.AddSetCookies
('Servant.Auth.Server.Internal.AddSetCookie.S
('Servant.Auth.Server.Internal.AddSetCookie.S
'Servant.Auth.Server.Internal.AddSetCookie.Z))
(Handler
(Streaming.Internal.Stream
(Data.Functor.Of.Of ByteString)
(Control.Monad.Trans.Resource.Internal.ResourceT IO)
()))
(ServerT
• Could not deduce (ToJSON a0)
from the context: ToJSON a
bound by the type of the constructor ‘Remove’:
forall a. ToJSON a => Operation
at src/MixPanel/Types/EngageData.hs:20:5-35
The type variable ‘a0’ is ambiguous
• In the ambiguity check for ‘Remove’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the definition of data constructor ‘Remove’
In the data type declaration for ‘Operation’
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "foo";
src = builtins.path {
name = "foo";
path = ./.;
};
buildPhase = ":";
/nix/store/83lrbvbmxrgv7iz49mgd42yvhi473xp6-glibc-2.27
/nix/store/8zkg9ac4s4alzyf4a8kfrig1j73z66dw-bash-4.4-p23
/nix/store/h1g0xkx70kj4znj6i8x607qgzcg28pjk-ghc-8.4.3-doc
/nix/store/cakidv5508i1j3qhv473hi935lqj2m7d-split-0.2.3.3-doc
/nix/store/zikcg4s36w5k6fvlba2h4p4riw1qc7fp-gcc-7.3.0-lib
/nix/store/hhzvw77vrmn5f506kfyb1yh1sdinkbwf-gmp-6.1.2
/nix/store/q8rg4mca5zqv98arpxd7164pqa72hf1n-ncurses-6.1
/nix/store/yyv98fx38riz5q2sfhfsqbn6c9byri9y-zlib-1.2.11
/nix/store/4qvrxzxa535y8304mk195x50b6p9607d-binutils-2.30
/nix/store/d6cnw2lkarcx6h7jacla9pb8bfygax4j-expand-response-params