YWKMJUZSMGPLNHIWS4AWTAEHKZMIWKXCR26LC2GRB6G7BIH5G5BQC
OB2MOPJ6NQDCF2OLLNHUR2JC4NQFNSNBRVFQJSF2USEI7ZMEX7HAC
KJRAWJO43HGO44XMS6VGHA4WYYYQB2VLUPS662IME2IKMPVLG5MAC
X3HISPCS4DYF7L5FA6WA2L2SJNO2FAALGFYFLFUQNPNQQENX3CVAC
52F4Q6CJCVIEVT576TSP2YUN54ZCEFXHYZWNV4BGHWDASTURAXFQC
7AUC4NKIYIKUZMHNOVCCVGPDO3BO3D56XULZXTXRFBTPDG27J7DQC
ZV5WPO25EFV4XOPU7YDFKKJW4PMZK4JHMJYHZR54Z2NGV53NQF2QC
Weather report: Delft
.-. Light rain shower
( ). +12(10) °C
(___(__) ↑ 20 km/h
‘ ‘ ‘ ‘ 10 km
‘ ‘ ‘ ‘ 0.8 mm
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Thu 23 Mar ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ _`/"".-. Patchy rain po…│ _`/"".-. Patchy rain po…│ \ / Partly cloudy │ Overcast │
│ ,\_( ). +10(7) °C │ ,\_( ). +12(10) °C │ _ /"".-. +12(10) °C │ .--. +11(8) °C │
│ /(___(__) ↗ 33-49 km/h │ /(___(__) ↗ 32-39 km/h │ \_( ). ↗ 26-36 km/h │ .-( ). ↑ 25-39 km/h │
│ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │ /(___(__) 10 km │ (___.__)__) 10 km │
│ ‘ ‘ ‘ ‘ 0.1 mm | 72% │ ‘ ‘ ‘ ‘ 0.1 mm | 72% │ 0.0 mm | 0% │ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Fri 24 Mar ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ \ / Partly cloudy │ \ / Sunny │ _`/"".-. Patchy rain po…│ \ / Partly cloudy │
│ _ /"".-. +9(6) °C │ .-. +11(8) °C │ ,\_( ). +11(7) °C │ _ /"".-. +10(5) °C │
│ \_( ). ↗ 31-43 km/h │ ― ( ) ― ↗ 35-40 km/h │ /(___(__) ↗ 40-49 km/h │ \_( ). ↗ 40-57 km/h │
│ /(___(__) 10 km │ `-’ 10 km │ ‘ ‘ ‘ ‘ 10 km │ /(___(__) 10 km │
│ 0.0 mm | 0% │ / \ 0.0 mm | 0% │ ‘ ‘ ‘ ‘ 0.1 mm | 79% │ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Sat 25 Mar ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ _`/"".-. Patchy rain po…│ _`/"".-. Patchy rain po…│ _`/"".-. Patchy rain po…│ _`/"".-. Light rain sho…│
│ ,\_( ). +9(4) °C │ ,\_( ). +10(6) °C │ ,\_( ). +11(7) °C │ ,\_( ). +9(6) °C │
│ /(___(__) ↗ 39-54 km/h │ /(___(__) ↗ 40-50 km/h │ /(___(__) ↗ 38-49 km/h │ /(___(__) → 32-49 km/h │
│ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 9 km │ ‘ ‘ ‘ ‘ 10 km │
│ ‘ ‘ ‘ ‘ 0.1 mm | 76% │ ‘ ‘ ‘ ‘ 0.1 mm | 68% │ ‘ ‘ ‘ ‘ 0.2 mm | 80% │ ‘ ‘ ‘ ‘ 0.3 mm | 79% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Location: Delft, MRDH, Zuid-Holland, Nederland [51.9994572,4.362724538544]
Follow @igor_chubin for wttr.in updates
# This file looks very similar to what official packages in nixpkgs look like
{ stdenv
, cmake
, pkgconfig
, curl
}:
stdenv.mkDerivation rec {
name = "wttr-delft";
src = builtins.path { path = ../src; name = name; };
# Build-time dependencies
# Since we include CMake, Nix will automatically do all the right things:
# We don't need a custom 'buildPhase' or 'installPhase' anymore.
nativeBuildInputs = [ cmake pkgconfig ];
# Dependencies
buildInputs = [ curl.dev ];
# Strict separation of
# nativeBuildInputs (needed at build time only) and
# buildInputs (needed at runtime as well)
strictDeps = true;
}
{
description = "Example for making a container image with a static binary";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
# Disable some CURL features
curl-minimal = (prev.curl.overrideAttrs (finalAttrs: prevAttrs: {
# Force static build
configureFlags = (prevAttrs.configureFlags or []) ++ [ "--enable-static" "--disable-shared" ];
})).override {
brotliSupport = false;
# krb5 fails to build with mingw
gssSupport = false;
zstdSupport = false;
scpSupport = false;
# Force static build
nghttp2 = ((prev.nghttp2.overrideAttrs (finalAttrs: prevAttrs: {
configureFlags = (prevAttrs.configureFlags or []) ++ [ "--enable-static" "--disable-shared" ];
postPatch = ''
sed -i '1i #define NGHTTP2_STATICLIB' lib/includes/nghttp2/nghttp2.h
'';
})).override {
# tzdata fails to build with mingw: undefined reference to setenv
enableTests = false;
});
# Force static build
libidn2 = prev.libidn2.overrideAttrs (finalAttrs: prevAttrs: {
configureFlags = (prevAttrs.configureFlags or []) ++ [ "--enable-static" "--disable-shared" ];
});
zlib = prev.zlib.override { static = true; shared = false; };
};
wttr-delft = (prev.callPackage ./wttr-delft.nix { curl = final.curl-minimal; }).overrideAttrs (finalAttrs: prevAttrs: {
# Force static build
cmakeFlags = [
"-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
"-DCMAKE_EXE_LINKER_FLAGS=-static"
];
# This is just so we don't get colour output, it looks bad when running through wine
postPatch = ''
sed -i 's|https://gitlab.com/SFrijters/nix-container-demo/-/raw/master/data/weather-static|https://wttr.in/Delft?T|' simple.c
sed -i '44i curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl");' simple.c
'';
});
})
];
};
in
{
packages = {
default = pkgs.wttr-delft;
mingw32 = pkgs.pkgsCross.mingw32.wttr-delft;
mingwW64 = pkgs.pkgsCross.mingwW64.wttr-delft;
};
devShells.default = import ./podman-devshell.nix { inherit pkgs; };
}
);
}
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1679396235,
"narHash": "sha256-RjmNVFuZQ2e6u35B98JcY9IzVDtZb3d4QcbtfLtNWkE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "008ce261a7e3c532e792cb8e39482f2cc1b192f5",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
#!/usr/bin/env bash
# shellcheck disable=SC1010,SC2288
set -Eeuo pipefail
dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
source "${dir}/../libdemo/libdemo.sh"
file_cmd="nix run github:nixos/nixpkgs/008ce261a7e3c532e792cb8e39482f2cc1b192f5#file"
h "Cross-compiling a static binary for Windows"
, "Not all platforms are equally well supported, in particular mingw is only supported at Tier 4"
, "See the appendix at https://github.com/NixOS/rfcs/blob/master/rfcs/0046-platform-support-tiers.md"
n "In short: here be dragons!"
i tiv "${dir}/../data/sideeyingchloe.png"
h "We use overrides to force and fix static builds for required libraries"
, "We also strip away some functionality we don't need to make life a bit easier,"
, "and make some small modifications to our own package in the same way:"
x pygmentize "${dir}/flake.nix"
h "Build the package in 64bit mode"
x nix build "${dir}#mingwW64" -L
h "This is a Windows executable!"
x "${file_cmd}" ./result/bin/wttr-delft.exe
h The pièce de résistance!
x "WINEPREFIX=$(readlink -f "${dir}/wttr-delft") nix run github:nixos/nixpkgs/008ce261a7e3c532e792cb8e39482f2cc1b192f5#wine64 -- ./result/bin/wttr-delft.exe"
06-windows/wttr-delft