diff options
author | Yann Herklotz <git@yannherklotz.com> | 2021-09-17 11:10:48 +0100 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2021-09-17 11:10:48 +0100 |
commit | 69700e5d5f8e34304a982808dffa731923607a8e (patch) | |
tree | 853b2a38ff0d74ca8daabb06ca1dd5d82b865ea7 /content.org | |
parent | 8c75c6609c543dbd32eac1e2665399e6fd24a48e (diff) | |
parent | 6fd6fae561484f00b85cae265e5b11d3ceea744e (diff) | |
download | yannherklotz.com-69700e5d5f8e34304a982808dffa731923607a8e.tar.gz yannherklotz.com-69700e5d5f8e34304a982808dffa731923607a8e.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'content.org')
-rw-r--r-- | content.org | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/content.org b/content.org index 1923907..669c531 100644 --- a/content.org +++ b/content.org @@ -441,20 +441,20 @@ features Nix has that makes it pleasant to work with. Just like many other functional languages, Nix has =let= expressions which bind an expression to a name. -#+begin_src emacs-lisp +#+begin_src nix let name = expr; in body #+end_src It also supports importing an expression, which just evaluates and inserts an expression. -#+begin_src emacs-lisp +#+begin_src nix import ./expression.nix; #+end_src The =with= expression is also interesting, which makes all the attributes of a set available in the next expression, unqualified. -#+begin_src emacs-lisp +#+begin_src nix with set; expr #+end_src @@ -486,7 +486,7 @@ set into scope. We then call the =mkDerivation= function to override some of the set, such as the name (=name=), the location of the source code (=src=). These are the only two required attributes for the =mkDerivation= function, however, that does not mean it will build yet. -#+begin_src emacs-lisp +#+begin_src nix with import <nixpkgs> {}; stdenv.mkDerivation { @@ -505,10 +505,11 @@ those. The first is customise the build step using the =buildPhase= attribute. B will just execute =make=, however, in this project the =makefile= is actually in the =src= directory. We therefore have to change to that directory first before we can do anything. -#+begin_src emacs-lisp - buildPhase = '' - cd src && make - ''; +#+begin_src nix + { ...; + buildPhase = '' + cd src && make + ''; } #+end_src This will now execute the makefile correctly, however, it will fail the build because =Vellvm= has a @@ -517,23 +518,23 @@ try and find them in Nix and can add them as build dependencies. Here we can spe dependencies using =coqPackages=, OCaml dependencies using =ocamlPackages=, and finally command line tools such as the OCaml compiler or the OCaml build system =dune=. -#+begin_src emacs-lisp - buildInputs = [ git coq ocamlPackages.menhir dune coqPackages.flocq - coqPackages.coq-ext-lib coqPackages.paco - coqPackages.ceres ocaml ]; +#+begin_src nix + { ...; buildInputs = [ git coq ocamlPackages.menhir dune coqPackages.flocq + coqPackages.coq-ext-lib coqPackages.paco + coqPackages.ceres ocaml ]; } #+end_src Finally, Nix will execute =make install= automatically at the end to install the program correctly. In this case, we need to set the =COQLIB= flag so that it knows where to place the compiled Coq theories. These can be set using the =installFlags= attribute. -#+begin_src emacs-lisp - installFlags = [ "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ]; +#+begin_src nix + { ...; installFlags = [ "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ]; } #+end_src We then have the following Nix derivation which should download =Vellvm= and build it correctly. -#+begin_src emacs-lisp +#+begin_src nix with import <nixpkgs> {}; stdenv.mkDerivation { @@ -561,8 +562,8 @@ itself. We can therefore define a derivation in the following way. We can use =p to define dependencies that the package needs and that derivations using this package will also need. In this case, any derivation using =ceres= will need Coq, otherwise it would not be useful. -#+begin_src emacs-lisp - ceres = stdenv.mkDerivation { +#+begin_src nix + let ceres = stdenv.mkDerivation { name = "coq${coq.coq-version}-ceres"; src = fetchGit { @@ -572,7 +573,7 @@ need. In this case, any derivation using =ceres= will need Coq, otherwise it wou propagatedBuildInputs = [ coq ]; installFlags = [ "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ]; - }; + }; in #+end_src Finally, we can use a =let= expression to insert it as a dependency into our own derivation. We now @@ -582,7 +583,7 @@ have a complete nix expression that will always build =Vellvm= correctly in a co nix-prefetch-url --unpack https://github.com/Lysxia/coq-ceres/archive/4e682cf97ec0006a9d5b3f98e648e5d69206b614.tar.gz #+end_src -#+begin_src emacs-lisp +#+begin_src nix with import <nixpkgs> {}; let @@ -956,7 +957,7 @@ extensible enough to allow for different types of posts, which are called *colle My layout, which supports project descriptions for a portfolio and blog posts, looks like the following. -#+begin_src emacs-lisp +#+begin_src text . ├── assets │ ├── css @@ -978,7 +979,7 @@ following. To make Jekyll recognise the =_portfolio= directory, it has to be declared in Jekyll's configuration file =_config.yml=. -#+begin_src emacs-lisp +#+begin_src yaml collections: portfolio: output: true @@ -987,7 +988,7 @@ file =_config.yml=. Jekyll will now parse and turn the markdown files into HTML. To get a coherent link to the files, it is a good idea to add a *permalink* to the YAML front matter like the following. -#+begin_src emacs-lisp +#+begin_src yaml --- title: FMark permalink: /portfolio/fmark/ @@ -1008,7 +1009,7 @@ you can use a for loop to iterate through the projects, and even use a limit to to a specific number. This can be useful when showing a few projects on the main page, and also want a page displaying all the projects. -#+begin_src emacs-lisp +#+begin_src text {%- raw -%} {% assign proj_reverse = site.portfolio | reverse %} {% for project in proj_reverse limit: 3 %} @@ -1020,7 +1021,7 @@ projects, the list first has to be reversed. Inside the for loop, variables like -#+begin_src emacs-lisp +#+begin_src text {%- raw -%} {{ project.title }} {{ project.excerpt }} |