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 / README.md
Last active February 14, 2023 08:19
nixos + e-residency

Install card drivers

   services.pcscd.enable = true;
   services.pcscd.plugins = [ pkgs.acsccid ];
   environment.systemPackages = [ pkgs.qdigidoc ];

Verify access to the card

$ qdigidoc4
{ nixpkgs ? (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.09.tar.gz)
, system ? builtins.currentSystem
}:
let
haskellnix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz);
overlay = _: pkgs:
let
hnPkgs = pkgs.haskell-nix.stackProject {
src = ./.;
@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 February 28, 2025 15:47
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’