├── .appends └── .github │ └── labels.yml ├── .github ├── CODEOWNERS ├── dependabot.yml ├── labels.yml └── workflows │ ├── configlet.yml │ └── sync-labels.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── bin └── fetch-configlet ├── config.json ├── docs ├── ABOUT.md ├── INSTALLATION.md ├── LEARNING.md ├── RESOURCES.md ├── SNIPPET.txt ├── TESTS.md └── config.json ├── exercises ├── practice │ └── hello-world │ │ ├── .docs │ │ └── instructions.md │ │ ├── .meta │ │ ├── config.json │ │ ├── example.nix │ │ └── tests.toml │ │ ├── hello-world-test.nix │ │ └── hello-world.nix └── shared │ └── .docs │ ├── help.md │ └── tests.md └── img └── .keep /.appends/.github/labels.yml: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------------------- # 2 | # These are the repository-specific labels that augment the Exercise-wide labels defined in # 3 | # https://github.com/exercism/org-wide-files/blob/main/global-files/.github/labels.yml. # 4 | # ----------------------------------------------------------------------------------------- # 5 | 6 | - name: "bug" 7 | description: "Something isn't working" 8 | color: "d73a4a" 9 | 10 | - name: "documentation" 11 | description: "Improvements or additions to documentation" 12 | color: "0075ca" 13 | 14 | - name: "duplicate" 15 | description: "This issue or pull request already exists" 16 | color: "cfd3d7" 17 | 18 | - name: "enhancement" 19 | description: "New feature or request" 20 | color: "a2eeef" 21 | 22 | - name: "good first issue" 23 | description: "Good for newcomers" 24 | color: "7057ff" 25 | 26 | - name: "help wanted" 27 | description: "Extra attention is needed" 28 | color: "008672" 29 | 30 | - name: "invalid" 31 | description: "This doesn't seem right" 32 | color: "e4e669" 33 | 34 | - name: "question" 35 | description: "Further information is requested" 36 | color: "d876e3" 37 | 38 | - name: "wontfix" 39 | description: "This will not be worked on" 40 | color: "ffffff" 41 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners 2 | .github/CODEOWNERS @exercism/maintainers-admin 3 | 4 | # Changes to `fetch-configlet` should be made in the `exercism/configlet` repo 5 | bin/fetch-configlet @exercism/maintainers-admin 6 | 7 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | 5 | # Keep dependencies for GitHub Actions up-to-date 6 | - package-ecosystem: 'github-actions' 7 | directory: '/' 8 | schedule: 9 | interval: 'daily' 10 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- # 2 | # This is an auto-generated file - Do not manually edit this file # 3 | # --------------------------------------------------------------- # 4 | 5 | # This file is automatically generated by concatenating two files: 6 | # 7 | # 1. The Exercism-wide labels: defined in https://github.com/exercism/org-wide-files/blob/main/global-files/.github/labels.yml 8 | # 2. The repository-specific labels: defined in the `.appends/.github/labels.yml` file within this repository. 9 | # 10 | # If any of these two files change, a pull request is automatically created containing a re-generated version of this file. 11 | # Consequently, to change repository-specific labels you should update the `.appends/.github/labels.yml` file and _not_ this file. 12 | # 13 | # When the pull request has been merged, the GitHub labels will be automatically updated by the "Sync labels" workflow. 14 | # This typically takes 5-10 minutes. 15 | 16 | # --------------------------------------------------------------------- # 17 | # These are the Exercism-wide labels which are shared across all repos. # 18 | # --------------------------------------------------------------------- # 19 | 20 | # The following Exercism-wide labels are used to show "tasks" on the website, which will point users to things they can contribute to. 21 | 22 | # The `x:action/` labels describe what sort of work the contributor will be engaged in when working on the issue 23 | - name: "x:action/create" 24 | description: "Work on something from scratch" 25 | color: "ffffff" 26 | 27 | - name: "x:action/fix" 28 | description: "Fix an issue" 29 | color: "ffffff" 30 | 31 | - name: "x:action/improve" 32 | description: "Improve existing functionality/content" 33 | color: "ffffff" 34 | 35 | - name: "x:action/proofread" 36 | description: "Proofread text" 37 | color: "ffffff" 38 | 39 | - name: "x:action/sync" 40 | description: "Sync content with its latest version" 41 | color: "ffffff" 42 | 43 | # The `x:knowledge/` labels describe how much Exercism knowledge is required by the contributor 44 | - name: "x:knowledge/none" 45 | description: "No existing Exercism knowledge required" 46 | color: "ffffff" 47 | 48 | - name: "x:knowledge/elementary" 49 | description: "Little Exercism knowledge required" 50 | color: "ffffff" 51 | 52 | - name: "x:knowledge/intermediate" 53 | description: "Quite a bit of Exercism knowledge required" 54 | color: "ffffff" 55 | 56 | - name: "x:knowledge/advanced" 57 | description: "Comprehensive Exercism knowledge required" 58 | color: "ffffff" 59 | 60 | # The `x:module/` labels indicate what part of Exercism the contributor will be working on 61 | - name: "x:module/analyzer" 62 | description: "Work on Analyzers" 63 | color: "ffffff" 64 | 65 | - name: "x:module/concept" 66 | description: "Work on Concepts" 67 | color: "ffffff" 68 | 69 | - name: "x:module/concept-exercise" 70 | description: "Work on Concept Exercises" 71 | color: "ffffff" 72 | 73 | - name: "x:module/generator" 74 | description: "Work on Exercise generators" 75 | color: "ffffff" 76 | 77 | - name: "x:module/practice-exercise" 78 | description: "Work on Practice Exercises" 79 | color: "ffffff" 80 | 81 | - name: "x:module/representer" 82 | description: "Work on Representers" 83 | color: "ffffff" 84 | 85 | - name: "x:module/test-runner" 86 | description: "Work on Test Runners" 87 | color: "ffffff" 88 | 89 | # The `x:rep/` labels describe the amount of reputation to award 90 | # 91 | # For more information on reputation and how these labels should be used, 92 | # check out https://exercism.org/docs/using/product/reputation 93 | - name: "x:rep/tiny" 94 | description: "Tiny amount of reputation" 95 | color: "ffffff" 96 | 97 | - name: "x:rep/small" 98 | description: "Small amount of reputation" 99 | color: "ffffff" 100 | 101 | - name: "x:rep/medium" 102 | description: "Medium amount of reputation" 103 | color: "ffffff" 104 | 105 | - name: "x:rep/large" 106 | description: "Large amount of reputation" 107 | color: "ffffff" 108 | 109 | - name: "x:rep/massive" 110 | description: "Massive amount of reputation" 111 | color: "ffffff" 112 | 113 | # The `x:size/` labels describe the expected amount of work for a contributor 114 | - name: "x:size/tiny" 115 | description: "Tiny amount of work" 116 | color: "ffffff" 117 | 118 | - name: "x:size/small" 119 | description: "Small amount of work" 120 | color: "ffffff" 121 | 122 | - name: "x:size/medium" 123 | description: "Medium amount of work" 124 | color: "ffffff" 125 | 126 | - name: "x:size/large" 127 | description: "Large amount of work" 128 | color: "ffffff" 129 | 130 | - name: "x:size/massive" 131 | description: "Massive amount of work" 132 | color: "ffffff" 133 | 134 | # The `x:status/` label indicates if there is already someone working on the issue 135 | - name: "x:status/claimed" 136 | description: "Someone is working on this issue" 137 | color: "ffffff" 138 | 139 | # The `x:type/` labels describe what type of work the contributor will be engaged in 140 | - name: "x:type/ci" 141 | description: "Work on Continuous Integration (e.g. GitHub Actions workflows)" 142 | color: "ffffff" 143 | 144 | - name: "x:type/coding" 145 | description: "Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)" 146 | color: "ffffff" 147 | 148 | - name: "x:type/content" 149 | description: "Work on content (e.g. exercises, concepts)" 150 | color: "ffffff" 151 | 152 | - name: "x:type/docker" 153 | description: "Work on Dockerfiles" 154 | color: "ffffff" 155 | 156 | - name: "x:type/docs" 157 | description: "Work on Documentation" 158 | color: "ffffff" 159 | 160 | # This Exercism-wide label is added to all automatically created pull requests that help migrate/prepare a track for Exercism v3 161 | - name: "v3-migration 🤖" 162 | description: "Preparing for Exercism v3" 163 | color: "e99695" 164 | 165 | # This Exercism-wide label can be used to bulk-close issues in preparation for pausing community contributions 166 | - name: "paused" 167 | description: "Work paused until further notice" 168 | color: "e4e669" 169 | 170 | # ----------------------------------------------------------------------------------------- # 171 | # These are the repository-specific labels that augment the Exercise-wide labels defined in # 172 | # https://github.com/exercism/org-wide-files/blob/main/global-files/.github/labels.yml. # 173 | # ----------------------------------------------------------------------------------------- # 174 | 175 | - name: "bug" 176 | description: "Something isn't working" 177 | color: "d73a4a" 178 | 179 | - name: "documentation" 180 | description: "Improvements or additions to documentation" 181 | color: "0075ca" 182 | 183 | - name: "duplicate" 184 | description: "This issue or pull request already exists" 185 | color: "cfd3d7" 186 | 187 | - name: "enhancement" 188 | description: "New feature or request" 189 | color: "a2eeef" 190 | 191 | - name: "good first issue" 192 | description: "Good for newcomers" 193 | color: "7057ff" 194 | 195 | - name: "help wanted" 196 | description: "Extra attention is needed" 197 | color: "008672" 198 | 199 | - name: "invalid" 200 | description: "This doesn't seem right" 201 | color: "e4e669" 202 | 203 | - name: "question" 204 | description: "Further information is requested" 205 | color: "d876e3" 206 | 207 | - name: "wontfix" 208 | description: "This will not be worked on" 209 | color: "ffffff" 210 | -------------------------------------------------------------------------------- /.github/workflows/configlet.yml: -------------------------------------------------------------------------------- 1 | name: Configlet 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | configlet: 15 | uses: exercism/github-actions/.github/workflows/configlet.yml@main 16 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yml: -------------------------------------------------------------------------------- 1 | name: Tools 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - .github/labels.yml 9 | - .github/workflows/sync-labels.yml 10 | workflow_dispatch: 11 | schedule: 12 | - cron: 0 0 1 * * # First day of each month 13 | 14 | permissions: 15 | issues: write 16 | 17 | jobs: 18 | sync-labels: 19 | uses: exercism/github-actions/.github/workflows/labels.yml@main 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | .DS_Store 3 | bin/configlet 4 | bin/configlet.exe 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | ## Introduction 4 | 5 | Exercism is a platform centered around empathetic conversation. 6 | We have a low tolerance for communication that makes anyone feel unwelcome, unsupported, insulted or discriminated against. 7 | 8 | ## Seen or experienced something uncomfortable? 9 | 10 | If you see or experience abuse, harassment, discrimination, or feel unsafe or upset, please email [abuse@exercism.org](mailto:abuse@exercism.org?subject=%5BCoC%5D) and include \[CoC\] in the subject line. 11 | We will follow up with you as a priority. 12 | 13 | ## Enforcement 14 | 15 | We actively monitor for Code of Conduct (CoC) violations and take any reports of violations extremely seriously. 16 | We have banned contributors, mentors and users due to violations. 17 | 18 | After we receive a report of a CoC violation, we view that person's conversation history on Exercism and related communication channels and attempt to understand whether someone has deliberately broken the CoC, or accidentally crossed a line. 19 | We generally reach out to the person who has been reported to discuss any concerns we have and warn them that repeated violations will result in a ban. 20 | Sometimes we decide that no violation has occurred and that no action is required and sometimes we will also ban people on a first offense. 21 | We strive to be fair, but will err on the side of protecting the culture of our community. 22 | 23 | Exercism's leadership reserve the right to take whatever action they feel appropriate with regards to CoC violations. 24 | 25 | ## The simple version 26 | 27 | - Be empathetic 28 | - Be welcoming 29 | - Be kind 30 | - Be honest 31 | - Be supportive 32 | - Be polite 33 | 34 | ## The details 35 | 36 | Exercism should be a safe place for everybody regardless of 37 | 38 | - Gender, gender identity or gender expression 39 | - Sexual orientation 40 | - Disability 41 | - Physical appearance (including but not limited to body size) 42 | - Race 43 | - Age 44 | - Religion 45 | - Anything else you can think of 46 | 47 | As someone who is part of this community, you agree that: 48 | 49 | - We are collectively and individually committed to safety and inclusivity 50 | - We have zero tolerance for abuse, harassment, or discrimination 51 | - We respect people’s boundaries and identities 52 | - We refrain from using language that can be considered offensive or oppressive (systemically or otherwise), eg. sexist, racist, homophobic, transphobic, ableist, classist, etc. 53 | - this includes (but is not limited to) various slurs. 54 | - We avoid using offensive topics as a form of humor 55 | 56 | We actively work towards: 57 | 58 | - Being a safe community 59 | - Cultivating a network of support & encouragement for each other 60 | - Encouraging responsible and varied forms of expression 61 | 62 | We condemn: 63 | 64 | - Stalking, doxxing, or publishing private information 65 | - Violence, threats of violence or violent language 66 | - Anything that compromises people’s safety 67 | - Conduct or speech which might be considered sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory or offensive in nature 68 | - The use of unwelcome, suggestive, derogatory or inappropriate nicknames or terms 69 | - Disrespect towards others (jokes, innuendo, dismissive attitudes) and towards differences of opinion 70 | - Intimidation or harassment (online or in-person). 71 | Please read the [Citizen Code of Conduct](https://github.com/stumpsyn/policies/blob/master/citizen_code_of_conduct.md) for how we interpret harassment 72 | - Inappropriate attention or contact 73 | - Not understanding the differences between constructive criticism and disparagement 74 | 75 | These things are NOT OK. 76 | 77 | Be aware of how your actions affect others. 78 | If it makes someone uncomfortable, stop. 79 | 80 | If you say something that is found offensive, and you are called out on it, try to: 81 | 82 | - Listen without interruption 83 | - Believe what the person is saying & do not attempt to disqualify what they have to say 84 | - Ask for tips / help with avoiding making the offense in the future 85 | - Apologize and ask forgiveness 86 | 87 | ## History 88 | 89 | This policy was initially adopted from the Front-end London Slack community and has been modified since. 90 | A version history can be seen on [GitHub](https://github.com/exercism/website-copy/edit/main/pages/code_of_conduct.md). 91 | 92 | _This policy is a "living" document, and subject to refinement and expansion in the future. 93 | This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Slack, Twitter, email) and any other Exercism entity or event._ 94 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Exercism 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Exercism Nix Track 2 | 3 | ## Status 4 | 5 | The track has had very little work done on it since creating the repository. 6 | The only exercise that exists is `hello-world`. 7 | 8 | If you wish to work on this track, please post in the [Exercism Community Forum](https://forum.exercism.org/c/exercism/building-exercism/125) to discuss it with the team. 9 | -------------------------------------------------------------------------------- /bin/fetch-configlet: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This file is a copy of the 4 | # https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. 5 | # Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. 6 | 7 | set -eo pipefail 8 | 9 | curlopts=( 10 | --silent 11 | --show-error 12 | --fail 13 | --location 14 | --retry 3 15 | ) 16 | 17 | if [[ -n "${GITHUB_TOKEN}" ]]; then 18 | curlopts+=(--header "authorization: Bearer ${GITHUB_TOKEN}") 19 | fi 20 | 21 | get_download_url() { 22 | local os="$1" 23 | local ext="$2" 24 | local latest='https://api.github.com/repos/exercism/configlet/releases/latest' 25 | local arch 26 | case "$(uname -m)" in 27 | x86_64) arch='x86-64' ;; 28 | *686*) arch='i386' ;; 29 | *386*) arch='i386' ;; 30 | *) arch='x86-64' ;; 31 | esac 32 | local suffix="${os}_${arch}.${ext}" 33 | curl "${curlopts[@]}" --header 'Accept: application/vnd.github.v3+json' "${latest}" | 34 | grep "\"browser_download_url\": \".*/download/.*/configlet.*${suffix}\"$" | 35 | cut -d'"' -f4 36 | } 37 | 38 | main() { 39 | local output_dir 40 | if [[ -d ./bin ]]; then 41 | output_dir="./bin" 42 | elif [[ $PWD == */bin ]]; then 43 | output_dir="$PWD" 44 | else 45 | echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 46 | return 1 47 | fi 48 | 49 | local os 50 | case "$(uname)" in 51 | Darwin*) os='macos' ;; 52 | Linux*) os='linux' ;; 53 | Windows*) os='windows' ;; 54 | MINGW*) os='windows' ;; 55 | MSYS_NT-*) os='windows' ;; 56 | *) os='linux' ;; 57 | esac 58 | 59 | local ext 60 | case "${os}" in 61 | windows*) ext='zip' ;; 62 | *) ext='tar.gz' ;; 63 | esac 64 | 65 | echo "Fetching configlet..." >&2 66 | local download_url 67 | download_url="$(get_download_url "${os}" "${ext}")" 68 | local output_path="${output_dir}/latest-configlet.${ext}" 69 | curl "${curlopts[@]}" --output "${output_path}" "${download_url}" 70 | 71 | case "${ext}" in 72 | *zip) unzip "${output_path}" -d "${output_dir}" ;; 73 | *) tar xzf "${output_path}" -C "${output_dir}" ;; 74 | esac 75 | 76 | rm -f "${output_path}" 77 | 78 | local executable_ext 79 | case "${os}" in 80 | windows*) executable_ext='.exe' ;; 81 | *) executable_ext='' ;; 82 | esac 83 | 84 | local configlet_path="${output_dir}/configlet${executable_ext}" 85 | local configlet_version 86 | configlet_version="$(${configlet_path} --version)" 87 | echo "Downloaded configlet ${configlet_version} to ${configlet_path}" 88 | } 89 | 90 | main 91 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "track_id": "nix", 3 | "language": "Nix", 4 | "slug": "nix", 5 | "active": false, 6 | "status": { 7 | "concept_exercises": false, 8 | "test_runner": false, 9 | "representer": false, 10 | "analyzer": false 11 | }, 12 | "blurb": "Nix is a dynamically typed, functional DSL for the Nix package manager.", 13 | "version": 3, 14 | "online_editor": { 15 | "indent_style": "space", 16 | "indent_size": 2, 17 | "highlightjs_language": "nix" 18 | }, 19 | "files": { 20 | "solution": ["%{kebab_slug}.nix"], 21 | "test": ["%{kebab_slug}-test.nix"], 22 | "example": [".meta/example.nix"] 23 | }, 24 | "exercises": { 25 | "concept": [], 26 | "practice": [ 27 | { 28 | "slug": "hello-world", 29 | "name": "Hello World", 30 | "uuid": "abb66352-3a60-424b-82c3-7e0046e5d450", 31 | "practices": [], 32 | "prerequisites": [], 33 | "difficulty": 1 34 | } 35 | ] 36 | }, 37 | "concepts": [], 38 | "key_features": [ 39 | { 40 | "title": "Purely Functional", 41 | "content": "Nix is a purely functional language, with no side effects.", 42 | "icon": "functional" 43 | }, 44 | { 45 | "title": "Lazy", 46 | "content": "Expressions are only evaluated when they are needed.", 47 | "icon": "evolving" 48 | }, 49 | { 50 | "title": "Dynamic", 51 | "content": "Nix's dynamic typing supports powerful metaprogramming.", 52 | "icon": "powerful" 53 | }, 54 | { 55 | "title": "Familiar", 56 | "content": "Nix's syntax is similar to JSON, which makes it easy to read and write.", 57 | "icon": "easy" 58 | }, 59 | { 60 | "title": "Simple", 61 | "content": "There is a small set of core features.", 62 | "icon": "small" 63 | }, 64 | { 65 | "title": "Community-Supported", 66 | "content": "Nix is developed by a diverse community", 67 | "icon": "community" 68 | } 69 | ], 70 | "tags": [ 71 | "paradigm/functional", 72 | "typing/dynamic", 73 | "typing/strong", 74 | "execution_mode/interpreted", 75 | "platform/mac", 76 | "platform/linux", 77 | "runtime/language_specific" 78 | ] 79 | } 80 | -------------------------------------------------------------------------------- /docs/ABOUT.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | [Nix](https://nixos.org) is a pure, lazy, strongly typed, functional programming language that is used as a DSL for the Nix package manager. 4 | 5 | Nix's laziness makes it a great choice for package management because expressions are not evaluated until they are needed. 6 | Purity means that functions do not have unexpected side-effects. 7 | 8 | The largest library of Nix expressions is the [Nixpkgs](http://nixpkgs.org) package repository (containing over 80,000 packages). 9 | The Nix package manager enables building software that is reproducible and portable across different systems. 10 | 11 | -------------------------------------------------------------------------------- /docs/INSTALLATION.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | The interpreter for the Nix expression language is the Nix package manager. It is available for Linux, macOS, and Windows (using WSL2). 4 | You can install it by following the [installation instructions](https://nixos.org/download/). 5 | 6 | After completing the installation, you can verify it by running the following command: 7 | ```bash 8 | nix --version 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/LEARNING.md: -------------------------------------------------------------------------------- 1 | # Learning 2 | 3 | -------------------------------------------------------------------------------- /docs/RESOURCES.md: -------------------------------------------------------------------------------- 1 | # Resources for Learning Nix 2 | 3 | ## Reference Materials 4 | - [The Nix Manual](https://nixos.org/manual/nix/stable/expressions/writing-nix-expressions.html) 5 | - [Nixpkgs Library Functions](https://nixos.org/manual/nixpkgs/stable/#chap-functions) 6 | - [A tour of Nix](https://nixcloud.io/tour) 7 | - [NixOS Wiki](https://nixos.wiki/wiki/Nix_Expression_Language) 8 | - [Learn X in Y Minutes](https://learnxinyminutes.com/docs/nix/) 9 | - [Nix Pills](https://nixos.org/guides/nix-pills) 10 | 11 | ## Getting Help 12 | - [NixOS Forum](https://discourse.nixos.org/) 13 | - [NixOS Matrix Space](https://matrix.to/#/#community:nixos.org) 14 | 15 | -------------------------------------------------------------------------------- /docs/SNIPPET.txt: -------------------------------------------------------------------------------- 1 | rec { 2 | fibonacci = n: 3 | if n <= 1 then n else (fibonacci (n - 1) + fibonacci (n - 2)); 4 | } 5 | -------------------------------------------------------------------------------- /docs/TESTS.md: -------------------------------------------------------------------------------- 1 | # Tests 2 | 3 | We use the `lib.debug.runTests` function from the Nixpkgs standard library to run the tests. 4 | Nixpkgs should be automatically set up when you install Nix. 5 | 6 | ## Running the Tests 7 | To run the tests, navigate to the exercise folder using `cd {exercise-folder-location}`. 8 | Then run the following command: 9 | ```shell 10 | nix eval --raw -f {exercise-test.nix} 11 | ``` 12 | If this command doesn't work, you can instead try: 13 | ```shell 14 | nix-instantiate --eval {exercise-test.nix} 15 | ``` 16 | 17 | -------------------------------------------------------------------------------- /docs/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": [] 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | The classical introductory exercise. Just say "Hello, World!". 4 | 5 | ["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is 6 | the traditional first program for beginning programming in a new language 7 | or environment. 8 | 9 | The objectives are simple: 10 | 11 | - Modify the provided code so that it produces the string "Hello, World!". 12 | - Run the test suite and make sure that it succeeds. 13 | - Submit your solution and check it at the website. 14 | 15 | If everything goes well, you will be ready to fetch your first real exercise. 16 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wenngle" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "hello-world.nix" 8 | ], 9 | "test": [ 10 | "hello-world-test.nix" 11 | ], 12 | "example": [ 13 | ".meta/example.nix" 14 | ] 15 | }, 16 | "blurb": "The classical introductory exercise. Just say \"Hello, World!\".", 17 | "source": "This is an exercise to introduce users to using Exercism", 18 | "source_url": "http://en.wikipedia.org/wiki/%22Hello,_world!%22_program" 19 | } 20 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.meta/example.nix: -------------------------------------------------------------------------------- 1 | { 2 | hello = {}: "Hello, World!"; 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.meta/tests.toml: -------------------------------------------------------------------------------- 1 | # This is an auto-generated file. 2 | # 3 | # Regenerating this file via `configlet sync` will: 4 | # - Recreate every `description` key/value pair 5 | # - Recreate every `reimplements` key/value pair, where they exist in problem-specifications 6 | # - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) 7 | # - Preserve any other key/value pair 8 | # 9 | # As user-added comments (using the # character) will be removed when this file 10 | # is regenerated, comments can be added via a `comment` key. 11 | 12 | [af9ffe10-dc13-42d8-a742-e7bdafac449d] 13 | description = "Say Hi!" 14 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/hello-world-test.nix: -------------------------------------------------------------------------------- 1 | with builtins; let 2 | lib = import ; 3 | helloWorld = import ./hello-world.nix; 4 | results = lib.debug.runTests { 5 | testHello = { 6 | expr = helloWorld.hello {}; 7 | expected = "Hello, World!"; 8 | }; 9 | }; 10 | in 11 | if results == [] 12 | then "All tests passed!\n" 13 | else 14 | deepSeq 15 | (map 16 | (t: 17 | trace '' 18 | ${t.name}: 19 | expected: ${t.expected} 20 | result: ${t.result}'' 21 | t) 22 | results) 23 | (throw "${toString (length results)} tests failed!\n") 24 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/hello-world.nix: -------------------------------------------------------------------------------- 1 | { 2 | hello = {}: "Goodbye, Mars!"; 3 | } 4 | -------------------------------------------------------------------------------- /exercises/shared/.docs/help.md: -------------------------------------------------------------------------------- 1 | # {{ .Spec.Name }} 2 | 3 | {{ .Spec.Description -}} 4 | {{- with .Hints }} 5 | {{ . -}} 6 | {{ end }} 7 | {{- with .TrackInsert }} 8 | {{ . -}} 9 | {{ end }} 10 | {{- with .Spec.Credits }} 11 | ## Source 12 | 13 | {{ . }} 14 | {{ end }} 15 | ## Submitting Incomplete Solutions 16 | It's possible to submit an incomplete solution so you can see how others have completed the exercise. 17 | -------------------------------------------------------------------------------- /exercises/shared/.docs/tests.md: -------------------------------------------------------------------------------- 1 | # {{ .Spec.Name }} 2 | 3 | {{ .Spec.Description -}} 4 | {{- with .Hints }} 5 | {{ . -}} 6 | {{ end }} 7 | {{- with .TrackInsert }} 8 | {{ . -}} 9 | {{ end }} 10 | {{- with .Spec.Credits }} 11 | ## Source 12 | 13 | {{ . }} 14 | {{ end }} 15 | ## Submitting Incomplete Solutions 16 | It's possible to submit an incomplete solution so you can see how others have completed the exercise. 17 | -------------------------------------------------------------------------------- /img/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/nix/244cfb1a38b2dde752856f47fc573493f4b984d9/img/.keep --------------------------------------------------------------------------------