feat: add nix support (#336)
This commit is contained in:
@@ -33,6 +33,23 @@ The formula pulls in all required runtime libraries automatically.
|
||||
yay -S cliamp
|
||||
```
|
||||
|
||||
**Nix**
|
||||
|
||||
```sh
|
||||
nix run github:bjarneo/cliamp
|
||||
```
|
||||
|
||||
For a declarative NixOS configuration, add `github:bjarneo/cliamp` as a flake
|
||||
input and install its default package:
|
||||
|
||||
```nix
|
||||
inputs.cliamp.url = "github:bjarneo/cliamp";
|
||||
|
||||
environment.systemPackages = [
|
||||
inputs.cliamp.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
];
|
||||
```
|
||||
|
||||
**Go**
|
||||
|
||||
```sh
|
||||
|
||||
Generated
+27
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1787135253,
|
||||
"narHash": "sha256-RD2kNWCG+Bjo6h+JVjWVNntZs2GtRoeY2xHjts/FNkA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ffb3c9b700e759be2ef13237c9d8f953b32a1e46",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
description = "A retro terminal music player inspired by Winamp";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
version =
|
||||
if self ? shortRev then
|
||||
self.shortRev
|
||||
else if self ? dirtyShortRev then
|
||||
self.dirtyShortRev
|
||||
else
|
||||
"dev";
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
cliamp = pkgs.callPackage ./nix/package.nix { inherit version; };
|
||||
in
|
||||
{
|
||||
inherit cliamp;
|
||||
default = cliamp;
|
||||
}
|
||||
);
|
||||
|
||||
apps = forAllSystems (system: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = nixpkgs.lib.getExe self.packages.${system}.default;
|
||||
meta.description = "Run cliamp";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
alsa-lib,
|
||||
buildGoModule,
|
||||
ffmpeg-headless,
|
||||
flac,
|
||||
lib,
|
||||
libogg,
|
||||
libvorbis,
|
||||
makeWrapper,
|
||||
mpg123,
|
||||
pkg-config,
|
||||
version ? "dev",
|
||||
yt-dlp,
|
||||
}:
|
||||
|
||||
buildGoModule {
|
||||
pname = "cliamp";
|
||||
inherit version;
|
||||
|
||||
src = lib.cleanSource ../.;
|
||||
vendorHash = "sha256-/c2MOMnG8twpr2/9plFanXkJwoIYNwC0mPksTklIcRw=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
alsa-lib
|
||||
flac
|
||||
libogg
|
||||
libvorbis
|
||||
mpg123
|
||||
];
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X=main.version=${version}"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram "$out/bin/cliamp" \
|
||||
--prefix PATH : ${lib.makeBinPath [
|
||||
ffmpeg-headless
|
||||
yt-dlp
|
||||
]}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Retro terminal music player inspired by Winamp";
|
||||
homepage = "https://github.com/bjarneo/cliamp";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "cliamp";
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -682,6 +682,11 @@ footer{border-top:1px solid var(--line);background:var(--ink-2);padding:46px 0 5
|
||||
<code><span class="prompt">$ </span>yay -S cliamp</code>
|
||||
<span class="copied-msg">COPIED</span>
|
||||
</div>
|
||||
<div class="install-box" onclick="copyCmd(this,'nix run github:bjarneo/cliamp')">
|
||||
<div class="install-platform">Nix</div>
|
||||
<code><span class="prompt">$ </span>nix run github:bjarneo/cliamp</code>
|
||||
<span class="copied-msg">COPIED</span>
|
||||
</div>
|
||||
<div class="install-box" onclick="copyCmd(this,'go install github.com/bjarneo/cliamp@latest')">
|
||||
<div class="install-platform">Go</div>
|
||||
<code><span class="prompt">$ </span>go install github.com/bjarneo/cliamp@latest</code>
|
||||
|
||||
Reference in New Issue
Block a user