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BZKZLEBWNL2ZWTBTYWKCTDTXDYUQC
ZV5WPO25EFV4XOPU7YDFKKJW4PMZK4JHMJYHZR54Z2NGV53NQF2QC
OB2MOPJ6NQDCF2OLLNHUR2JC4NQFNSNBRVFQJSF2USEI7ZMEX7HAC
NYO63G7WCBMM3I32U2JBIKK5YOINAXEKTBKGY4NQYPB5DUG5CM7QC
H2XT7GYIHF3SVEEX6BKEWKVSNCNLWEPKCAXKLK5SUK5TOX4OVESAC
M5U5PAX7ACFUIJKG2CLQKLEFF76KYMGI7WRZXFLOBR5LYBDEWFFAC
Because of how the command evaluation is structured, care must be taken with characters that bash might interpret, in particular `'`, `;`, and `|`, which may need escaping to `\'`, `\;`, and `\|` respectively.
Because of how the command evaluation is structured, care must be taken with characters that bash might interpret, escaping them where necessary.
h Putting wttr-delft into a container as a small static binary
, We now combine our knowledge of making OCI containers with our knowledge of making static binaries
h "Putting wttr-delft into a container as a small static binary"
, "We now combine our knowledge of making OCI containers with our knowledge of making static binaries"
n The more we offload to \'classic\' tools, the easier it is to also build without Nix.
, This makes it an easier sell to use in most cases\; other people are not forced to use it.
, Packaging in this way and making use of the sandboxed Nix build process
, can help find dependencies that were not correctly declared etc.
n "The more we offload to 'classic' tools, the easier it is to also build without Nix."
, "This makes it an easier sell to use in most cases; other people are not forced to use it,"
, "but can use the shared build system in their own environment if so desired."
, "Packaging in this way and making use of the sandboxed Nix build process"
, "can help find dependencies that were not correctly declared etc."
h We can very easily set up cross-compilation.
, We use the \'flake-utils\' library to abstract away some of the complications in the flake:
h "We can very easily set up cross-compilation:"
, "We use the 'flake-utils' library to abstract away some of the complications in the flake:"
, "This also demonstrates how easy it is to combine flakes."
h Everything together
, Static cross compiled for aarch64-linux - you can copy this executable and run it on a Raspberry Pi!
h "Everything together"
, "Static cross compiled binary for aarch64-linux - you can copy this executable and run it on a Raspberry Pi!"
n This will not work if the emulation is not available:
, But, if you use NixOS it\'s also very simple to set up binfmt to emulate e.g. aarch64-linux!
n "This will not work if the emulation is not available:"
, "But, if you use NixOS it's also very simple to set up binfmt to emulate e.g. aarch64-linux!"
h Putting wttr-delft into a container
, Expanding on the previous nix flake makes building a OCI compliant \(Docker\) image easy:
h "Putting wttr-delft into a container"
, "Expanding on the previous nix flake makes building a OCI compliant (Docker) image easy:"
n We have added the \'dockerCompat\' package so we can use the \'docker\' command instead of \'podman\'.
n "We have added the 'dockerCompat' package so we can use the 'docker' command instead of 'podman'."
, "In this demo we use it interchangably just to show we can."
h Making our own wttr-delft package
, For some reason, we want to have a simple C package that explicitly gets the weather in Delft.
, We\'re going to use \'libcurl\' for this, and build the executable using nix.
h "Making our own wttr-delft package"
, "For some reason, we want to have a simple C package that explicitly gets the weather in Delft."
, "We're going to use 'libcurl' for this, and build the executable using nix."
, Flakes are the unit for packaging Nix code in a reproducible and discoverable way.
, They can have dependencies on other flakes, making it possible to have multi-repository Nix projects.
, A flake is a filesystem tree \(typically fetched from a Git repository or a tarball\)
, that contains a file named flake.nix in the root directory.
, flake.nix specifies some metadata about the flake such as dependencies \(called inputs\),
, as well as its outputs \(the Nix values such as packages or NixOS modules provided by the flake\).
, "Flakes are the unit for packaging Nix code in a reproducible and discoverable way."
, "They can have dependencies on other flakes, making it possible to have multi-repository Nix projects."
, "A flake is a filesystem tree (typically fetched from a Git repository or a tarball)"
, "that contains a file named flake.nix in the root directory."
, "flake.nix specifies some metadata about the flake such as dependencies (called inputs),"
, "as well as its outputs (the Nix values such as packages or NixOS modules provided by the flake)."
h Maybe there was no output\; this means that package was already built and put into the Nix store
h "Maybe there was no output; this means that package was already built and put into the Nix store"
, "Let's build it again so we can see what happens under the hood"
h By default, we get a ./result symlink in the current working directory
x find -L "./result"
h "By default, we get a ./result symlink in the current working directory that points to the result of our build:"
x readlink -f ./result
x find -L "$(readlink -f ./result)"
h If we want to do development, we also get that \'for free\' with \'nix develop\':
n We do not have gcc available at the moment!
h "If we want to do development, we also get that 'for free' with 'nix develop':"
n "We do not have gcc available at the moment!"
h Getting the weather
, With Docker we might use \'docker run curlimages/curl wttr.in/Delft\'\;
, with Nix we can use
h "Getting the weather"
, "With Docker we might use 'docker run curlimages/curl wttr.in/Delft';"
, "with Nix we can use the following command:"
n In the curl example we were playing fast and loose: the nix run command would just take the latest version.
n But for cowsay, we pinned it to a particular revision of nixpkgs.
n "In the curl example we were playing fast and loose: the nix run command would just take the latest version."
n "But for cowsay, we pinned it to a particular revision of nixpkgs."