rose
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    fundamental problem which we are trying to solve: generate code, finish execution, then evaluate newly-generated code less powerful than true eval, but more powerful than const-eval problem dubbed "metahacks" bootstrap problem: how many files have to be created manually or generated? using zoxide as an example: - currently, the user adds a line in `env.nu` to generate a file with `zoxide init nushell`, and then adds a line to `config.nu` to source that file - if we want this to be set up completely automatically, for something like the 2-file autoload construction there would need to be a command, say, `zoxide init nushell-gen`, that users could run to create `00-generate-zoxide.nu`, which itself would contain some invocation of the original `zoxide init nushell` and saves that to `01-run-zoxide.nu`. **2-file autoload generation** uses two files in autoloads dir: generate and run - pros - generates inspectable artifact - if a single restart is acceptable to finish bootstraping, then already possible - cons - 2 files have to be bootstrapped (generate and run) - if run file doesn't exist already, does not work until shell restart - can be sidestepped by creating an empty run file - can be sidestepped by checking for new autoloads after running each autoload - is autoloads-generating-autoloads a good idea? - vendor autoload dirs might be immutable - can be sidestepped by adding user autoload dirs - order between different autoload directories is unclear - can be sidestepped by pooling together all files in all vendor load directories and then executing them in order **3-file autoload generation** uses three files: generate + source in autoloads dir, and run in cache (or temp?) directory - pros - avoids autoloads-generating-autoloads - does not suffer from first generation problem - unaffected by vendor autoloads being immutable - generates inspectable artifact - already possible - cons - 3 files have to be bootstrapped (generate, source, and run) - the number of files makes it rather unwieldy - order between different autoload directories is unclear - can be sidestepped by pooling together all files in all vendor load directories and then executing them in order **self updating autoload** autoload can overwrite itself as part of an update process - pros - only requires bootstrapping one file - cons - less powerful than a true metahack, since it requires a shell restart **generators folder** introduce a new folder, called "generators" folder. each file in the generators folder is run, and its output is evaluated - pros - only requires bootstrapping one file (..technically two if you count the output of the generator?) - no file i/o required - cons - requires entirely new feature - no inspectable artifact **multiple arguments to `source`** each file is parsed then evaluated one at a time. for example, `source generate-foo.nu run-foo.nu` doesn't parse and evaluate `run-foo.nu` until *after* `generate-foo.nu` - pros - doesn't rely on autoloads at all - generates inspectable artifact - cons - requires new feature **`env.nu` / `preconfig.nu`** - pros - literally already implemented - easy to explain in documentation - generates inspectable artifact - cons - runs before config is set up (you can't make use of `ENV_CONVERSIONS` for example) - all code generation has to happen in `env.nu` / `preconfig.nu`, no separation between metahacks - need to manually modify `env.nu` / `preconfig.nu` and `config.nu` to bootstrap (can't be completely automatic) **just don't** - pros - assumes every code generation use-case is already solvable via without metahacks - we don't have to do anything (other than remove `env.nu` / `preconfig.nu`) - for edge cases, some metahack constructions are already possible, just might be somewhat clunky - this might be acceptable if we can't identify any actual use cases we want to support - cons - if there's a use-case we want to specifically support where metahacks are required, then this is a non-starter # existing integrations Send PRs updating install instructions to use autoload-dirs - [ ] [atuin](https://github.com/ellie/atuin): 🐢 Magical shell history. - [ ] [broot](https://github.com/Canop/broot): A new way to see and navigate directory trees. - [ ] [Direnv](https://github.com/direnv/direnv/blob/master/docs/hook.md#nushell): unclutter your .profile. - [ ] [Dorothy](https://github.com/bevry/dorothy): 🧙‍♀️ Bring your dotfile commands and configuration to any shell, including Nu, Fish, Zsh, Bash. - [ ] [mise](https://mise.jdx.dev/installing-mise.html#nushell): A development environment setup tool (dev tools, env vars, task runner) that integrates with Nushell. - [ ] [oh-my-posh](https://ohmyposh.dev/docs/installation/prompt): A prompt theme engine for any shell. - [ ] [starship](https://starship.rs/#nushell): The minimal, blazing-fast, and infinitely customizable prompt for any shell. - [ ] [zoxide](https://github.com/ajeetdsouza/zoxide): A smarter cd command, inspired by z and autojump. # status update for 2024-12-11 meeting - Context - Since `const NU_LIB_DIRS` and `const NU_PLUGIN_DIRS` were introduced, `env.nu` is no longer needed for its original purpose of setting up an environment to populate `$env.config` - exception: `env.nu` is still required to use `ENV_CONVERSIONS` in `config.nu`, but this should not be the case for much longer - However, some use cases require some code to be generated in `env.nu` which is then `source`d in `config.nu` - These have been dubbed "metahacks" - Last meeting, general conclusion was to rename `env.nu` to `preconfig.nu` to continue supporting metahacks, but de-emphasize its usage in favor of vendor autoloads - After last meeting, Douglas put together a draft PR to rename `env.nu` to `preconfig.nu`, but there were two major concerns raised: 1. Third party integrators still rely on `env.nu`, and we don't want to break any integrations with the rename. 2. Before going forward with the rename from `env.nu` to `preconfig.nu`, we should make sure there isn't a better and cleaner solution which provides equivalent or better functionality compared to `env.nu`. - Various ideas for how metahacks might work without `env.nu` were discussed in the [Discord thread](https://discord.com/channels/601130461678272522/1314725454850293780) (including Douglas, Darren, Bahex, and Rose). A few takeaways: - It would be preferable for metahacks to run _after_ `config.nu` rather than before, since then you also have access to `NU_LIB_DIRS`, `ENV_CONVERSIONS`, etc. - There isn't any advantage to running code _before_ `config.nu`. All configuration values, including `const`s, can be set after `config.nu` is loaded. - There are already some working patterns for metahacks using autoloads, but none are seamless. Requires more investigation. - Our general recommendation is that integrations should instruct the user to generate and save their configuration once, rather than using a metahack to regenerate every time (better for startup time) - No conclusions yet on what the path forward should be (ie., `preconfig.nu` or some other solution), but here are the next steps before `env.nu` is renamed or removed: - Move `ENV_CONVERSIONS` out of `env.nu` (Douglas and Bahex are working on this) - Make PRs to third-party integrators switching from `env.nu` to vendor autoloads (Bahex created a list to go through) - There are no plans to remove or stop generating `env.nu` in 0.101. Currently (as of 0.100), both `config.nu` and `env.nu` only contain comments. - Darren noted he doesn't want `env.nu` removed/renamed until we are certain we've determined the final solution for metahacks

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully