ayn2op / discordo

A lightweight, secure, and feature-rich Discord terminal client.
MIT License
2.02k stars 63 forks source link

Add Nix flake #322

Open emanueljg opened 1 year ago

emanueljg commented 1 year ago

This PR adds support for the Nix build system.

ayn2op commented 11 months ago

There is already a NixOS package for discordo: https://search.nixos.org/packages?query=discordo

Arian-D commented 10 months ago

Hey, are there any updates on this?

I was the one who originally packaged discordo for nixpkgs earlier this year, and while I think it makes it more accessible for most people, I think a flake would provide additional benefits.

My biggest gripe at the moment is that I'm either using a version from last month, or if I want to get the most recent changes I'd have to pull and go build . manually. With nix flakes this would be a simple

nix run github:ayn2op/discordo/main

Nix would then run discordo, and if the most recent version is not there, it would pull and rebuild it before running.

linuxmobile commented 5 months ago

Hi, Does anyone know why the flake was removed?

epetousis commented 5 months ago

@ayn2op not required obviously but it would be pretty sweet if this could be merged (pending the changes to actually make it work). I understand if you're not interested in extra maintenance burden, however.

emanueljg commented 4 months ago

I'm trying to revive this PR. Got the following error while trying to build it on f272589:

[1/0/1 built] building discordo-20240427 (buildPhase): Building suerror: builder for '/nix/store/20l076j3cgdmlb4m6xzcl1c3d05s3n9z-discordo-20240427.drv' failed with exit code 1;
       last 24 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/gl53glqy1k0p645i2rmq0g72i78lynqn-kz20izh44jmjh61wfm1p5458g727gj9x-source
       > source root is kz20izh44jmjh61wfm1p5458g727gj9x-source
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > Running phase: buildPhase
       > Building subPackage .
       > Building subPackage ./cmd
       > Building subPackage ./internal/config
       > Building subPackage ./internal/constants
       > Building subPackage ./internal/logger
       > Building subPackage ./internal/markdown
       > Building subPackage ./internal/ui
       > Running phase: checkPhase
       > --- FAIL: TestParse (0.00s)
       >     markdown_test.go:23: got Don't [::b]communicate[::B] by sharing memory, share memory by communicating.; want Don't [::b]communicate[::-] by sharing memory, share memory by communicating.
       >     markdown_test.go:23: got [::i]Concurrency[::I] is not parallelism.; want [::i]Concurrency[::-] is not parallelism.
       >     markdown_test.go:23: got Channels [::u]orchestrate[::U]; mutexes [::u]serialize[::U].; want Channels [::u]orchestrate[::-]; mutexes [::u]serialize[::-].
       >     markdown_test.go:23: got [::s]Cgo[::S] is not Go.; want [::s]Cgo[::-] is not Go.
       >     markdown_test.go:23: got Don't just check [::r]errors[::R], handle them [::r]gracefully[::R].; want Don't just check [::r]errors[::-], handle them [::r]gracefully[::-].
       > FAIL
       > FAIL   github.com/ayn2op/discordo/internal/markdown    0.003s
       > FAIL
       For full logs, run 'nix log /nix/store/20l076j3cgdmlb4m6xzcl1c3d05s3n9z-discordo-20240427.drv'.

I'm not a Go expert. Anyone knows how to solve this? @epetousis @linuxmobile @Arian-D @ayn2op You can obviously just do doCheck = false temporarily but I would rather that the check goes through.

ayn2op commented 4 months ago

I'm trying to revive this PR. Got the following error while trying to build it on f272589:

[1/0/1 built] building discordo-20240427 (buildPhase): Building suerror: builder for '/nix/store/20l076j3cgdmlb4m6xzcl1c3d05s3n9z-discordo-20240427.drv' failed with exit code 1;
       last 24 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/gl53glqy1k0p645i2rmq0g72i78lynqn-kz20izh44jmjh61wfm1p5458g727gj9x-source
       > source root is kz20izh44jmjh61wfm1p5458g727gj9x-source
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > Running phase: buildPhase
       > Building subPackage .
       > Building subPackage ./cmd
       > Building subPackage ./internal/config
       > Building subPackage ./internal/constants
       > Building subPackage ./internal/logger
       > Building subPackage ./internal/markdown
       > Building subPackage ./internal/ui
       > Running phase: checkPhase
       > --- FAIL: TestParse (0.00s)
       >     markdown_test.go:23: got Don't [::b]communicate[::B] by sharing memory, share memory by communicating.; want Don't [::b]communicate[::-] by sharing memory, share memory by communicating.
       >     markdown_test.go:23: got [::i]Concurrency[::I] is not parallelism.; want [::i]Concurrency[::-] is not parallelism.
       >     markdown_test.go:23: got Channels [::u]orchestrate[::U]; mutexes [::u]serialize[::U].; want Channels [::u]orchestrate[::-]; mutexes [::u]serialize[::-].
       >     markdown_test.go:23: got [::s]Cgo[::S] is not Go.; want [::s]Cgo[::-] is not Go.
       >     markdown_test.go:23: got Don't just check [::r]errors[::R], handle them [::r]gracefully[::R].; want Don't just check [::r]errors[::-], handle them [::r]gracefully[::-].
       > FAIL
       > FAIL github.com/ayn2op/discordo/internal/markdown    0.003s
       > FAIL
       For full logs, run 'nix log /nix/store/20l076j3cgdmlb4m6xzcl1c3d05s3n9z-discordo-20240427.drv'.

I'm not a Go expert. Anyone knows how to solve this? @epetousis @linuxmobile @Arian-D @ayn2op You can obviously just do doCheck = false temporarily but I would rather that the check goes through.

Fixed in the latest commit.

ghost commented 4 months ago

oh right, the new changes. [::i]text[::I] is better because [::-] resets all the attributes instead of resetting only the italic attributes. [::b]BOLD[::i]italic[::-]not BOLD or italic[::-] [::b]BOLD[::i]italic[::I]BOLD and not italic[::B]

linuxmobile commented 4 months ago

I'm not a Go expert. Anyone knows how to solve this? @epetousis @linuxmobile @Arian-D @ayn2op

I am using my own flake: https://github.com/linuxmobile/kaku/blob/main/pkgs/discordo/default.nix

emanueljg commented 4 months ago

I've improved the flake further and now finally consider it ready for review.

Note that installation is still possible without home-manager. Just as before, it's as simple as

{ discordo, pkgs, ... }: {

  environment.systemPackages = [
    discordo.packages.${pkgs.system}.default
  ];
}

though of course you'll lose out on the dotfile management that home-manager is used for.

Please check ./nix/hm-module.nix for implementation details and option reference. When this PR is merged, we can create a follow-up PR that documents the Nix-related stuff.

PTAL @linuxmobile @ayn2op