aboutsummaryrefslogtreecommitdiffstats

Changes

Unreleased

  • Populate is a program of its own, written in Rust, in pkgs/populate, with a command line, a Nix library, a README, and tests of its own. The store gets one program for each version of krops, instead of a script for each set of arguments. pkgs.populate-unwrapped is the program; pkgs.populate, writeDeploy, and the other functions keep their arguments, and pkgs.populate also takes a target string.
  • Populate holds a lock on .populate/lock while it runs, which consumers of the target directory can wait for with a shared lock, and writes the record of each run that delivers everything to .populate/run.json: whether anything changed since the last record, for each source, and what got delivered. A file source's record setting can add the commit of the Git work tree it's in, whether that's dirty, and a hash of what got delivered. The sentinel is a directory, which a sentinel file becomes, and the target needs flock.
  • Populate runs shell code with /bin/sh. If the target lacks commands populate runs there, flock, rsync, patch, Git, grep, sed, or findutils, populate warns, and gets them from the target's <nixpkgs> with nix-build. pkgs.populate puts util-linux, gnupatch, grep, and sed in PATH as well.
  • lib/with.nix is krops' lib without nixpkgs' lib, which it takes from its caller, e.g. a flake's nixpkgs.lib. pkgs.krops, pkgs.populate and krops' flake use the nixpkgs lib they get, instead of <nixpkgs/lib>. lib/default.nix stays for backwards compatibility, merging <nixpkgs/lib>, builtins, and lib/with.nix.
  • krops works in pure evaluation, e.g. in flakes without --impure. Target strings go to populate as they are, also from writeDeploy, writeCommand, and writeTest, and runShell, which runs nixos-rebuild, runs the new populate shell, which decides whether a target is local when it runs. In pure evaluation, mkTarget leaves the user and the host null, and target attribute sets leave whether they're local to populate, which also refuses to copy flakes to targets using sudo then. runShell returns shell code, also for remote targets.
  • A passage source's identities_file defaults to ~/.passage/identities when populate runs, instead of during evaluation.
  • evalSource leaves out a source whose type is set to null, e.g. with the new optionalSource, which returns a type's settings if a condition holds, and else null.

1.31.1

  • Drawing an input from a source that isn't a directory stops populate, instead of locking the flake with an empty URL, which Nix takes for the current directory, copying it into the store: on a remote target, the login directory.
  • Git can't take a git source's url or ref, or a pass source's name, for an option.
  • git sources also refuse work trees in which a submodule's .git isn't a file naming a repository in .git/modules, unless reclone is set.
  • Drawing inputs refers to a source in a Git work tree as git+file: only if a git source would use its .git directory, and it has no hooks, and else as path:.
  • git sources with a branch or tag as ref follow it: populate fetches the branch or tag on every run, and resets the work tree to what it fetched.
  • writeDeploy's new allocateTTY runs nixos-rebuild with a terminal.

1.31.0

  • New source types flake and flake-input deliver a flake, or one input of a flake as its lock file pins it, as a link into the store, with garbage collector roots for its inputs. With fetchOnTarget, the target fetches them itself, which also works with sudo.
  • inputs draws inputs of the flake in a source from other sources, by rewriting its lock file, or through a generated flake. flake and flake-input sources can also get patches applied, and be materialized as writable copies.
  • writeDeploy deploys a flake from a source with its new flake parameter.
  • prune removes everything from the target directory that isn't a configured source.
  • Populate never changes or removes anything outside the target directory: a symlink at the target path of a source gets replaced instead of written through, source names must be portable file names, target paths must be absolute and not /, and git sources refuse work trees whose .git directory names places elsewhere, unless reclone is set.
  • With rsync 3.5.0 or later, populating a file source fails if rsync can't read .rsync-filter files that apply to it; insecureLinks decides what to do instead.
  • writeDeploy passes --use-remote-sudo only with a separate buildTarget, and --no-flake if /etc/nixos/flake.nix exists and no flake gets deployed.
  • krops' flake provides krops' functions, and NixOS VM tests in tests/ cover populate.