Skip to content

Commit

Permalink
Merge pull request #386 from DeterminateSystems/fix-astro-build
Browse files Browse the repository at this point in the history
Fix Astro build
  • Loading branch information
lucperkins authored Nov 26, 2024
2 parents f5a663e + c0d7489 commit c229033
Show file tree
Hide file tree
Showing 11 changed files with 279 additions and 197 deletions.
4 changes: 4 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export default defineConfig({
showLineNumbers: false,
},
plugins: [pluginCollapsibleSections(), pluginLineNumbers()],
styleOverrides: {
codeFontSize: "1rem",
uiFontSize: "1rem",
},
}),
icon(),
mdx({
Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build]
command = "./scripts/netlify-redirects.sh >> netlify.toml && pnpm run check && pnpm run build"
command = "./scripts/netlify-redirects.sh >> netlify.toml && pnpm run build"
publish = "dist"

[context.production]
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"check": "astro check",
"build": "astro check && astro build",
"preview": "astro preview",
"format": "prettier --write .",
Expand Down
351 changes: 169 additions & 182 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/components/mdx/ExternalSources.astro

This file was deleted.

21 changes: 20 additions & 1 deletion src/components/mdx/NixDevelop.astro
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
<></>
<div class="expressive-code">
<figure class="frame is-terminal has-title">
<figcaption class="header">
<span class="title"
>Explore a development environment for <span x-text="language"
></span></span
>
</figcaption><pre
data-language="shell"><code><div class="ec-line"><div class="code"><span style="--0:#B392F0">nix</span><span style="--0:#E1E4E8"> </span><span style="--0:#9ECBFF">develop</span><span style="--0:#E1E4E8"> </span><span style="--0:#9ECBFF">"github:DeterminateSystems/zero-to-nix#<span x-text="language.toLowerCase()" />"</span></div></div></code></pre><div
class="copy"
>
<button
title="Copy to clipboard"
data-copied="Copied!"
data-code='nix develop "github:DeterminateSystems/zero-to-nix#scala"'
><div></div></button
>
</div>
</figure>
</div>
1 change: 0 additions & 1 deletion src/components/mdx/Shell.astro

This file was deleted.

46 changes: 42 additions & 4 deletions src/content/start/3.nix-develop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ Two other things that you can provide in Nix development environments:
Some example use cases for environment variables:
- Set logging levels using `LOG_LEVEL` or whatever is appropriate for the tools you're using.
- Set the environment using variables like `NODE_ENV` (for [Node.js]) to `development`, `dev`, and so on.
```shell
nix develop "https://flakehub.com/f/DeterminateSystems/zero-to-nix/*#hook"
```

Let's leave the Nix development environment to prepare for the next section:

Expand Down Expand Up @@ -267,7 +264,48 @@ First, tell us which language you prefer:

To get started in your <Language /> project, create an empty directory and initialize a [flake template][templates]:

<Shell kind="dev" />
<SpecificLanguage lang="C++">
```shell title="Initialize a flake template for C++"
mkdir nix-cpp-dev && cd nix-cpp-dev
nix flake init --template "github:DeterminateSystems/zero-to-nix#cpp-dev"
```
</SpecificLanguage>
<SpecificLanguage lang="Haskell">
```shell title="Initialize a flake template for Haskell"
mkdir nix-haskell-dev && cd nix-haskell-dev
nix flake init --template "github:DeterminateSystems/zero-to-nix#haskell-dev"
```
</SpecificLanguage>
<SpecificLanguage lang="JavaScript">
```shell title="Initialize a flake template for JavaScript"
mkdir nix-javascript-dev && cd nix-javascript-dev
nix flake init --template "github:DeterminateSystems/zero-to-nix#javascript-dev"
```
</SpecificLanguage>
<SpecificLanguage lang="Python">
```shell title="Initialize a flake template for Python"
mkdir nix-python-dev && cd nix-python-dev
nix flake init --template "github:DeterminateSystems/zero-to-nix#python-dev"
```
</SpecificLanguage>
<SpecificLanguage lang="Go">
```shell title="Initialize a flake template for Go"
mkdir nix-go-dev && cd nix-go-dev
nix flake init --template "github:DeterminateSystems/zero-to-nix#go-dev"
```
</SpecificLanguage>
<SpecificLanguage lang="Rust">
```shell title="Initialize a flake template for Rust"
mkdir nix-rust-dev && cd nix-rust-dev
nix flake init --template "github:DeterminateSystems/zero-to-nix#rust-dev"
```
</SpecificLanguage>
<SpecificLanguage lang="Scala">
```shell title="Initialize a flake template for Scala"
mkdir nix-scala-dev && cd nix-scala-dev
nix flake init --template "github:DeterminateSystems/zero-to-nix#scala-dev"
```
</SpecificLanguage>

Once the template has been initialized, run `ls .` to see the contents of the directory, which should include two important files:

Expand Down
46 changes: 42 additions & 4 deletions src/content/start/4.nix-build.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Let's build and run [CMake]:
nix build "nixpkgs#cmake"
./result/bin/cmake --help
```

</SpecificLanguage>
<SpecificLanguage lang="Haskell">
Let's build and run [Pandoc]:
Expand All @@ -90,7 +89,6 @@ Let's build and run [pip]:
nix build "nixpkgs#python3Packages.pip"
./result/bin/pip --help
```

</SpecificLanguage>
<SpecificLanguage lang="Go">
Let's build and run [kubectl]:
Expand All @@ -99,7 +97,6 @@ Let's build and run [kubectl]:
nix build "nixpkgs#kubectl"
./result/bin/kubectl --help
```

</SpecificLanguage>
<SpecificLanguage lang="Rust">
Let's build and run [ripgrep]:
Expand Down Expand Up @@ -146,7 +143,48 @@ As above, select a preferred language:

To get started in your <Language /> project, create an empty directory and initialize a [flake template][templates]:

<Shell kind="pkg" />
<SpecificLanguage lang="C++">
```shell title="Initialize a flake template for C++"
mkdir nix-cpp-pkg && cd nix-cpp-pkg
nix flake init --template "github:DeterminateSystems/zero-to-nix#cpp-pkg"
```
</SpecificLanguage>
<SpecificLanguage lang="Haskell">
```shell title="Initialize a flake template for Haskell"
mkdir nix-haskell-pkg && cd nix-haskell-pkg
nix flake init --template "github:DeterminateSystems/zero-to-nix#haskell-pkg"
```
</SpecificLanguage>
<SpecificLanguage lang="JavaScript">
```shell title="Initialize a flake template for JavaScript"
mkdir nix-javascript-pkg && cd nix-javascript-pkg
nix flake init --template "github:DeterminateSystems/zero-to-nix#javascript-pkg"
```
</SpecificLanguage>
<SpecificLanguage lang="Python">
```shell title="Initialize a flake template for Python"
mkdir nix-python-pkg && cd nix-python-pkg
nix flake init --template "github:DeterminateSystems/zero-to-nix#python-pkg"
```
</SpecificLanguage>
<SpecificLanguage lang="Go">
```shell title="Initialize a flake template for Go"
mkdir nix-go-pkg && cd nix-go-pkg
nix flake init --template "github:DeterminateSystems/zero-to-nix#go-pkg"
```
</SpecificLanguage>
<SpecificLanguage lang="Rust">
```shell title="Initialize a flake template for Rust"
mkdir nix-rust-pkg && cd nix-rust-pkg
nix flake init --template "github:DeterminateSystems/zero-to-nix#rust-pkg"
```
</SpecificLanguage>
<SpecificLanguage lang="Scala">
```shell title="Initialize a flake template for Scala"
mkdir nix-scala-pkg && cd nix-scala-pkg
nix flake init --template "github:DeterminateSystems/zero-to-nix#scala-pkg"
```
</SpecificLanguage>

Whichever language you've selected, you can build the [Nix package][packages] defined in the local flake by running:

Expand Down
1 change: 1 addition & 0 deletions src/pages/concepts/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const relatedConceptPages: { title: string; href: string }[] = (
h4: H4,

Admonition,
ExternalSources,
NixStorePath,
}}
/>
Expand Down
2 changes: 0 additions & 2 deletions src/pages/start/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Languages from "../../components/mdx/Languages.astro";
import Layout from "../../layouts/Layout.astro";
import NixDevelop from "../../components/mdx/NixDevelop.astro";
import NixStorePath from "../../components/mdx/NixStorePath.astro";
import Shell from "../../components/mdx/Shell.astro";
import SpecificLanguage from "../../components/mdx/SpecificLanguage.astro";
import HorizontalContainer from "../../components/HorizontalContainer.astro";
import Hero from "../../components/Hero.astro";
Expand Down Expand Up @@ -64,7 +63,6 @@ const numQuickStartPages = (await getCollection("start")).length;
Languages,
NixDevelop,
NixStorePath,
Shell,
SpecificLanguage,
}}
/>
Expand Down

0 comments on commit c229033

Please sign in to comment.