* Supac - A declarative package manager
:PROPERTIES:
:ID:       45a3a394-d05b-438a-9a5e-06f96e1a87e4
:END:

Supac is a declarative package manager written in rust, and configurable in [[https://github.com/nushell/nushell][nushell]].
It is meant to emulate nix but without the headaches that come along with it. It does
not maintain packages by itself but rather hooks with the existing package managers on your
system to configure them in a declarative fashion.

** Install
:PROPERTIES:
:ID:       2f3fd273-9e3b-4f83-8053-49c493841891
:END:

#+begin_src shell
  cargo install supac
  # alternately, if you use cargo-binstall
  cargo binstall supac
#+end_src

Install via git

#+begin_src shell
  cargo install --git https://codeberg.org/innocentzer0/supac.git
#+end_src

To build it manually, clone the repo, ~cd~ into it, and run ~cargo build~

** Chat
:PROPERTIES:
:ID:       bd7c28ed-8958-4722-8c8c-882699b20572
:END:

Join us at [[https://matrix.to/#/%23supac:matrix.org][matrix]] for discussion and support!

** Support
:PROPERTIES:
:ID:       2b69be5a-4830-485b-b321-dd27d3b51527
:END:
Right now the following package managers are supported:
- Arch Linux (any package manager that respects pacman's flags)
- Flatpak
- Cargo (both native toolchain and cargo-binstall)
- rustup

** Checklist of package managers
:PROPERTIES:
:ID:       2ffaa4f8-c89a-4e24-bb11-e7afb08e2cad
:END:

This is the order in which I wish to include package manager support:

- +rustup+
- uv/pipx
- ghcup
- opam
- npm
- dnf

** Upcoming features
:PROPERTIES:
:ID:       576a42fc-9fe5-411a-9dc8-490b7b31ab26
:END:

- +Allow dry-run+
- +update command+
- Add support for more package managers
- list active backends
- Allow disabling backends
- rebuild command
- Show unmanaged packages
- +Config validation+
- Allow config values to be set in command line as well
- allow setting config options for config-files whose config can be represented in a
  format parse-able by nushell
- +clean-cache command+
- +Flatpak systemwide installations+
- +=pacman= support for arch+
- +allow use of [[https://github.com/cargo-bins/cargo-binstall][cargo-binstall]] for cargo installations+

This is more or less a priority list on how I'd make updates to the repo. If you have any special
requests, please open an issue! Please note that codeberg issues take precedence.

** Package declaration
:PROPERTIES:
:ID:       c01e5b6d-2456-442a-8f60-33dae3f92698
:END:

An example is provided in the [[./example_config/][example_config]] folder.

A brief rundown:

- ~/home/user/.config/supac/package.nu~ should return a nu record with one record per backend
- For =Arch=, the record consists of a list of package records, each package labelled by its name
  and an optional post hook after execution.
- For =Cargo=, again, a list of package records, with each record labelled by its package name,
  an optional git remote, an optional post hook, optionally specifying the following:
  - =all_features=: whether the binary should be installed with all the optional opt-in features
  - =no_default_features=: whether the binary should be installed without any feature whatsoever
  - =features=: a list of features that the binary supports that it should be installed with
- For =Flatpak=, it parses three subrecords:
  - =Pinned=: This is not compulsory, but this is a list of pinned runtimes, optionally specifying
    the branch and the architecture, along with a post hook and a systemwide cofig
  - =Packages=: Like the other two, this specifies a list of package records. These may optionally
    contain the remote from which to install, whether to install systemwide, and a post hook
  - =Remotes=: Useless as of now, will be useful once the =rebuild= command is released
- For =Rustup=, it parses a record, where each field's name is the toolchain that you wish to
  install, and the entries are a list of target triples and a list of components. All targets
  must be explicitly stated. Default components can be skipped.

Anything except the package name is not needed in a package specification. The file ~config.nu~
in the same directory should return a record giving out the configuration. As of now, only three
config options are implemented, which are fairly self-descriptive.

* Copyright notice
:PROPERTIES:
:ID:       8383d887-a3de-4385-a4d1-3a76a86076ae
:END:
** Short version
:PROPERTIES:
:ID:       8390a8ae-6208-47d0-b113-161df5d29ed6
:END:

Copyright (c) 2025 innocentzer0 (on codeberg)

This project is licensed under the terms of either Apache 2.0 or MIT license at your option.

#+begin_example
SPDX-License-Identifier: MIT OR Apache-2.0
#+end_example

** Long version
:PROPERTIES:
:ID:       8bb9c1f6-2713-427b-abb5-1dcddd748bfa
:END:

Copyright (c) 2025 innocentzer0 (on codeberg)

Copyrights in this project are retained by contributors. No copyright assignment
is required to contribute to this project.

Except as otherwise noted (below and/or in individual files), this project is
licensed under the Apache License, Version 2.0
([[./LICENSE-APACHE][LICENSE-APACHE]] or http://www.apache.org/licenses/LICENSE-2.0) or the MIT license,
([[./LICENSE-MIT][LICENSE-MIT]] or http://opensource.org/licenses/MIT), at your option.
