Split up flake

[?]
Mar 21, 2023, 5:09 PM
BP57Q2OGN6FSNZMZPVVB2BQFL3TBYRLDO63AGYQTBEE5HBQGXF2QC

Dependencies

Change contents

  • file addition: wttr-delft.nix (----------)
    [2.10]
    { 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";
    }
  • file addition: podman-setup-script.nix (----------)
    [2.10]
    { 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
    ''
  • edit in 03-nix-container/flake.nix at line 12
    [2.441][2.441:690]()
    # Declare our own package as a Nix 'derivation'
    wttr-delft = pkgs.stdenv.mkDerivation rec {
    # Our package name
    name = "wttr-delft";
    # Where the source code lives
    src = builtins.path { path = ../src; name = name; };
  • replacement in 03-nix-container/flake.nix at line 13
    [2.691][2.691:765]()
    # Dependencies
    buildInputs = [
    pkgs.curl.dev
    ];
    [2.691]
    [2.765]
    # wttr-delft is still the same, just moved to another file for clarity
    wttr-delft = import ./wttr-delft.nix { inherit pkgs; };
  • edit in 03-nix-container/flake.nix at line 16
    [2.766][2.766:1216]()
    # 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";
    };
  • replacement in 03-nix-container/flake.nix at line 39
    [2.1931][2.1931:3133]()
    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
    '';
    [2.1931]
    [2.3133]
    podmanSetupScript = import ./podman-setup-script.nix { inherit pkgs; };