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-unwrappedis the program;pkgs.populate,writeDeploy, and the other functions keep their arguments, andpkgs.populatealso takes a target string. - Populate holds a lock on
.populate/lockwhile 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. Afilesource'srecordsetting 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 needsflock. - 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>withnix-build.pkgs.populateputs util-linux, gnupatch, grep, and sed inPATHas well. lib/with.nixis krops' lib without nixpkgs' lib, which it takes from its caller, e.g. a flake'snixpkgs.lib.pkgs.krops,pkgs.populateand krops' flake use the nixpkgs lib they get, instead of<nixpkgs/lib>.lib/default.nixstays for backwards compatibility, merging<nixpkgs/lib>, builtins, andlib/with.nix.- krops works in pure evaluation, e.g. in flakes without
--impure. Target strings go to populate as they are, also fromwriteDeploy,writeCommand, andwriteTest, andrunShell, which runsnixos-rebuild, runs the newpopulate shell, which decides whether a target is local when it runs. In pure evaluation,mkTargetleaves 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.runShellreturns shell code, also for remote targets. - A
passagesource'sidentities_filedefaults to~/.passage/identitieswhen populate runs, instead of during evaluation. evalSourceleaves out a source whose type is set to null, e.g. with the newoptionalSource, 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
gitsource'surlorref, or apasssource'sname, for an option. gitsources also refuse work trees in which a submodule's.gitisn't a file naming a repository in.git/modules, unlessrecloneis set.- Drawing inputs refers to a source in a Git work tree as
git+file:only if agitsource would use its.gitdirectory, and it has no hooks, and else aspath:. gitsources with a branch or tag asreffollow it: populate fetches the branch or tag on every run, and resets the work tree to what it fetched.writeDeploy's newallocateTTYrunsnixos-rebuildwith a terminal.
1.31.0
- New source types
flakeandflake-inputdeliver 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. WithfetchOnTarget, the target fetches them itself, which also works withsudo. inputsdraws inputs of the flake in a source from other sources, by rewriting its lock file, or through a generated flake.flakeandflake-inputsources can also getpatchesapplied, and bematerialized as writable copies.writeDeploydeploys a flake from a source with its newflakeparameter.pruneremoves 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
/, andgitsources refuse work trees whose.gitdirectory names places elsewhere, unlessrecloneis set. - With rsync 3.5.0 or later, populating a
filesource fails if rsync can't read.rsync-filterfiles that apply to it;insecureLinksdecides what to do instead. writeDeploypasses--use-remote-sudoonly with a separatebuildTarget, and--no-flakeif/etc/nixos/flake.nixexists and no flake gets deployed.- krops' flake provides krops' functions, and NixOS VM tests in
tests/cover populate.
