From 5b5698afb596eebf0c4a0ffbfc520177d495c7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amy=20de=20Buitl=C3=A9ir?= Date: Thu, 4 Sep 2025 20:39:26 +0100 Subject: [PATCH] initial commit --- source/recipes/devshell/flake/main.adoc0 | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 source/recipes/devshell/flake/main.adoc0 diff --git a/source/recipes/devshell/flake/main.adoc0 b/source/recipes/devshell/flake/main.adoc0 new file mode 100644 index 0000000..a437ebf --- /dev/null +++ b/source/recipes/devshell/flake/main.adoc0 @@ -0,0 +1,54 @@ += A flake + +//// +$ mkdir tempwork +$ cd tempwork +$ cp ../flake.nix flake.nix +$ git add flake.nix +$ nix develop +$ git add flake.lock +$ git commit -a -m temp +//// + +In this example, we will use a flake defined in a remote git repo. +However, you can use any of the flake reference styles defined in <<#flakeref>>. + +[source,nix,linenums,highlight='5,16'] +.flake.nix +.... +$# cat flake.nix +.... + +Let's take a closer look at the `buildInputs`. + +.... +$# grep buildInputs flake.nix | sed 's/ //g' +.... + +Why is the first part `hello-flake` and the last part `hello`? +The first part refers to the name we assigned in the input section of our flake, +and the last part is the name of the package or app we want. + +You can find the outputs of a flake using the `nix flake show` command. + +.... +$# echo '$ nix flake show git+https://codeberg.org/mhwombat/hello-flake' +$# nix flake show git+https://codeberg.org/mhwombat/hello-flake --quiet | sed -e 's/\x1b\[[0-9;]*m//g' +.... + +Examining the output of this command, +we see that this flake provides both a package and an app called `hello`. + +Here's a demonstration using the shell. + +.... +$ hello-flake +$# ../../../../../start-shell nix develop <