Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Latest commit

 

History

History
168 lines (107 loc) · 2.71 KB

2023-01-09-post.md

File metadata and controls

168 lines (107 loc) · 2.71 KB

Discussed nixpkgs-architecture/simple-package-paths#27 with @roberth, resulting in nixpkgs-architecture/simple-package-paths#28

These notes are rather unorganized, but contain some ideas

{ python }:
python.buildPythonApplication {

}
{ python ? python3, python3 }:
python.buildPythonApplication {

}
foo = callPackage ./path/to/foo {
  python = python3;
}

nixpkgs

unit directory

graphviz = callPackage ./path/to/graphviz {}

Makes .override on graphviz propagate

builtins.potentialInfiniteRecursionErrorContext ""

builtins.addErrorContextUnderSomeUnspecifiedCondition graphviz-nox "foo" (graphviz.override { ... })

graphviz-nox = builtins.addErrorContext "If you want to make graphviz-nox the default graphviz, use ${__curPos} instead" (self.graphviz.override { xlib = null; })

Last nixpkgs overlay that calls addErrorContext for all package attributes

builtins.unsafeGetAttrPos "<nixpkgs>" super

1000 that depend on graphviz

Makes graphviz-nox default work

graphviz-nox = callPackage ./path/to/graphviz { xlib = null; }

user

graphviz = super.graphviz.override self.graphviz-nox.arguments;

graphviz = super.graphviz.override { xlib = null; }

aliases = { graphviz = [ "graphviz-nox" ] pythonPackages = [ "python" "pkgs" ]; }

aliases = { pythonPackages = mkForce [ "python3" "pkgs" ]; }

config = { noXlibs = true; }

options.services.foo = lib.mkOption { type = types.submodule [ ./options ./defaults ]; }

config.services.foo = { imports = [ ./dangerous.nix ]; };

automatic

unit.graphviz = callPackage ./path/to/graphviz; graphviz = unit.graphviz {};

graphviz = unit.graphviz {} //(lazy) { override = new: unit.graphviz new; }

all-packages.nix

graphviz-nox = self.graphviz.override { xlibs = null; }

./unit/grap/graphviz-nox/alias-override.nix

{ aliasedTo = [ "graphviz" ]; override = { xlibs = false; }; }

user

graphviz = self.graphviz-nox;

import { extraUnits = ./some/extras; overriddenUnits = ./some/overrides; }

repo1, foo/default.nix

stdenv.mkDerivation {

}

repo2, foo/default.nix

{ foo }: foo.override { ... }

repo2, ordering.nix

{ foo.parent = "repo1"; }

unit overlay

graph = callPackage ./unit/graph {};

middle overlay (user-provided)

graph = super.graph.override { xlib = null; }

all-packages.nix overlay

graph-nox = super.graph.override { xlib = null; }

end overlay (user provided)

graph = self.graph-nox;

#graphviz/default.nix { stdenv, lib, xlibs, config, enableXlibs ? ! config.noXlib } stdenv.mkDerivation { buildInputs = lib.optional xlibsEnable xlibs }

Orthogonal