Giter VIP home page Giter VIP logo

13r0ck / zero-to-nix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from determinatesystems/zero-to-nix

0.0 1.0 0.0 2.91 MB

Zero to Nix is your guide to learning Nix and flakes. Created by Determinate Systems.

Home Page: https://zero-to-nix.com

License: Other

Shell 0.07% JavaScript 1.21% C++ 0.03% Python 0.15% Haskell 0.04% Scala 0.20% Go 0.09% Rust 0.07% TypeScript 6.50% CSS 2.60% Nix 10.41% HTML 0.09% Vue 24.00% MDX 54.54%

zero-to-nix's Introduction

Zero to Nix

FlakeHub

Zero to Nix is your guide to learning Nix and flakes. Created by Determinate Systems.

Setup

Make sure that you have Nix and direnv installed, then:

# Activate Nix development environment
direnv allow

# Recommended
alias npm=pnpm

Developing the site

Run locally

To run the site in development mode (with live reload when you make changes):

dev

To run the site in preview mode (with a static web server and no live reload):

preview

# Alternatively
nix run

Then open your browser to http://localhost:3000.

Run checks locally

The site has some CI checks that run in GitHub Actions, like link checking. To run the whole CI suite locally:

ci

Build locally

To ensure that the site can build properly in response to changes:

build

As an alternative, you can run the whole CI suite, which also builds the site.

Format code

To ensure that everything is properly formatted:

format

Publishing

The Zero to Nix site is automatically published on Vercel, which also provides deploy previews for pull requests.

Technologies

Zero to Nix's "stack" 🥞:

  • îles for content management and site generation
  • Vue for templating
  • MDX for content
  • Tailwind for CSS

MDX components

The site uses a number of custom MDX components to spice up the usual Markdown content.

Component What it does
Admonition An admonition block of type danger, info, success, or warning.

Adding an id makes it a stateful callout dropdown.
Concept Add a hoverable tool tip for a concept
Language Displays which (programming) language the user has selected
Languages Provides a (programming) language selector
NixStorePath Provides a colorful visualization of Nix store path components
Shell Provides language- and system-specific shell commands
SpecificLanguage Displays the enclosed content only if the user has selected a specific language
System Displays the currently selected system (Linux vs. macOS)
Systems Provides a system selector (Linux vs. macOS)

Note: any time you use one of these components in an MDX file, you need to add a client:load directive to it. This is one of îles' so-called hydration directives. There are other directives available, but client:load is the one that we need to use, as it ensures that the component is loaded as soon as the user comes to the page.

Directory structure

Directory What it contains
src/assets Assets to be processed (only CSS for now)
src/components Vue components used throughout the site
src/layouts Vue layouts for specific page types
src/logic TypeScript helper stuff for state and content management
src/pages The content of the site (all MDX) plus some Vue templates for specific pages
public Assets that won't be processed (favicon, etc.)

Page metadata

For quick start pages:

  • title
  • summary (an array of things that the user will accomplish in the guide)
  • order (ascending)

For concept pages:

  • title
  • snippet (a brief explanation of the concept that appears in pop-ups)
  • related (an array of IDs representing concept pages, like flakes or nix-store)
  • externalSources (an array of links to external sources, such as official docs)

Site logic

There are a few other important files you should be aware of when working on the site:

Suggested VS Code settings

If you happen to use VS Code as your editor, we recommend adding these extensions:

We also recommend adding these settings to your local .vscode/settings.json:

{
  "[mdx]": {
    // By default, this extension overwrites our one-sentence-per-line policy
    "editor.formatOnSave": false,
    // This is a nice helper for longer sentences
    "editor.wordWrapColumn": 100,
    "editor.wordWrap": "wordWrapColumn"
  },
  // Format everything using the Prettier config
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  // Keep junk out of your search results
  "search.exclude": {
    "**/.direnv": true,
    "**/.git": true,
    "**/node_modules": true,
    "dist": true,
    "pnpm-lock.yaml": true,
    "*.d.ts": true,
    "tmp": true
  }
}

zero-to-nix's People

Contributors

albertchae avatar badboy avatar bohendo avatar cole-h avatar derekbelrose avatar edolstra avatar figsoda avatar flexiondotorg avatar gerg-l avatar grahamc avatar henrik-ch avatar hoverbear avatar ipince avatar jgailor avatar jowj avatar jungleraptor avatar kubukoz avatar lucperkins avatar oahshtsua avatar oliviacrain avatar rmorey avatar robstolarz avatar rutrum avatar sectore avatar spacekookie avatar t3hmrman avatar twiclo avatar what-the-functor avatar whiteblackgoose avatar willbush avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.