r/o

nix/package: just a regular one thanks. de91b652 parent 187a8c96

peep> Running phase: unpackPhase peep> unpacking source archive /nix/store/gp18zhjzdcz2sbpd2rl3k8hwy1kv8zjd-peep-3.5.0 peep> source root is peep-3.5.0 peep> Running phase: patchPhase peep> Running phase: updateAutotoolsGnuConfigScriptsPhase peep> Running phase: configurePhase peep> Running phase: buildPhase peep> mix format failed for file: config/runtime.exs peep> ** (File.Error) could not write to file "/private/tmp/nix-build-peep-3.5.0.drv-0/peep-3.5.0/config/runtime.exs": permission denied peep> (elixir 1.18.4) lib/file.ex:1144: File.write!/3 peep> (mix 1.18.4) lib/mix/tasks/format.ex:738: Mix.Tasks.Format.write_or_print/3 peep> (mix 1.18.4) lib/mix/tasks/format.ex:727: Mix.Tasks.Format.format_file/2 peep> (elixir 1.18.4) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2 peep> (elixir 1.18.4) lib/task/supervised.ex:36: Task.Supervised.reply/4

authored by ~talya

👀
assets
assets/package-lock.json: use lockfile version 2. 7 months ago
👀
config
support optional database username, password, socket dir. 6 months ago
👀
lib
modernise a bit. 6 months ago
👀
native
blob view. 9 months ago
👀
nix
nix/package: just a regular one thanks.
👀
6 months ago
👀
priv
ref -> rev in es. 9 months ago
👀
rel
redo that a bit. 10 months ago
👀
test
router: change /users/new_repository to /new. 7 months ago
👀
.formatter.exs
prettier diffs. 11 months ago
👀
.gitignore
.gitignore: add assets/node_modules. 7 months ago
👀
Makefile
Makefile: add deploy-container{,-kind} targets. 6 months ago
👀
README.md
mix2nix -> deps_nix; replace rust-overlay with fenix. 7 months ago
👀
TAREAS.md
support optional database username, password, socket dir. 6 months ago
👀
flake.lock
mix2nix -> deps_nix; replace rust-overlay with fenix. 7 months ago
👀
flake.nix
remove erlang-jmsingle. 6 months ago
👀
mix.exs
mix.exs: add missing Phoenix.CodeReloader listener. 7 months ago
👀
mix.lock
oh no! 1.1.2 won't compile. try bumping phoenix to 1.8.0-rc.4. 7 months ago

README.md

nóssa

Phoenix/LiveView app hosting the website you’re looking at.

I wanted to host my software on my own turf, in my own way. This is the result. I’m hoping to add some nice interop to make collaboration easier; particularly things like ForgeFed and Friendly Forge Format (F3).

recursos / features

In most cases the answer to your question is “why not?”.

  • git2-rs-based repository access for web views.
  • git-http-backend interface supporting smart transport/v2.
  • LiveView frontend, with full support for non-JavaScript clients.
  • Extensive test coverage.
  • Comprehensive support for non-UTF-8 branch names, commit messages, filenames.
  • Localised, with English and LATAM Spanish to start.

See TAREAS.md for a list of things yet to be done!

desenvolvimento / development

The development and build process assumes you are able to use Nix flakes1.

Use nix develop to enter a dev shell. The first time you’re getting set up you’ll want to do a mix deps.get; we use Mix normally in dev, and then use deps_nix to make them reproducible for production builds.

Then:

  • make pg — starts Postgres with a database stored in ./db.
  • make server — runs the Phoenix server in IEx.
  • make testwatch — runs mix test every time a relevant file changes.
  • make coverwatch — runs mix test --cover every time a relevant file changes.

The last two also can take ARGS=....

construindo para produção / building for prod

  • nix build will produce a Mix release in result.
  • nix build .#nossa-docker will create a Docker image which can be run directly, or as part of an orchestration setup.
    • nix build .#packages.x86_64-linux.nossa-docker-jmsingle uses some special support for building x86_64 Linux Docker images on aarch64 Darwin hosts, which (without modification) would normally trap due to attempted double-mapping of JIT. It forces the equivalent of +JMsingle true by patching the Erlang used for nóssa and all dependencies.

There’s a NixOS module included, which can be used to deploy nóssa with a few lines of configuration. To do this, add the input to your own flake.nix:

nossa = {
url = "git+https://nossa.ee/~talya/nossa";
# Add as desired:
# inputs.nixpkgs.follows = "nixpkgs";
# inputs.flake-utils.follows = "flake-utils";
# inputs.rust-overlay.follows = "rust-overlay";
};

Then include the nossa.nixosModules.${system}.nossa module. You can now configure a nóssa installation per nix/module.nix:

services.nossa = {
enable = true;
port = 8000; # for your reverse proxy.
metricsPort = 8001; # prometheus-style metrics.
host = "your-nossa.ee"; # hostname nóssa runs on.
secretKeyBaseFile = somePath; # secret key base for Phoenix.
erlangCookieFile = anotherPath; # cookie for Erlang.
maxBodyLength = 1000000000; # max push size via HTTP.
};

nóssa avoids running its own epmd, so you will want to be running your own:

services.epmd.enable = true;

If you want to be able to connect to your running nóssa service, add the binary to your system path:

environment.systemPackages = [config.services.nossa.package];

Note that you’ll need to specify the path to the cookie in the environment to connect successfully. For example:

$ RELEASE_COOKIE="$(cat /run/secrets/erlang-cookie)" nossa remote

See the Distributed Erlang — Security section of the Erlang documentation for more details sobre o biscoito mágico.

There’s also a deprecated module included to deploy it into a NixOS-managed k3s environment, but I’ll probably replace this with an actual Helm chart.

  1. I am so sorry but I can’t find a single good link that would actually just take you through using them. It’s true what they say about Nix people. Try the Nix flakes page from Zero to Nix. It doesn’t really get any better than that.