- Previous meeting notes
- Attendees: @zmitchell @maj @infinisil @ehmry @henrik-ch
- Notes taken by: @infinisil
Notes
-
@infinisil: Maybe more asynchronous work, shorter meetings?
- @zmitchell: Meetings good for figuring things out quickly
- @infinisil: We have a small roadmap now, could work on that now before trying to figure out more things
- @zmitchell: Need to ensure we’re not wasting time on the wrong things. There’s no product we’re trying to get out, no rush.
- @infinisil: Cadence matters a bit imo, docs team is fairly slow, 3 hour of meetings per week doesn’t justify the low amount of asynchronous work
- @zmitchell: Had to get the team off the ground first, look at project boards, figuring out the direction
- Tracking issue for tutorials: Tutorials overview · Issue #572 · NixOS/nix.dev · GitHub
- @zmitchell: Previous tutorials all about entering environments.
- @zmitchell: Next tutorial: Doing a build, leading to sharing between shell.nix and default.nix
-
@zmitchell:
default.nix
andshell.nix
are very similar -
@infinisil: I feel like always having a
default.nix
is a good convention,shell.nix
only refers to.shell
fromdefault.nix
-
@henrik-ch: Tutorial on how to migrate a
shell.nix
to adefault.nix
? -
@khaled: I thought there might be a step where we introduce a
default.nix
- @infinisil: And then point out the problem how updating one doesn’t update the other?
-
@zmitchell:
shell.nix
only makes sense if you want extra things not in thedefault.nix
- @infinisil: Makes sense
-
@infinisil: How about creating a separate
default.nix
in the tutorial that creates the build -
@zmitchell:
buildPythonApplication
orstdenv.mkDerivation
. Most people won’t do C stuff, rather language-specific stuff-
@infinisil:
stdenv.mkDerivation
is only lightly tied to C
-
@infinisil:
- @zmitchell: At some point show how arbitrary commands in a build can be done, but not now
-
@zmitchell: What should be built?
- @infinisil: Python
-
@infinisil: Tutorial proposal:
- Explain how we haven’t built our own code purely yet, only entered an environment and might have called
pip install
or so. Explain how that’s impure.- Sandbox? Disabled by default on Darwin
- Create a
shell.nix
to have an environment containingcargo/rustc
, then enter it and build the project impurely in the environment- @zmitchell: Needs to be before the next step
- Start by creating a simple project to demonstrate from within the environment, which language?
- Try just
runCommand "myProject" {} "pip build"
?- @zmitchell: Problem, no way to build a python project
-
@zmitchell:
python setup.py build wheel
, but annoying to write asetup.py
file -
@khaled:
pyproject.toml
? -
@zmitchell: How about Rust, there’s an easy command to build that.
- @infinisil: Sounds good, compiled language makes it clear what is being built
-
@zmitchell: Go also exists
- @infinisil: Sounds interesting, deps.nix is nice
- @ehmry: That’s deprecated
- @khaled: go.sum exists
-
@zmitchell: We can use
cargo new --bin my_proj
to get a working project
- Try just
- Build it impurely in the environment → works
- Make sure that we’re not using any dependencies → no internet required, works in the sandbox
Create adefault.nix
with a
Observe failure, explain it (source isn’t available)runCommand "myProject" { ... } '' cargo build ''
Explain howrunCommand "myProject" { ... } '' cd ${./.} cargo build ''
${}
imports paths into the store
Fails with not writable
Fails: $out emptyrunCommand "myProject" { ... } '' cp ${./.} . chmod +w . -R cargo build ''
Then show howrunCommand "myProject" { ... } '' # copy the source cp ${./.} . chmod +w . -R # build cargo build # install mkdir -p $out/bin mv target/debug/myProject $out/bin ''
mkDerivation
makes this easier:stdenv.mkDerivation { name = "myProject"; src = ./.; buildPhase = '' cargo build ''; installPhase = '' mkdir -p $out/bin mv target/debug/myProject $out/bin ''; };
- @zmitchell: That’s probably enough for the first tutorial
-
@khaled: Unsure about this direction. Should we assume knowledge of previous tutorials?
- Showed Python tutorial, shouldn’t we continue the previous one?
- Did we go the Rust path because there’s no easy build step for Python?
-
@zmitchell: Python is hard, building it at all and figuring out Python-specific build stuff. Comparatively, Rust is pretty straightforward
- We should teach one hard thing at a time, e.g. showing a build at all, iteratively showing why it fails, learning one thing at a time.
- Later we can show the Python stuff
-
@khaled: Rust-specific things still need to be done
-
@zmitchell:
cargo init
is very easy
-
@zmitchell:
- @infinisil: With Python it’s also hard to explain what installing means, requires wrapping with Python interpreter, copying the source
- Then do a
buildRustPackage
, maybe in the next tutorial
- Explain how we haven’t built our own code purely yet, only entered an environment and might have called
Action items
- @zmitchell: Create an issue for this derivation tutorial