Skip to content

Instantly share code, notes, and snippets.

Avatar
💲
nixified

Jonas Chevalier zimbatm

💲
nixified
View GitHub Profile
View wait_port.sh
# Small function that checks if a TCP port on localhost is open.
#
# Timeout after 10 attempts.
#
# Usage: wait_port <port>
wait_port() (
local i=0 port=$1
echo "waiting on port $port"
# Bash has a magic filesystem that can be used to do basic TCP.
#
View htpasswd.tf
variable "users" {
type = list(string)
default = ["bob"]
}
resource "random_password" "passwords" {
for_each = toset(var.users)
length = 32
special = false
}
View BUILD.nix
{ pkgs, callPackage }:
let
evalHome = import "${toString pkgs.sources.home-manager}/modules";
in
{
home-manager = evalHome {
configuration = ./home-manager.nix;
lib = pkgs.lib;
pkgs = pkgs;
};
View kaniko.sh
#!/usr/bin/env bash
#
# A small bash wrapper to kaniko with a few assumptions built in.
set -euo pipefail
context=$1
dockerfile=$2
destination=$3
cache=true
cache_repo=$(echo "$destination" | cut -d : -f 1)-cache
View default.nix
lib: prev: {
servant-client-core = lib.doJailbreak (lib.dontCheck (prev.callPackage ./servant-client-core.nix { }));
servant-multipart = lib.doJailbreak (lib.dontCheck (prev.callPackage ./servant-multipart.nix { }));
generic-lens = lib.doJailbreak (lib.dontCheck (prev.callPackage ./generic-lens.nix { }));
servant-client = lib.doJailbreak (lib.dontCheck (prev.callPackage ./servant-client.nix { }));
servant-foreign = lib.doJailbreak (lib.dontCheck (prev.callPackage ./servant-foreign.nix { }));
servant = lib.doJailbreak (lib.dontCheck (prev.callPackage ./servant.nix { }));
servant-server = lib.doJailbreak (lib.dontCheck (prev.callPackage ./servant-server.nix { }));
protolude = lib.doJailbreak (lib.dontCheck (prev.callPackage ./protolude.nix { }));
openapi3 = lib.doJailbreak (lib.dontCheck (prev.callPackage ./openapi3.nix { }));
View update.sh
#!/usr/bin/env bash
# Run this script to update the dependencies
set -euo pipefail
# This is the list of dependencies that should be generated using `cabal2nix`.
# The left-hand side is the name of the package, and .nix file that will be
# generated.
# The right-hand side is a `cabal2nix`-compatible URI.
declare -A dependencies=(
[protolude]=cabal://protolude-0.3.0 # password-instances depends on this
View sway.nix
{ pkgs, lib, ... }: {
imports = [
./wayland.nix
];
home.packages = with pkgs; [
brightnessctl
#dmenu
grim # screenshot CLI
i3status-rust # menu bar
View rebuild
#!/usr/bin/env bash
set -euo pipefail
targetHost=$(basename "$(dirname "$(readlink -f "$0")")")
hostname=$(< /proc/sys/kernel/hostname)
args=(
--flake ".#$targetHost"
--use-remote-sudo
)
View nix.yml
on: [ push ]
jobs:
nix:
name: 'Nix'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
View providers.tf
terraform {
required_providers {
aws = { source = "hashicorp/aws" }
external = { source = "hashicorp/external" }
github = { source = "nixpkgs/github" }
google = { source = "nixpkgs/google" }
hcloud = { source = "nixpkgs/hcloud" }
linuxbox = { source = "numtide/linuxbox" }
null = { source = "hashicorp/null" }
random = { source = "hashicorp/random" }