2. DEPENDENCY HELLDEPENDENCY HELL
“When people stop valuing simplicity over complexity“When people stop valuing simplicity over complexity
~ Barbara Liskov”~ Barbara Liskov”
3. HELL ISHELL IS
Dependencies > ApplicationDependencies > Application
npm install --save gatsby
…
+ gatsby@2.19.28
added 1 package from 1 contributor, removed 9 packages,
updated 10 packages and audited 19001 packages in 40.382s
4. HELL ISHELL IS
Long Chains & Con ictingLong Chains & Con icting
a
e
z
b c1
c2
d
f
9. SOLVINGSOLVING
Cycles via BootStrappingCycles via BootStrapping
Minimal System of a few dozen cyclical packagesMinimal System of a few dozen cyclical packages
Capable of providing dependencies for any otherCapable of providing dependencies for any other
packagepackage
Makes system harder to backdoorMakes system harder to backdoor
i.e.i.e. GentooGentoo
10. SOLVINGSOLVING
Con icts via AlternativesCon icts via Alternatives
vivi && vimvim
Di erent programs, aliased due toDi erent programs, aliased due to commoncommon
expectationexpectation
11. SOLVINGSOLVING
via Atomicity / Transactionalityvia Atomicity / Transactionality
Not available in legacy systemsNot available in legacy systems
Windows, Debian, RhelWindows, Debian, Rhel
12. SOLVINGSOLVING
via System Rollback / Versioningvia System Rollback / Versioning
Provided Transactionality existsProvided Transactionality exists
State of system is justState of system is just versioned snapshotsversioned snapshots
Package manager = transition function betweenPackage manager = transition function between
snapshotssnapshots
13. WHY SO MUCH PAIN?WHY SO MUCH PAIN?
Filesystem Hierarchy Standard (FHS) - via Linux -Filesystem Hierarchy Standard (FHS) - via Linux -
fundamentally incompatible with reproducibilityfundamentally incompatible with reproducibility
Version?Version?
Libraries used?Libraries used?
Flags during build?Flags during build?
14. AUTHOR /AUTHOR /
MAINTAINER CONTROLMAINTAINER CONTROL
AuthorAuthor
Typically more up-to-dateTypically more up-to-date
Wander in standards & readabilityWander in standards & readability
MaintainerMaintainer
Typically more stableTypically more stable
Rigor inRigor in same as other packagessame as other packages / Linted/ Linted
15. BINARY BLOBSBINARY BLOBS
App StoresApp Stores
OCI ContainersOCI Containers
SNAP / Flatpack / AppImageSNAP / Flatpack / AppImage
Ignore most of the issues with Package ManagersIgnore most of the issues with Package Managers
17. LANGUAGES ARELANGUAGES ARE
SUPERIORSUPERIOR
AllowAllow LooseLoose versioningversioning ^1.0.0^1.0.0
Unable to manageUnable to manage otherother languageslanguages
Vary in quality depending on languages.Vary in quality depending on languages. MustMust
supportsupport pinningpinning
npm cinpm ci
vsvs pip installpip install ++ pip toolspip tools
18.
19. NPM BUILDNPM BUILD
649 Dependencies to build NPM649 Dependencies to build NPM
NPMNPM neededneeded to build & manage NPMto build & manage NPM
CanCan be package manager for an Operatingbe package manager for an Operating
SystemSystem
NodeOSNodeOS
23. NIX BUILD NPMNIX BUILD NPM
25 Dependencies25 Dependencies
1 Extra Dependency than required to run NodeJS1 Extra Dependency than required to run NodeJS
25. NIXNIX
“NIX can be the future of computing… if we can nd a“NIX can be the future of computing… if we can nd a
better way to explain it ~ Burke Libbey”better way to explain it ~ Burke Libbey”
26. NIX: STORENIX: STORE
Fixes FHS via:Fixes FHS via:
Directed Acrylic Graph (DAG) via lesystemDirected Acrylic Graph (DAG) via lesystem
DAG / StoreDAG / Store isis a Database, queries as sucha Database, queries as such
nix store query referencesnix store query references
/nix/store/zp9i44m81fmnkgrc9zz2yc3p/nix/store/zp9i44m81fmnkgrc9zz2yc3p
nix-2.3.6nix-2.3.6
Maintains integrity when directly copied between maMaintains integrity when directly copied between ma
(same architecture)(same architecture)
28. EXPLAINING NIXEXPLAINING NIX
Maintenance / Upgrading a carMaintenance / Upgrading a car
Debian et al: Working on your car in yourDebian et al: Working on your car in your
own garage… results can varyown garage… results can vary
NIX: 3D Printing a new car every timeNIX: 3D Printing a new car every time
something changessomething changes
31. EXPLAINING NIXEXPLAINING NIX
NIX is:NIX is:
A Language (producingA Language (producing .drv.drv) into) into
A Store (building / executing) viaA Store (building / executing) via
A Sandbox assembling part / all ofA Sandbox assembling part / all of
An Operating System via *nixAn Operating System via *nix
Some or all functionality can be usedSome or all functionality can be used
33. DEMO: HELLO WORLDDEMO: HELLO WORLD
helloWorld.nix
with import <nixpkgs> {};
let
# Use the let-in clause to assign the derivation to a variable
myScript = pkgs.writeShellScriptBin "helloWorld" "echo Hello Wo
in
stdenv.mkDerivation rec {
name = "test-environment";
# Add the derivation to the PATH
buildInputs = [ myScript ];
}
37. DEMO: CURL.NIXDEMO: CURL.NIX
curl.nix
with import <nixpkgs> {};
let
# The ${...} is for string interpolation
# The '' quotes are used for multi-line strings
simplePackage = pkgs.writeShellScriptBin "whatIsMyIp" ''
${pkgs.curl}/bin/curl http://httpbin.org/get
| ${pkgs.jq}/bin/jq --raw-output .origin
'';
in
stdenv.mkDerivation rec {
name = "test-environment";
buildInputs = [ simplePackage ];
}