Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npkg #677

Closed
wants to merge 9 commits into from
Closed

npkg #677

wants to merge 9 commits into from

Conversation

fj0r
Copy link
Contributor

@fj0r fj0r commented Nov 29, 2023

nushell pkgs

Features

  • the metadata declaration in a separate manifest.yml
  • declares dependency in pkgs fields
    • require: other npkg
    • use: npkg for build phase
    • include: os, defs, pip, npm, cargo, etc
  • custom package declaration in defs field
    • update version number in `data.yml '
    • support download, cloning, shell, etc
  • support cache and predown
  • there are plans to support deletion

Quick start

update version of asset that need to download

npkg update

download asset and upload

npkg download --cache http:https://file.s/npkg

generate sh script

npkg gensh 'debian' --clean nu nvim exec http

execute script

npkg setup --clean nu nvim exec http

@fj0r fj0r force-pushed the npkg branch 4 times, most recently from 68f1b28 to d7535b3 Compare November 29, 2023 10:04
@fdncred
Copy link
Collaborator

fdncred commented Nov 29, 2023

We're currently working on nupm. This kind of looks like a competitor.

@fj0r
Copy link
Contributor Author

fj0r commented Nov 30, 2023

i'm sorry. it's probably that npkg is the wrong name, it's more like ansible.

it is not used to manage nushell modules, but to perform various types of system management tasks, such as:

  • installing software through system package managers such as apt, rpm, apk
  • install modules through package managers in programming languages, such as cargo, npm, pip
  • download software via http and correct settings such as github releases
  • pull source code, configure by git clone
  • set environmental variables
  • modify configuration

@fj0r
Copy link
Contributor Author

fj0r commented Nov 30, 2023

the original purpose was to replace the shell script in Dockerfile, because shell script was unstructured. it can also be used to manage the operating system.

it is still generating shell scripts, which has the advantage of placing scripts and assets on the http site, then you can setup system through curl without nushell, like curl http:https://npkg-site/setup/a,b,c,d | sh . by adding similar configurations to openresty

location ~ /setup/(.*) {
    set $target $1;
    content_by_lua_block {
        local shell = require "resty.shell"
        local host = ngx.var.scheme..":https://".. ngx.var.http_host
        local cmd = 'nu npkg.nu setup --config ' .. host
        local ok, stdout, stderr, reason, status = shell.run(cmd..ngx.var.target, nil, 3000, 409600)
        if ok then
            ngx.say(stdout)
            ngx.exit(200)
        else
            ngx.say(stderr)
            ngx.exit(500)
        end
    }
}

http is supported as a cache and assets can be downloaded at once

and there's a very important feature that manifest can be fully customised, for example.

- git:
    url: https://github.com/your/nushell-configuration.git
    target: /etc/nushell

it's a way to customize a package management system that suits you perfectly.

@fdncred
Copy link
Collaborator

fdncred commented Nov 30, 2023

seems like you're inventing a whole system to manage something. i'm not sure that goes in this repo and it may need a repo by itself.

@amtoine
Copy link
Member

amtoine commented Nov 30, 2023

agree with @fdncred, that's 1241 locs and npkg might be a bit confusing with nupm 🤔

@fdncred
Copy link
Collaborator

fdncred commented Nov 30, 2023

closing this as not appropriate for nu_scripts.

@fdncred fdncred closed this Nov 30, 2023
@fj0r fj0r mentioned this pull request Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants