{"id":13798327,"url":"https://github.com/noteed/nix-notes","last_synced_at":"2025-05-12T04:31:23.022Z","repository":{"id":66654577,"uuid":"226511265","full_name":"noteed/nix-notes","owner":"noteed","description":"A collection of short notes about Nix, each contributing to the same virtual machine image","archived":false,"fork":false,"pushed_at":"2022-12-10T13:38:00.000Z","size":49,"stargazers_count":54,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-08-04T00:03:01.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://noteed.com/nix-notes/","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noteed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-07T12:43:03.000Z","updated_at":"2024-06-17T07:17:34.000Z","dependencies_parsed_at":"2023-02-21T02:45:12.119Z","dependency_job_id":null,"html_url":"https://github.com/noteed/nix-notes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noteed%2Fnix-notes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noteed%2Fnix-notes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noteed%2Fnix-notes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noteed%2Fnix-notes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noteed","download_url":"https://codeload.github.com/noteed/nix-notes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225120017,"owners_count":17423818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:00:41.980Z","updated_at":"2024-11-18T03:09:19.863Z","avatar_url":"https://github.com/noteed.png","language":"Nix","funding_links":[],"categories":["Resources"],"sub_categories":["Learning"],"readme":"# Nix notes\n\nThis is a collection of short notes about Nix and NixOS. Almost each note\ncorresponds to a page, to a Git commit, and to a Nix attribute that can be\nbuilt.\n\nThe result is a virtual machine image that actually runs as\n[noteed.com](https://noteed.com).\n\n\n## How to read these notes\n\nThe notes should be read with a copy of this repository. To make each note\ncorrespond to a commit, this repository is heavily rebased. When studying a\nparticular note, especially the first ones, it is best to checkout the\ncorresponding commit to see only the relevant files for that note.\n\nIn other words, running `git log --patch --reverse` should be a readable\ntutorial about Nix and NixOS. Indeed, the following table of content is\ngenerated with `git log --reverse`!\n\nIf you have never used Nix before, you may want to start with the [Introduction\nto Nix](site/intro/index.md), although starting directly below should be more\nfun.\n\n\n## Bleeding edge\n\nNote: building Digital Ocean images is a recent addition to nixpkgs, and\nuploading a custom image is a recent feature of `doctl`. Assuming `../nixpkgs`\nis a recent checkout (around 2019-12-13), I'm using a Nix shell like this:\n\n```\n$ NIX_PATH=nixpkgs=../nixpkgs nix-shell -p doctl\n```\n\n\n## Table of content\n\n\n### Start here: building a Digital Ocean image\n\nIn this commit, we introduce a short Nix expression to build a virtual machine\nimage that can be run on Digital Ocean. The expression is short because all the\nmachinery to do the heavy lifting is in nixpkgs. [More.](site/image.md)\n\n\n### Aside: environment variables used for credentials\n\nIn this commit, we talk about two files that are in fact non under version-control.\nThey are used to store credentials for two command-line tools: `s3cmd` and `doctl`.\n[More.](site/credentials.md)\n\n\n### Deploying the image to Digital Ocean\n\nIn this commit, we add two scripts using the `s3cmd` and `doctl` tools. They\nuse the credentials introduced in the previous commit: `s3cmd` uploads to S3\nthe image built in the commit before, and `doctl` is used to import the image\ninto Digital Ocean then spin a new virtual machine. [More.](site/deploying.md)\n\n\n### Adding a static site to the Nginx configuration\n\nIn this commit, we add a simple static site to our image. In the next commit,\nwe'll see how to update an existing virtual machine with this static site,\nwithout rebuilding an image or a droplet. [More.](site/site.md)\n\n\n### Toplevel: updating a running virtual machine\n\nIn this commit, we add a new `toplevel` attribute, and a `deploy.sh` script.\nThe toplevel corresponds to the content of a virtual machine (before it is\npackaged as such), and the `deploy.sh` script syncs an existing NixOS machine\nso that it matches the new toplevel. [More.](site/toplevel.md)\n\n\n### Running the configuration inside a local VM\n\n[More.](site/runvm.md)\n\n\n### Using cron to run scheduled jobs\n\nIn this commit, we add a very simple system crontab demonstrating how to run a\nsimple command every five minutes. [More.](site/cron.md)\n\n\n### A simple Servant-based HTTP backend service\n\nIn this commit, we add a simple Haskell application using Servant. It listens\non port 8000 and we modify the Nginx configuration to forward requests to it.\nThis also shows how to register the application as a Systemd unit.\n[More.](site/app.md)\n\n\n### Packaging our application as a Docker image\n\nBuilding Docker images is a useful way to start using Nix where Docker is\nalready established. In this commit, we show how to build a Docker image\ncontaining the application we have created in the previous commit. [More.](site/docker.md)\n\n\n### Introduction to Nix\n\nIn these commits, we add a few examples to learn Nix.\n[More.](site/intro/index.md)\n\n\n### Adding automatic Let's encrypt certificate\n\nIn this commit, we use the built-in support for Let's encrypt offered in the\nNginx module. [More.](site/letsencrypt.md)\n\n\n## Details\n\nThe `configuration.nix` file is taken from the\n[nixos-generators](https://github.com/nix-community/nixos-generators) project,\nwhich makes it easy to build images in various formats, including the one used\nhere.\n\nI use the same Digital Ocean facility for both S3 and the droplets (i.e. ams3).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoteed%2Fnix-notes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoteed%2Fnix-notes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoteed%2Fnix-notes/lists"}