-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
265 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
--- | ||
--- | ||
|
||
<section class="flex flex-col main-container"> | ||
<slot /> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# derivation.nix | ||
builtins.derivation { | ||
system = "x86_64-linux"; | ||
name = "sample"; | ||
builder = "/bin/sh"; | ||
|
||
args = [ | ||
"-c" | ||
"echo hello > $out" | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: "The Nix lectures, part 2: Derivations" | ||
pubDate: 2024-09-16T07:07:01Z | ||
draft: true | ||
summary: FIXME | ||
slug: nix-tuto-2 | ||
--- | ||
|
||
This is part 2 of a tutorial series that covers all of Nix. We covered | ||
language basics in the first part, and in this post we will cover derivations. | ||
|
||
## builtins.derivation | ||
|
||
This is the primitive that Nix uses to define derivations. You will probably | ||
**never** use it, as we rely on higher-level abstractions that are built on top | ||
of `builtins.derivation`. | ||
|
||
> [!NOTE] | ||
> Remember that the design of the Nix language, it is a very simple language. | ||
> Having a small API surface means that you don't really have to update the API | ||
> as time passes, but rather the abstractions that are built on top. This is | ||
> useful when you want to use a current Nix binary to evaluate some nixpkgs from | ||
> *many* years ago. | ||
`builtins.derivation` is a function that takes an attrset with some | ||
**known keys**, and the rest are set as environment variables. A simple | ||
invocation might look like this: | ||
|
||
```nix file: "derivation.nix" | ||
#=> «derivation /nix/store/n34150nf03sh04j8mjzm8sawdqx9sgqi-sample.drv» | ||
``` | ||
|
||
Nix will tell use that the return type is a "derivation". However, from chapter | ||
1, I didn't mention that this type exists. What is happening here is that | ||
derivations are implemented as **attrsets** with a special field called `type`. | ||
|
||
```nix | ||
{ type = "derivation"; } | ||
#=> «derivation» | ||
``` | ||
|
||
> [!TIP] | ||
> One of the key insights is that **derivations** are **attrsets**, meaning we | ||
> can access fields from them. You will often see things like | ||
> `pkgs.hello.overrideAttrs`, etc. | ||
Derivations can be built in the repl with `:b`, or with the command `nix build | ||
-f derivation.nix`. | ||
|
||
As you might remember, you can do string interpolation with attrsets: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: "The Nix lectures, part 3: Module system" | ||
pubDate: 2024-09-16T07:08:21Z | ||
draft: true | ||
summary: FIXME | ||
slug: nix-tuto-3 | ||
--- | ||
|
||
## hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: "The Nix lectures, part 4: Integration" | ||
pubDate: 2024-09-16T07:09:05Z | ||
draft: true | ||
summary: FIXME | ||
slug: nix-tuto-4 | ||
--- | ||
|
||
## hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
import Base from "../layouts/Base.astro"; | ||
import Centered from "../components/Centered.astro"; | ||
--- | ||
|
||
<Base | ||
seo={{ | ||
title: "Page not found", | ||
}} | ||
> | ||
<Centered> | ||
<h1>404</h1> | ||
<h3>Not found</h3> | ||
</Centered> | ||
</Base> | ||
|
||
<style> | ||
.test { | ||
box-sizing: border-box; | ||
padding: 10px; | ||
border: 4px solid rgb(68, 68, 68); | ||
border-radius: 10px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters