From 36181e19ccef8d86d53dc5d504eb382c7d9b25fe Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 14 Nov 2026 04:09:35 +0000 Subject: krops: use lib/with.nix everywhere, and no with lib/default.nix is for backwards compatibility only, so the examples in the README and ci.nix use lib/with.nix, as klib, with nixpkgs' lib from pkgs. pkgs.populate and its checks name what they use from nixpkgs' lib, builtins, and klib, instead of bringing them into scope with with, and the scenarios inherit what they use from the builder and nixpkgs' lib, which the builder doesn't pass on anymore. Nix tells undefined names when parsing then, and a name means the same wherever it's used. The derivations and the scenarios stay the same. --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index d71a6d0..2fb83b5 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,10 @@ let sha256 = "07mg3iaqjf1w49vmwfchi7b1w55bh7rvsbgicp2m47gnj9alwdb6"; }; - lib = import "${krops}/lib"; pkgs = import "${krops}/pkgs" {}; + klib = import "${krops}/lib/with.nix" { inherit (pkgs) lib; }; - source = lib.evalSource [{ + source = klib.evalSource [{ nixpkgs.git = { clean.exclude = ["/.version-suffix"]; ref = "4b4bbce199d3b3a8001ee93495604289b01aaad3"; @@ -75,9 +75,8 @@ machine that uses them. krops' flake provides `populate`, `writeDeploy`, and the other functions described below as `lib.`, and its `lib` directory provides -`evalSource` and `mkTarget`. `lib/with.nix` is a function taking nixpkgs' -lib, as below; `lib/default.nix` merges it, with ``, into -nixpkgs' lib and builtins: +`evalSource` and `mkTarget` in `lib/with.nix`, krops' lib, a function +taking nixpkgs' lib: ```nix { @@ -87,12 +86,12 @@ nixpkgs' lib and builtins: outputs = { self, krops, nixpkgs, ... }: let system = "x86_64-linux"; - lib = import "${krops}/lib/with.nix" { inherit (nixpkgs) lib; }; + klib = import "${krops}/lib/with.nix" { inherit (nixpkgs) lib; }; in { apps.${system}.deploy = { type = "app"; program = toString (krops.lib.${system}.writeDeploy "deploy" { - source = lib.evalSource [{ + source = klib.evalSource [{ nixos-config.file = toString ./configuration.nix; nixpkgs.flake-input = { url = toString self; name = "nixpkgs"; }; }]; @@ -142,7 +141,7 @@ Example: ```nix pkgs.krops.writeDeploy "deploy" { source = /* ... */; - target = lib.mkTarget "user@host/path" // { + target = klib.mkTarget "user@host/path" // { extraOptions = [ "-o" "LogLevel=DEBUG" ["-i" "/path/to/identity/file"] @@ -325,7 +324,7 @@ that means. ## Source Types -`lib.evalSource` turns sources, written in Nix, into what `pkgs.populate` +`klib.evalSource` turns sources, written in Nix, into what `pkgs.populate` passes to populate. [populate's README](pkgs/populate/README.md#source-types) describes the source types: `derivation`, `file`, `flake`, `flake-input`, `git`, `pass`, `passage`, -- cgit v1.3.1