- Past meeting notes
- Recording
- Matrix announcement
- Recorded by: @infinisil
- Lead by: @infinisil
- Meeting notes by: @Ericson2314
- Present members: @Ericson2314 @tomberek @infinisil @roberth @growpotkin
Notes
- After the last meeting @infinisil and @roberth discussed Allow variants in all-packages to use unit directories by roberth · Pull Request #27 · nixpkgs-architecture/simple-package-paths · GitHub and Specify args.nix file by infinisil · Pull Request #28 · nixpkgs-architecture/simple-package-paths · GitHub, rough notes: https://github.com/nixpkgs-architecture/meetings/blob/d5b653579ce76b7488b2eba9a2ed3f1726e21aa6/2023-01-09-post.md
- @Ericson2314: structure vs portion of package hanled trade-off.
Originally we just wanted:
# pkg-fun.nix
{ stdenv }: stdenv.mkDerivation { .. }
But because then adding callPackage overrides would cause people to have to move back to all-packages.nix
, something like
# args.nix
pkgs: { stdenv = pkgs.stdenv_noCC; }
would be good. But then @roberth is proposal to just generalize it fully like this:
# pkgs-attr.nix
pkgs: callPackage ./pkg-fun.nix { stdenv = pkgs.stdenv_noCC; }
Or even
# default.nix:
{ pkgs ? import ../.. {} }: pkgs.callPackage ./pkg-fun.nix { stdenv = pkgs.stdenv_noCC; }
-
@infinisil: Not isolated
-
@growpotkin: That’s the use case
-
@roberth: Allows later innovation with how packages are created, e.g. modular packages. Don’t like having to scan 5 files to determine what should happen, hard to contribute
-
@Ericson2314: Do we need any of these files?
-
@roberth: Well the
default.nix
allows for experimentation without changing the schema. -
@infinsil: Well what about enforcing the structure?
- It could in principle handle a lot of things that we want to put things out of scope.
-
@Ericson2314: Not always easy to conform to structure, but when you do there’s predictability. Fine as a preliminary pattern, we want better dependency specifications (e.g. splicing)
-
@tomberek: Invariant to expect from consumers?
- @roberth: Only use case is through readDir, directory structure isn’t a public interface
-
@infinisil: Ideal end state: Every file in a unit directory is a standard
-
@Ericson2314: What about internal/private files?
- @infinisil: Standard location for private files
-
@Ericson2314: What about internal/private files?
-
@tomberek: Interactions are hard, just readDir and callPackage is simple, maybe not as generic, minimize the interface
- @roberth: Simple for who? For contributors it would be easy to not have to look at rules declared by e.g. this team
-
@Ericson2314: String separation between describing inputs in terms of needs, done by the package, and outside world injecting dependencies which satisfy those needs.
-
@tomberek: In case we don’t want to use automatically used callPackage, have to dig into it, original function is “hidden”
- @roberth: Would have to use .override, shouldn’t dig into unit dirs
- @infinisil: Could expose unit directories as unstable API point
-
@Ericson2314: Overrides are often very related between packages
-
@infinisil: Like python/python3 pattern in all-packages.nix
- @Ericson2314: Should use version bounds or something like that
-
@infinisil: Like python/python3 pattern in all-packages.nix
-
@infinsil: Feels risky expanding something near the end of the RFC drafting.
-
@Ericson2314: So the problem we’re trying to solve is someone trying to write a unit file, and then they find actually they are outside what units handle, and then they need to start over / do things completely different.
- @roberth: Yes.
-
@Ericson2314: what if we separate units we autocall vs units we don’t autocall vs non units?
-
@roberth: We could come back to allowing access to unit directories from all-packages.nix
- So that we don’t need args.nix / default.nix / whatever
- It’s more powerful than those solutions
-
@tomberek: Allows paying down technical debts, passing arguments is technical debt, have a firewall against technical debt into unit directory
- @Ericson2314: +1
- @infinisil: +1
-
@tomberek: What if you ask directly for the thing you want, like
pkg-funs.hello-and-cowsay
.- @roberth: Doesn’t have all the right arguments, needs some duplication
-
@roberth: Simple solution: Allow all-packages.nix to call into unit dirs
-
pkgs/unit/foo/foo
andfoo = callPackage ./some/other/dir {}
-
@ericson2314: two dirs
- manual units (all packages calls)
- auto units (sharded dir auto-call)
- all-packages.nix and auto units shoudl be disjoint
-
@infinisil: Could do CI check to make sure it’s a
callPackage <unit dir>
, not another dir, if there is a unit directory- @roberth: config.callPackageDuplicationCheck
- @infinisil: Generic config.checkNoConflictingAttributes
-
@Ericson2314: Require a
callUnit
notcallPackage
, for nowcallUnit = callPackage
or so but presumably would change in the future. Maybe only for CI for now
-
@Ericson2314: Put something in unit directory to indicate whether it’s being called from all-packages.nix
-
@roberth: all-packages.nix is on top of auto called packages in the overlay layering
-
Tool should only move attributes without arguments in the callPackage call
Simple solution to just allow all-packages.nix to refer to unit directories with CI checks consensus
- @infinisil
- @roberth
- @Ericson
- @tomberek
- @growpotkin
Some code we looked at
-
@growpotkin:
pkg-fun.nix
understanding check with variants
Some relatively generic builder similar tolinkFarm
, in this case it builds a package
that symlinkshello
andcowsay
, but a variant of the package will addfzf
.
# unit/hell/hello-and-cowsay/pkg-fun.nix
{ stdenv, lndir, paths }:
stdenv.mkDerivation {
name = "hello-and-cowsay";
argsList = builtins.concatStringsSep "\n" (
builtins.attrValues ( builtins.mapAttrs ( t: f:
"mkdir -p ${t}; lndir ${f} ${t};"
) paths )
);
passAsFile = ["argsList"];
nativeBuildInputs = [lndir];
buildCommand = ''. "$argsListPath";'';
}
# unit/hell/hello-and-cowsay/default.nix
{ pkgs ? import ../../.. {}
, lib ? import ../../../lib {}
, stdenv ? pkgs.stdenv
, xorg ? pkgs.xorg
, lndir ? xorg.lndir
, hello ? pkgs.hello
, cowsay ? pkgs.cowsay
, paths ? { hello = hello.outPath; cow = cowsay.outPath; }
}: lib.makeOverridable ( import ./pkg-fun.nix ) {
inherit stdenv lndir paths;
}
The variant
unit/hell/hello-cowsay-and-fzf/default.nix
{ pkgs ? import ../../.. {}
, stdenv ? pkgs.stdenv
, xorg ? pkgs.xorg
, lndir ? xorg.lndir
, hello ? pkgs.hello
, cowsay ? pkgs.cowsay
, fzf ? pkgs.fzf
, hello-and-cowsay ? pkgs.hello-and-cowsay
, paths ? {
hello = hello.outPath;
cow = cowsay.outPath;
"sub/fzf" = "${fzf}/bin";
}
}: ( hello-and-cowsay.override {
inherit stdenv lndir paths;
} ).overrideDrvAttrs ( _: {
name = "hello-cowsay-and-fzf";
} )
Action items
-
everbody: Go through the entire RFC draft in GitHub - nixpkgs-architecture/simple-package-paths: Nix RFC draft for auto-calling packages in nixpkgs and make a PR for anything that needs changing
-
@growpotkin to test Test `all-packages.nix`-like performance to `builtins.readDir` with and without sharding · Issue #23 · nixpkgs-architecture/simple-package-paths · GitHub
- Create flat and sharded directories (with counts 10000, 100000, 1000000)
- Turn the directories to a single attribute set
hyperfine nix-instantiate --eval -E 'builtins.seq { < the set > } null'
-
@infinisil will continue writing the tooling in Add a simple tool to print Nix path references by infinisil · Pull Request #22 · nixpkgs-architecture/simple-package-paths · GitHub
-
@Ericson2314 will talk to the Cargo people on Zulip about sharding. @infinisil will have an account so @Ericson2314 can ping and not be single point of failure.
- Ask git too, maybe. They do for
.git/objects
.-
@growpotkin: I’d be shocked if GitHub knew implementation details of
git
objects.
-
@growpotkin: I’d be shocked if GitHub knew implementation details of
- Ask git too, maybe. They do for