Create GNU Guix-related notes

This commit is contained in:
Gabriel Arazas 2021-04-21 19:38:28 +08:00
parent 331db7e5da
commit 0a244e1580
5 changed files with 187 additions and 23 deletions

View File

@ -1,13 +1,13 @@
#+title: Org-mode: Babel
#+title: Org mode: Babel
#+date: "2020-04-17 21:41:30 +08:00"
#+date_modified: "2021-04-15 21:07:18 +08:00"
#+date_modified: "2021-04-21 17:43:52 +08:00"
#+language: en
#+properties: header-args :session :exports both
#+tags: research.reproducibility
Org-babel is the framework that enables [[file:2020-04-20-16-51-40.org][Org-mode]] to insert output of the code from programming languages.
It is also the one thing that makes Org-mode to be used as a tool for [[file:2020-04-12-11-20-53.org][Reproducible research]].
Org-babel is the framework that enables [[file:2020-04-20-16-51-40.org][Org mode]] to insert output of the code from programming languages.
It is also the one thing that makes Org mode to be used as a tool for [[file:2020-04-12-11-20-53.org][Reproducible research]].
As of 2020-06-08, [[https://orgmode.org/worg/org-contrib/babel/languages.html][Babel supports more than 50 languages]] with the possibility of adding of other languages that are not supported yet.
@ -29,7 +29,7 @@ The results will be printed into a result block.
Each of the supported language may also have an exclusive option with each language suitable for certain processes.
For example, with Python 3, you can pretty print it in accordance to Org-mode display.
For example, with Python 3, you can pretty print it in accordance to Org mode display.
An array will create a table, for instance with ~:results value~ [[https://orgmode.org/manual/Using-Header-Arguments.html#Using-Header-Arguments][header argument]].
#+begin_src python :results value
@ -109,7 +109,7 @@ To correct this, simply execute ~org-babel-execute-buffer~.
* Integrating between different programming languages
You can also pass Org-mode variables (from ~#+NAME: <VAR>~) [fn:: Technically called an internal link (https://orgmode.org/org.html#Internal-Links).] into the source code blocks with the ~:var <NAMEC>=<DATA>~ (though, this may vary among Babel runtimes).
You can also pass Org mode variables (from ~#+NAME: <VAR>~) [fn:: Technically called an internal link (https://orgmode.org/org.html#Internal-Links).] into the source code blocks with the ~:var <NAMEC>=<DATA>~ (though, this may vary among Babel runtimes).
#+name: example_string
This is the string.
@ -135,7 +135,7 @@ example
,: This is the string.
#+end_src
Org-mode variables does capture an element as its input.
Org mode variables does capture an element as its input.
This has a lot of implications of passing data between different sessions and even different languages.
For example, we could still capture the ~x~ variable from the previous Python code blocks.
@ -145,7 +145,7 @@ For example, we could still capture the ~x~ variable from the previous Python co
x # Which should be 60 at this point.
#+end_src
Then, pass it to some other Org-mode blocks with the variable.
Then, pass it to some other Org mode blocks with the variable.
(Since the captured variable are always going to be a string, we have to convert it into the appropriate type.)
#+begin_src R :results output :var python_var=var_from_other_lang

View File

@ -1,10 +1,14 @@
#+title: Org-mode
#+title: Org mode
#+date: "2020-04-20 16:51:40 +08:00"
#+date_modified: "2020-09-09 05:17:29 +08:00"
#+date_modified: "2021-04-21 18:06:28 +08:00"
#+language: en
#+tags: tools writing
At its core, [[https://orgmode.org/][Org-mode]] is a [[file:2020-04-23-23-21-47.org][Personal information management]] tool that deals with your tasks and schedules.
At its core, [[https://orgmode.org/][Org mode]] is a [[file:2020-04-23-23-21-47.org][Personal information management]] tool that deals with your tasks and schedules.
Nowadays, it sports a lightweight markup language and a framework that allows arbitrarily inserting output of code of various programming languages.
With these features, Org-mode is known as one of the many tool for [[file:2020-04-12-11-20-53.org][Reproducible research]] which also serves as a solid tool for [[file:2020-04-15-14-35-55.org][Note-taking]] as well.
With these features, Org-mode is known as one of the many tools for [[file:2020-04-12-11-20-53.org][Reproducible research]] which also serves as a solid tool for [[file:2020-04-15-14-35-55.org][Note-taking]] as well.
Unfortunately, a lot of the famous powers of the format is tied with [[roam:GNU Emacs][roam:GNU Emacs]].
While there is an ecosystem flourishing outside of the text editor (e.g., [[https://github.com/niklasfasching/go-org][go-org]], [[https://github.com/orgapp/orgajs][orgajs]], [[https://pandoc.org/org.html][Org mode support in Pandoc]]), the plugins inside of Emacs simply cannot be ignored.
Among other Org mode plugins inside of the Emacs ecosystem, we have [[link][org-roam]], [[https://github.com/jkitchin/org-ref][org-ref]], [[https://github.com/weirdNox/org-noter][org-noter]], [[https://orgmode.org/worg/exporters/index.html][a number of exporters]], and [[https://orgmode.org/worg/org-contrib/babel/languages/index.html][org-babel language plugins]] (see [[file:2020-04-17-21-41-30.org][Org mode: Babel]]) that extends to more workflows.

View File

@ -1,21 +1,67 @@
#+title: Org-mode as todo list manager
#+title: Org mode timestamps
#+date: "2020-04-21 19:44:15 +08:00"
#+date_modified: "2021-04-05 15:58:30 +08:00"
#+date_modified: "2021-04-21 19:13:59 +08:00"
#+language: en
#+property: header-args:org :results silent
#+tags: personal-info-management
As previously stated, [[file:2020-04-20-16-51-40.org][Org-mode]] is first created as an outliner enabling you to manage tasks.
As previously stated, [[file:2020-04-20-16-51-40.org][Org mode]] is first created as an outliner enabling you to manage tasks.
Here's some of the features you might be interested when using it as such.
* Timestamps and durations
Being a personal information tool, Org mode heavily features timestamps.
#+begin_src org
<2021-04-21 Wed>
#+end_src
You can easily set a timestamp with ~org-time-stamp~ that comes with an interactive calendar and a prompt to indicate the date and time.
The [[https://orgmode.org/manual/The-date_002ftime-prompt.html][prompt]] is more useful since you can quickly enter relative values such as:
- =+1d= for tomorrow.
- =2020-05-01 +23d= means 23 days after the 2020-05-01.
- =+4d 10:00+2= for 4 days later starting from 10:00 to 12:00.
- =+1m 1pm+3= for a month later starting from 1:00 PM to 4:00 PM.
Durations are made by putting a pair of dashes between two timestamps.
#+begin_src org
<2021-04-22 Thu>--<2021-04-25 Sun>
#+end_src
You can quickly create a duration by running ~org-time-stamp~ two times consecutively.
* Deadlines and schedules
In Org mode agenda view, it can show deadlines and schedules by prepending the timestamps with =DEADLINE= and =SCHEDULED=, respectively.
#+begin_src org
DEADLINE: <2021-04-26 Mon 22:00>
SCHEDULED: <2021-04-25 Sun 20:00>
#+end_src
- Deadline entries make up the tasks that has to be done by the specified datetime.
When present in the agenda, it will warn an issue when the task is not done after the deadline had passed.
- Scheduled entries indicate the tasks that you will do starting from the timestamp.
When present in the agenda, it will simply remind you to do the task until done.
* Repeated tasks
Org-mode features [[https://orgmode.org/manual/Repeated-tasks.html][repeated tasks]] and it looks like the following.
One can set [[https://orgmode.org/manual/Repeated-tasks.html][repeated tasks]] in the following format.
#+begin_src org :results silent
#+begin_src org
SCHEDULED: <2020-06-22 Mon +2d>
#+end_src
@ -25,20 +71,17 @@ Some tasks does not work this way, however.
You don't need to replace the batteries 5 times or brush your teeth 10 times to make up for it.
For this, you can do the following.
#+begin_src org :results silent
#+begin_src org
SCHEDULED: <2020-06-22 Mon ++2d>
#+end_src
One cool thing about it if you mark a task as done, it will simply create an entry of the task completed and update the base date.
#+begin_src org :results silent
\* TODO Watch the lectures from Brian Harvey's SICP series (https://archive.org/details/ucberkeley-webcast-PL3E89002AA9B9879E?sort=titleSorter)
#+begin_src org
,* TODO Watch the lectures from Brian Harvey's SICP series (https://archive.org/details/ucberkeley-webcast-PL3E89002AA9B9879E?sort=titleSorter)
SCHEDULED: <2020-06-24 Wed .+2d>
:PROPERTIES:
:LAST_REPEAT: [2020-06-22 Mon 22:01]
:END:
- State "DONE" from "TODO" [2020-06-22 Mon 22:01]
#+end_src
This will also integrate with certain features like the agenda views.
You can see future entries along with the number of times you have to do to make up for the missed sessions.

73
2021-04-21-01-46-02.org Normal file
View File

@ -0,0 +1,73 @@
#+title: GNU Guix package contribution workflow
#+date: "2021-04-21 01:46:02 +08:00"
#+date_modified: "2021-04-21 01:50:56 +08:00"
#+language: en
[[roam:GNU Guix][GNU Guix]], like most GNU projects, are mainly done in collaboration through email.
Here's the very basics of what you should do when getting the groove into contributing to the project.
* Getting started
- Basically, you have to create the build environment for the Guix source code.
You may want to always keep the [[https://guix.gnu.org/en/manual/][GNU Guix manual]] on the side.
TL;DR: get the source, ~./bootstrap~, ~./configure --localstatedir=/var~, ~make check~, and you're mostly done!
- GNU projects have a [[https://debbugs.gnu.org/][global issue tracker]] with each project requiring different steps and locations.
As of 2021-04-21, GNU Guix has mainly two channels for their issue tracker: [[https://lists.gnu.org/mailman/listinfo/bug-guix][bug-guix]] where bug reports go and [[https://lists.gnu.org/mailman/listinfo/guix-patches][guix-patches]] where contributions are streamed.
+ Both of the channels are essentially mailing lists, only an email address is required to subscribe.
+ There is a [[http://issues.guix.gnu.org/][more legible frontend]] combining both the channels of the bug report and patches.
- The Guix community has a [[https://ci.guix.gnu.org/][build farm]] running its [[http://guix.gnu.org/cuirass/][own CI software]].
Pretty useful to track the status of several channels that is happening within the package set.
You could also stay tuned with [[https://ci.guix.gnu.org/events/rss/][its RSS feed]].
* Adding or updating a package
- Once you want to define a package, you can either edit it by hand or [[https://guix.gnu.org/en/cookbook/en/html_node/Programmable-and-automated-package-definition.html#Programmable-and-automated-package-definition][create a template from an importer]].
Nonetheless, referring to the [[https://guix.gnu.org/en/manual/en/html_node/Programming-Interface.html][programming interface]] and the [[https://guix.gnu.org/en/manual/en/html_node/package-Reference.html][~package~ reference]] is a good idea.
- If your name is not added yet into the copyright header, add it to the file where the package is defined.
You're essentially declaring you have copyright over the piece of code you're contributing.
- One of the common starting tasks when declaring a package is checking the hash of the source objects.
In Guix, ~guix hash~ and ~guix download~ are handy tools.
- With each package has different requirements, one of the biggest differences is how they're built.
Thus, you'll be paying a lot of attention to [[https://guix.gnu.org/en/manual/en/html_node/Build-Systems.html][build systems]].
Each build system has different parameters so be sure to visit it often.
- When declaring dependencies, it's a good idea to see how other packages have done in similar build systems.
Otherwise, it should be done on a case-by-case basis.
Just keep a reference to the ~package~ object on the side and it will be almost smooth sailing.
- Keep in mind that they also have a guideline for writing [[https://guix.gnu.org/en/manual/en/html_node/Synopses-and-Descriptions.html][synopsis and description]].
+ Synopsis shouldn't start with an uppercase letter, a common article (e.g., "a", "an", "the"), and doesn't end with a punctuation.
+ Descriptions should be five to ten sentences long formatted in [[https://www.gnu.org/software/texinfo/manual/texinfo/html_node/index.html][Texinfo]] without writing like a marketing sale pitch.
- Just for future reference, the popular MIT license is referred to as the [[https://directory.fsf.org/wiki/License:Expat][Expat license]].
* Testing your package
- ~guix build~
- You can test to build in other architectures with the QEMU binaries service.
* Creating a patch
# TODO: How to test your package
# TODO: How to make a patch from Git commits
# TODO: Relearn about git-email

44
2021-04-21-16-26-50.org Normal file
View File

@ -0,0 +1,44 @@
#+title: Using the built-in help system of Emacs
#+date: "2021-04-21 16:26:50 +08:00"
#+date_modified: "2021-04-21 18:01:56 +08:00"
#+language: en
[[roam:Emacs][GNU Emacs]], being a flexible program with a supremely overwhelming number of options to choose from (arguably), has a comprehensive help system.
[fn:: It's a necessity after all by how massive of a software this is.]
* General help system
- ~help-for-help~ is a function that gives you a metahelp interface to a number of options such as searching through pattern, logging the last keybindings, display the documentation from a keybinding, describe a language environment, and so on.
Most, if not all, of the options presented can be accessed in another way.
- ~apropos~, like its similarly named Unix program, searches through the entire symbol list of Emacs (e.g., variable, function) through a pattern.
- The series of functions from ~describe-*~ has multiple options for various specific things.
Among the list of describe functions, I recommend to start with ~describe-key~, ~describe-function~, ~describe-variable~, ~describe-package~, ~describe-mode~, and ~describe-variable~.
- Most of the objects (e.g., functions, variables, hooks) in Emacs also require a docstring so you'll have more relevant information at hand.
* evil-mode
evil-mode, being inspired from Vim keybindings, adds further into more ways for an instant access to documentation.
- ~evil-lookup~, similar to Vim's lookup key (~:help K~), searches through documentation of the language written on.
- ~evil-goto-definition~ can sometimes go into the original file where the keyword was defined.
It is only useful when the keyword is defined in the project or at least located on the project root.
* Doom Emacs-specific
- ~doom/help~ for Doom-specific documentations.
- ~doom/help-faq~ jumps ahead into the FAQ file with a convenient interface.
- ~doom/help-modules~ prompts you to search the documentation for Doom modules.