Clean up strings

[?]
Mar 22, 2023, 7:05 PM
VUARRVTIHYO4S574PJNJYJ4CFNAV2TQZ7S2C5TCRBHSVI255FR7AC

Dependencies

Change contents

  • replacement in README.md at line 65
    [9.1668][2.8:218]()
    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.
    [9.1668]
    [9.925]
    Because of how the command evaluation is structured, care must be taken with characters that bash might interpret, escaping them where necessary.
  • replacement in 05-static-container/demo.sh at line 5
    [9.5725][9.5725:5762]()
    dir="$(dirname "${BASH_SOURCE[0]}")"
    [9.5725]
    [9.5762]
    dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
  • replacement in 05-static-container/demo.sh at line 9
    [9.5802][9.5802:5966]()
    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
    [9.5802]
    [9.5966]
    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"
  • replacement in 05-static-container/demo.sh at line 13
    [9.5999][9.18:40]()
    h Build the container
    [9.5999]
    [9.6053]
    h "Build the container"
  • replacement in 05-static-container/demo.sh at line 16
    [9.6078][9.41:76]()
    n It\'s a lot smaller than before!
    [9.6078]
    [6.18]
    n "It's a lot smaller than before!"
  • edit in 05-static-container/demo.sh at line 21
    [7.84][7.84:114]()
    h All done with this part!
    p
  • replacement in 05-static-container/demo-inside-nix-develop.sh at line 5
    [9.6277][9.6277:6314]()
    dir="$(dirname "${BASH_SOURCE[0]}")"
    [9.6277]
    [9.6314]
    dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
  • replacement in 05-static-container/demo-inside-nix-develop.sh at line 9
    [9.6354][9.6354:6426](),[9.6426][9.78:111]()
    h Now we are inside a development shell that has rootless podman again.
    , We repeat what we did earlier:
    [9.6354]
    [9.6426]
    h "Now we are inside a development shell that has rootless podman again."
    , "We repeat what we did earlier:"
  • replacement in 05-static-container/demo-inside-nix-develop.sh at line 12
    [9.6427][9.112:180]()
    h We start by loading the container we just made into the registry:
    [9.6427]
    [6.39]
    h "We start by loading the container we just made into the registry:"
  • replacement in 05-static-container/demo-inside-nix-develop.sh at line 15
    [9.6532][8.19:61]()
    h We can see it\'s there, and it\'s tiny!
    [9.6532]
    [9.6558]
    h "We can see it's there, and it's tiny!"
  • replacement in 05-static-container/demo-inside-nix-develop.sh at line 18
    [9.6612][9.6612:6637]()
    h And now we can run it:
    [9.6612]
    [9.6637]
    h "And now we can run it:"
  • replacement in 05-static-container/demo-inside-nix-develop.sh at line 21
    [9.6804][9.6804:6834]()
    h We have running containers:
    [9.6680]
    [9.6834]
    h "We have running containers:"
  • replacement in 05-static-container/demo-inside-nix-develop.sh at line 24
    [9.6900][9.6900:6936]()
    h Let\'s kill them and remove them:
    [9.6900]
    [9.6936]
    h "Let's kill them and remove them to clean up after ourselves..."
  • replacement in 04-cmake-and-cross/demo.sh at line 5
    [9.826][9.826:863]()
    dir="$(dirname "${BASH_SOURCE[0]}")"
    [9.826]
    [9.863]
    dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
  • replacement in 04-cmake-and-cross/demo.sh at line 11
    [9.903][9.903:918]()
    h Adding CMake
    [9.903]
    [9.918]
    h "Adding CMake"
  • replacement in 04-cmake-and-cross/demo.sh at line 13
    [9.919][9.919:1100](),[9.1100][9.280:421]()
    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.
    [9.919]
    [9.1214]
    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."
  • replacement in 04-cmake-and-cross/demo.sh at line 20
    [9.1259][9.1259:1358]()
    n If we add a proper build system like CMake, the Nix part of building a package gets even easier.
    [9.1259]
    [9.1358]
    n "If we add a proper build system like CMake, the Nix part of building a package gets even easier:"
  • replacement in 04-cmake-and-cross/demo.sh at line 26
    [9.1590][9.1590:1610](),[9.1610][9.422:511]()
    h Cross-compilation
    , The previous build was for x86_64-linux by default because that is our current system:
    [9.1486]
    [9.511]
    h "Cross-compilation"
    , "The previous build was for x86_64-linux by default because that is our current system:"
  • replacement in 04-cmake-and-cross/demo.sh at line 30
    [9.1611][9.552:599](),[9.599][9.1658:1752](),[9.1658][9.1658:1752]()
    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:
    [9.1611]
    [9.1752]
    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."
  • replacement in 04-cmake-and-cross/demo.sh at line 35
    [9.1785][9.600:638]()
    , Now we can call a different output:
    [9.1785]
    [9.929]
    , "Now we can call a different output:"
  • replacement in 04-cmake-and-cross/demo.sh at line 37
    [9.967][9.673:711](),[9.673][9.673:711]()
    , And this is indeed a RISC-V binary:
    [9.967]
    [9.711]
    , "And this is indeed a RISC-V binary:"
  • replacement in 04-cmake-and-cross/demo.sh at line 40
    [9.752][9.968:1033]()
    h Static executables
    , We can also cross compile a static build:
    [9.752]
    [9.1033]
    h "Static executables"
    , "We can also cross compile a static build:"
  • replacement in 04-cmake-and-cross/demo.sh at line 43
    [9.1064][9.1064:1102]()
    , And this is indeed a static binary:
    [9.1064]
    [9.1102]
    , "And this is indeed a static binary:"
  • replacement in 04-cmake-and-cross/demo.sh at line 47
    [9.1176][9.1176:1301]()
    h Everything together
    , Static cross compiled for aarch64-linux - you can copy this executable and run it on a Raspberry Pi!
    [9.1176]
    [9.1301]
    h "Everything together"
    , "Static cross compiled binary for aarch64-linux - you can copy this executable and run it on a Raspberry Pi!"
  • replacement in 04-cmake-and-cross/demo.sh at line 53
    [9.1420][9.752:850](),[9.752][9.752:850]()
    h Emulation
    , If we take a look at what the flake provides we see multiple architectures as well:
    [9.1420]
    [9.1833]
    h "Emulation"
    , "If we take a look at what the flake provides we see multiple architectures as well:"
  • replacement in 04-cmake-and-cross/demo.sh at line 57
    [9.1860][9.851:1002]()
    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!
    [9.1860]
    [9.1980]
    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!"
  • replacement in 04-cmake-and-cross/demo.sh at line 63
    [9.2139][9.1421:1459]()
    , And we can actually run it as well!
    [9.2139]
    [9.1459]
    , "And we can actually run it as well"
  • replacement in 03-nix-container/demo.sh at line 5
    [9.5159][9.5159:5196]()
    dir="$(dirname "${BASH_SOURCE[0]}")"
    [9.5159]
    [9.5196]
    dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
  • replacement in 03-nix-container/demo.sh at line 9
    [9.5236][9.5236:5366]()
    h Putting wttr-delft into a container
    , Expanding on the previous nix flake makes building a OCI compliant \(Docker\) image easy:
    [9.5236]
    [9.5366]
    h "Putting wttr-delft into a container"
    , "Expanding on the previous nix flake makes building a OCI compliant (Docker) image easy:"
  • replacement in 03-nix-container/demo.sh at line 13
    [9.5399][9.5399:5453]()
    h We now choose the \'container\' package we defined:
    [9.5399]
    [9.5453]
    h "We now choose the 'container' package we defined:"
  • replacement in 03-nix-container/demo.sh at line 15
    [9.5516][9.5516:5517]()
    [9.5516]
    [9.5517]
    , "Let's rebuild so we can see what happened..."
    , "This is a 'layered' image, so we might be able to re-use layers at the Docker level."
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 5
    [9.5779][9.5779:5816]()
    dir="$(dirname "${BASH_SOURCE[0]}")"
    [9.5779]
    [9.5816]
    dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 9
    [9.5856][9.5856:5977]()
    h Now we are inside a development shell that has rootless podman.
    , We can manipulate containers just like docker could.
    [9.5856]
    [9.5977]
    h "Now we are inside a development shell that has rootless podman."
    , "We can manipulate containers just like docker could."
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 12
    [9.5978][9.5978:6083]()
    n We have added the \'dockerCompat\' package so we can use the \'docker\' command instead of \'podman\'.
    [9.5978]
    [9.6083]
    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."
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 15
    [9.6084][9.6084:6155]()
    h So we start by loading the container we just made into the registry:
    [9.6084]
    [4.43]
    h "So we start by loading the container we just made into the registry:"
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 18
    [9.6192][9.6192:6218]()
    h We can see it\'s there:
    [9.6192]
    [5.216]
    h "We can see it's there:"
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 21
    [9.6270][9.6270:6295]()
    h And now we can run it:
    [9.6270]
    [9.6295]
    h "And now we can run it:"
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 24
    [9.6338][8.74:143]()
    h The image is somewhat minimal, e.g. there is no interactive shell:
    [9.6338]
    [9.6403]
    h "The image is somewhat minimal, e.g. there is no interactive shell:"
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 27
    [9.6462][9.6462:6492]()
    h We have running containers:
    [9.6462]
    [5.270]
    h "We have running containers:"
  • replacement in 03-nix-container/demo-inside-nix-develop.sh at line 30
    [9.6556][9.6556:6592]()
    h Let\'s kill them and remove them:
    [9.6556]
    [5.336]
    h "Let's kill them and remove them to clean up after ourselves..."
  • replacement in 02-nix-build/demo.sh at line 5
    [9.364][9.364:401]()
    dir="$(dirname "${BASH_SOURCE[0]}")"
    [9.364]
    [9.4178]
    dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
  • replacement in 02-nix-build/demo.sh at line 9
    [9.4239][9.4239:4452]()
    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.
    [9.4239]
    [9.4452]
    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."
  • replacement in 02-nix-build/demo.sh at line 13
    [9.4453][2.224:294]()
    h The source code is taken from https://curl.se/libcurl/c/simple.html
    [9.4453]
    [9.76]
    h "The source code is taken from https://curl.se/libcurl/c/simple.html"
  • replacement in 02-nix-build/demo.sh at line 16
    [9.4534][9.4534:4638]()
    h Using a Nix flake
    , The modern \(experimental, but recommended\) way to use Nix is to use \'flakes\':
    [9.4534]
    [9.4638]
    h "Using a Nix flake"
    , "The modern (experimental, but recommended) way to use Nix is to use 'flakes':"
  • replacement in 02-nix-build/demo.sh at line 19
    [9.4640][9.4640:5172]()
    , 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\).
    [9.4640]
    [9.5172]
    , "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)."
  • replacement in 02-nix-build/demo.sh at line 27
    [9.5175][9.5175:5210]()
    h So, what does a flake look like?
    [9.5175]
    [9.477]
    h "So, what does a flake look like?"
  • replacement in 02-nix-build/demo.sh at line 30
    [9.5267][9.5267:5308]()
    h Any inputs are pinned with a lock file
    [9.5267]
    [9.510]
    h "Any inputs are pinned with a lock file"
  • replacement in 02-nix-build/demo.sh at line 33
    [9.414][9.414:467]()
    h So, without further ado, let\'s build our package:
    [9.414]
    [9.552]
    h "So, without further ado, let's build our package:"
  • replacement in 02-nix-build/demo.sh at line 36
    [9.516][9.516:615]()
    h Maybe there was no output\; this means that package was already built and put into the Nix store
    [9.516]
    [9.577]
    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"
  • replacement in 02-nix-build/demo.sh at line 40
    [9.674][9.612:706]()
    h By default, we get a ./result symlink in the current working directory
    x find -L "./result"
    [9.674]
    [9.733]
    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)"
  • replacement in 02-nix-build/demo.sh at line 44
    [9.734][9.734:766]()
    h And we can run our executable
    [9.734]
    [9.707]
    h "And we can run our executable"
  • replacement in 02-nix-build/demo.sh at line 47
    [9.168][9.13:77]()
    h We can also just run the executable directly with \'nix run\'
    [9.168]
    [9.77]
    h "We can also just run the executable directly with 'nix run'"
  • replacement in 02-nix-build/demo.sh at line 51
    [9.259][9.12:96](),[9.96][9.97:143]()
    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!
    [9.259]
    [9.322]
    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!"
  • replacement in 02-nix-build/demo-inside-nix-develop.sh at line 5
    [9.488][9.827:864]()
    dir="$(dirname "${BASH_SOURCE[0]}")"
    [9.488]
    [9.864]
    dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
  • replacement in 02-nix-build/demo-inside-nix-develop.sh at line 9
    [9.548][9.190:231]()
    h Now we are inside a nix-develop shell!
    [9.548]
    [9.231]
    h "Now we are inside a nix-develop shell!"
  • replacement in 02-nix-build/demo-inside-nix-develop.sh at line 12
    [9.256][3.602:709]()
    n We started this script to continue the demo\; for normal use \'nix develop\' will drop you into a shell.
    [9.256]
    [3.709]
    n "We started this script to continue the demo; for normal use 'nix develop' will drop you into a shell."
  • replacement in 02-nix-build/demo-inside-nix-develop.sh at line 14
    [3.710][3.710:732]()
    h And we do have gcc:
    [3.710]
    [9.570]
    h "And we do have gcc:"
  • replacement in 02-nix-build/demo-inside-nix-develop.sh at line 17
    [9.582][3.733:821]()
    h Not only that, but Nix does all sorts of clever things such as wrapping the compiler:
    [9.582]
    [9.654]
    h "Not only that, but Nix does all sorts of clever things such as wrapping the compiler:"
  • replacement in 02-nix-build/demo-inside-nix-develop.sh at line 20
    [9.682][3.822:871]()
    h So that required libraries etc. are available:
    [9.682]
    [9.758]
    h "So that required libraries etc. are available:"
  • replacement in 02-nix-build/demo-inside-nix-develop.sh at line 23
    [9.841][3.872:900]()
    h And we can in fact build:
    [9.841]
    [9.901]
    h "And we can in fact build:"
  • replacement in 02-nix-build/demo-inside-nix-develop.sh at line 26
    [9.395][9.395:406]()
    h And run!
    [9.395]
    [9.962]
    h "And run!"
  • replacement in 01-nix-run/demo.sh at line 5
    [9.3829][9.987:1024]()
    dir="$(dirname "${BASH_SOURCE[0]}")"
    [9.3829]
    [9.1024]
    dir="$(realpath --relative-to="${PWD}" "$(dirname "${BASH_SOURCE[0]}")")"
  • replacement in 01-nix-run/demo.sh at line 9
    [9.3889][9.3889:3911](),[9.3911][9.469:565]()
    h Getting the weather
    , With Docker we might use \'docker run curlimages/curl wttr.in/Delft\'\;
    , with Nix we can use
    [9.3889]
    [9.1061]
    h "Getting the weather"
    , "With Docker we might use 'docker run curlimages/curl wttr.in/Delft';"
    , "with Nix we can use the following command:"
  • replacement in 01-nix-run/demo.sh at line 14
    [9.148][9.148:226]()
    n \'nixpkgs\' is a shorthand way to refer to the main Nix package repository.
    [9.148]
    [9.4083]
    n "'nixpkgs' is a shorthand way to refer to the main Nix package repository."
  • replacement in 01-nix-run/demo.sh at line 16
    [9.4084][9.4084:4132]()
    h But we may already have had curl on our path?
    [9.4084]
    [9.4132]
    h "But we may already have had curl on our path?"
  • replacement in 01-nix-run/demo.sh at line 19
    [9.4145][9.4145:4178]()
    h So to prove \'nix run\' works:
    [9.4145]
    [9.4178]
    h "So to prove 'nix run' actually works, choose a package we don't already have:"
  • replacement in 01-nix-run/demo.sh at line 23
    [9.323][9.323:501]()
    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.
    [9.323]
    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."