BP57Q2OGN6FSNZMZPVVB2BQFL3TBYRLDO63AGYQTBEE5HBQGXF2QC
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
# Our package name
name = "wttr-delft";
# Where the source code lives
src = builtins.path { path = ../src; name = name; };
# Dependencies
buildInputs = [
pkgs.curl.dev
];
# The source code contains only the C file, so we 'manually' compile
# Note: If we were using Make/CMake/autoconf, the mkDerivation function
# could handle those automatically.
# gcc is available by default in pkgs.stdenv.mkDerivation
buildPhase = "gcc -lcurl -o wttr-delft ./simple.c";
# Installing is just copying the executable
installPhase = "mkdir -p $out/bin; install -t $out/bin wttr-delft";
}
{ pkgs }:
let
registriesConf = pkgs.writeText "registries.conf" ''
[registries.search]
registries = ['docker.io']
[registries.block]
registries = []
'';
storageConf = pkgs.writeText "storage.conf" ''
[storage]
driver = "overlay"
# rootless_storage_path="$XDG_DATA_HOME/containers/storage"
'';
in pkgs.writeShellScript "podman-setup" ''
# Dont overwrite customised configuration
if ! test -f ~/.config/containers/policy.json; then
echo "Installing missing ~/.config/containers/policy.json"
install -Dm644 ${pkgs.skopeo.src}/default-policy.json ~/.config/containers/policy.json
fi
if ! test -f ~/.config/containers/registries.conf; then
echo "Installing missing ~/.config/containers/registries.conf"
install -Dm644 ${registriesConf} ~/.config/containers/registries.conf
fi
if ! test -f ~/.config/containers/storage.conf; then
echo "Installing missing ~/.config/containers/storage.conf"
install -Dm644 ${storageConf} ~/.config/containers/storage.conf
fi
''
# The source code contains only the C file, so we 'manually' compile
# Note: If we were using Make/CMake/autoconf, the mkDerivation function
# could handle those automatically.
# gcc is available by default in pkgs.stdenv.mkDerivation
buildPhase = "gcc -lcurl -o wttr-delft ./simple.c";
# Installing is just copying the executable
installPhase = "mkdir -p $out/bin; install -t $out/bin wttr-delft";
};
podmanSetupScript = let
registriesConf = pkgs.writeText "registries.conf" ''
[registries.search]
registries = ['docker.io']
[registries.block]
registries = []
'';
storageConf = pkgs.writeText "storage.conf" ''
[storage]
driver = "overlay"
# rootless_storage_path="$XDG_DATA_HOME/containers/storage"
'';
in pkgs.writeShellScript "podman-setup" ''
# Dont overwrite customised configuration
if ! test -f ~/.config/containers/policy.json; then
echo "Installing missing ~/.config/containers/policy.json"
install -Dm644 ${pkgs.skopeo.src}/default-policy.json ~/.config/containers/policy.json
fi
if ! test -f ~/.config/containers/registries.conf; then
echo "Installing missing ~/.config/containers/registries.conf"
install -Dm644 ${registriesConf} ~/.config/containers/registries.conf
fi
if ! test -f ~/.config/containers/storage.conf; then
echo "Installing missing ~/.config/containers/storage.conf"
install -Dm644 ${storageConf} ~/.config/containers/storage.conf
fi
'';
podmanSetupScript = import ./podman-setup-script.nix { inherit pkgs; };