mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 07:57:57 +00:00
b088086b06
Now, it's all under the notebook umbrella. Seems to be appropriate as it is just my notes after all. I also updated some notes from there. I didn't keep track of what it is this time. Something about more learning notes extracted from my "Learning how to learn" course notes and then some. Lack of time and hurriness just makes it difficult to track but it should be under version control already.
2.8 KiB
2.8 KiB
Nix derivations
Derivations are recipes for the Nix build daemon how to build the package. At a glance, this is the equivalent to manifests from Flatpak packages or Guix packages.
The following code block shows what a derivation looks like.
nix show-derivation nixpkgs.hello
{ "/nix/store/7xcq1j6kxry9p5scmgccifqp1m57ha17-hello-2.10.drv": { "outputs": { "out": { "path": "/nix/store/kzq2f6pqb3ig89278n3c21g6x4y3pghs-hello-2.10" } }, "inputSrcs": [ "/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh" ], "inputDrvs": { "/nix/store/aq6m16jyrdpz2frivygw0502lkhyv271-stdenv-linux.drv": [ "out" ], "/nix/store/hhq1cbwwjm28bp7bnr9ivlvgah7988xb-hello-2.10.tar.gz.drv": [ "out" ], "/nix/store/mhgg30w6ayhbvnp03z8gx4c92n67ajg6-bash-4.4-p23.drv": [ "out" ] }, "platform": "x86_64-linux", "builder": "/nix/store/26a78ync552m8j4sbjavhvkmnqir8c9y-bash-4.4-p23/bin/bash", "args": [ "-e", "/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh" ], "env": { "buildInputs": "", "builder": "/nix/store/26a78ync552m8j4sbjavhvkmnqir8c9y-bash-4.4-p23/bin/bash", "configureFlags": "", "depsBuildBuild": "", "depsBuildBuildPropagated": "", "depsBuildTarget": "", "depsBuildTargetPropagated": "", "depsHostHost": "", "depsHostHostPropagated": "", "depsTargetTarget": "", "depsTargetTargetPropagated": "", "doCheck": "1", "doInstallCheck": "", "name": "hello-2.10", "nativeBuildInputs": "", "out": "/nix/store/kzq2f6pqb3ig89278n3c21g6x4y3pghs-hello-2.10", "outputs": "out", "patches": "", "pname": "hello", "propagatedBuildInputs": "", "propagatedNativeBuildInputs": "", "src": "/nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz", "stdenv": "/nix/store/dj40kjgp5lhs55v4hc47vyrarhq4qycz-stdenv-linux", "strictDeps": "", "system": "x86_64-linux", "version": "2.10" } } }
While we can create derivations with the Nix language, it is unnecessary and verbose if we use nixpkgs. nixpkgs has made the process easier with their standard library.
stdenv.mkDerivation
- nixpkgs also comes with several convenient functions/environments for several programming languages and frameworks including Python, Rust, Go, and Nim
- it also includes environments for common setups such as for clang compiler