From c354515db6d851491ef920d30483f8445134b139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=C5=99ina=20Churanov=C3=A1?= Date: Thu, 11 Jul 2024 13:49:04 +0200 Subject: [PATCH] slide updates, links --- assets/pictures/nix_pills.svg | 1 + assets/pictures/qrcode_fasterthanli-me.svg | 1 + assets/pictures/this_presentation.svg | 1 + examples/nci/flake.nix | 7 +++- flake.nix | 1 + marp.config.mjs | 17 ++++---- slides/slides.md | 45 ++++++++++++++++++---- themes/theme.css | 8 ++-- 8 files changed, 59 insertions(+), 22 deletions(-) create mode 100644 assets/pictures/nix_pills.svg create mode 100644 assets/pictures/qrcode_fasterthanli-me.svg create mode 100644 assets/pictures/this_presentation.svg diff --git a/assets/pictures/nix_pills.svg b/assets/pictures/nix_pills.svg new file mode 100644 index 0000000..a95b4ef --- /dev/null +++ b/assets/pictures/nix_pills.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/pictures/qrcode_fasterthanli-me.svg b/assets/pictures/qrcode_fasterthanli-me.svg new file mode 100644 index 0000000..45301ec --- /dev/null +++ b/assets/pictures/qrcode_fasterthanli-me.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/pictures/this_presentation.svg b/assets/pictures/this_presentation.svg new file mode 100644 index 0000000..8a5c313 --- /dev/null +++ b/assets/pictures/this_presentation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/nci/flake.nix b/examples/nci/flake.nix index 590aace..aa27f3b 100644 --- a/examples/nci/flake.nix +++ b/examples/nci/flake.nix @@ -13,7 +13,12 @@ outputs = inputs@{ flake-parts, nci, ... }: flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "x86_64-linux" ]; + systems = [ + "x86_64-linux" + "aarch64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; imports = [ nci.flakeModule ./crates.nix diff --git a/flake.nix b/flake.nix index 3946c47..0839657 100644 --- a/flake.nix +++ b/flake.nix @@ -33,6 +33,7 @@ { treefmt = { programs.nixfmt.enable = true; + programs.prettier.enable = true; projectRootFile = "flake.nix"; }; devshells.default = { diff --git a/marp.config.mjs b/marp.config.mjs index 1aeb5ee..abfdf9e 100644 --- a/marp.config.mjs +++ b/marp.config.mjs @@ -1,13 +1,12 @@ -const canonicalUrl = process.env.URL || undefined +const canonicalUrl = process.env.URL || undefined; /** @type {import('@marp-team/marp-cli').Config} */ const config = { - allowLocalFiles: true, - themeSet: 'themes', - url: canonicalUrl, - inputDir: "./slides", - output: "./present" + allowLocalFiles: true, + themeSet: "themes", + url: canonicalUrl, + inputDir: "./slides", + output: "./present", +}; -} - -export default config \ No newline at end of file +export default config; diff --git a/slides/slides.md b/slides/slides.md index e976f27..3e1308d 100644 --- a/slides/slides.md +++ b/slides/slides.md @@ -1,15 +1,15 @@ --- marp: true lang: en-US -title: Marp CLI example -description: Hosting Marp slide deck on the web +title: Reproducible development environments with Nix theme: nix_talk transition: fade paginate: true _paginate: false --- -# Nix for Rustaceans +# Reproducible development environments with Nix + #### Kateřina "Kate" Churanová --- @@ -18,7 +18,6 @@ _paginate: false - Purely functional programming language - Package manager -- Linux distribution (NixOS) - multiplatform (Linux, Mac OS, BSD-ish) --- @@ -29,6 +28,15 @@ _paginate: false - Well documented - Opinionated +--- +# What is it for + +- Access to huge repository of various packages +- Declarative way to define builds and build enviroment and their configuration +- Coexistence of various versions of software and libraries on the same system + +*Every simple configuration language will eventually end up being turing complete* + --- # Nix derivation @@ -75,7 +83,7 @@ _paginate: false - builds all flake dependencies, but not the flake itself - sets up the development environment ---- +--- # Nix direnv @@ -92,17 +100,23 @@ _paginate: false ---- +--- # Flake parts - Minimal modular framework + ## Dev environment management + - Devshell - Devenv + ## Rust project building + - NCI (Nix cargo integration) --- + # Basic flake parts project + ```nix { inputs = { @@ -126,7 +140,9 @@ _paginate: false --- # Fun begins with Rust + ### flake.nix + ```nix inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; @@ -170,7 +186,9 @@ outputs = inputs @ { ``` --- + ### crates.nix + ```nix {...}: { perSystem = { @@ -195,7 +213,8 @@ outputs = inputs @ { - Plenty of other tools for your disposal - Extremely simple generation of lightweight OCI containers ---- +--- + ```nix packages.container = pkgs.dockerTools.streamLayeredImage { name = crateName; @@ -205,4 +224,14 @@ outputs = inputs @ { Cmd = [ "${crateOutputs.packages.release}/bin/my-crate" ]; }; }; -``` \ No newline at end of file +``` + +--- + +# Other learning materials +### Fasterthanlime's series on Rust development with Nix +[https://fasterthanli.me/series/building-a-rust-service-with-nix](https://fasterthanli.me/series/building-a-rust-service-with-nix) +### Nix pills +[https://nixos.org/guides/nix-pills/](https://nixos.org/guides/nix-pills/) +### This presentation and examples +[https://code.nolog.cz/shine/nix_for_rustaceans](https://code.nolog.cz/shine/nix_for_rustaceans) diff --git a/themes/theme.css b/themes/theme.css index 7173b28..c0a1491 100644 --- a/themes/theme.css +++ b/themes/theme.css @@ -2,9 +2,9 @@ *@theme nix_talk */ -@import 'default'; +@import "default"; section { - background: #cef; - color: #135; -} \ No newline at end of file + background: #cef; + color: #135; +}