treewide: switch to npins

This commit is contained in:
raf 2023-11-03 12:27:04 +03:00
parent 0eef5abf3f
commit 65f49835f6
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
7 changed files with 193 additions and 76 deletions

47
npins/default.nix Normal file
View file

@ -0,0 +1,47 @@
# Generated by npins. Do not modify; will be overwritten regularly
let
data = builtins.fromJSON (builtins.readFile ./sources.json);
version = data.version;
mkSource = spec:
assert spec ? type; let
path =
if spec.type == "Git" then mkGitSource spec
else if spec.type == "GitRelease" then mkGitSource spec
else if spec.type == "PyPi" then mkPyPiSource spec
else if spec.type == "Channel" then mkChannelSource spec
else builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = path; };
mkGitSource = { repository, revision, url ? null, hash, ... }:
assert repository ? type;
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball
if url != null then
(builtins.fetchTarball {
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
})
else assert repository.type == "Git"; builtins.fetchGit {
url = repository.url;
rev = revision;
# hash = hash;
};
mkPyPiSource = { url, hash, ... }:
builtins.fetchurl {
inherit url;
sha256 = hash;
};
mkChannelSource = { url, hash, ... }:
builtins.fetchTarball {
inherit url;
sha256 = hash;
};
in
if version == 3 then
builtins.mapAttrs (_: mkSource) data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"

53
npins/sources.json Normal file
View file

@ -0,0 +1,53 @@
{
"pins": {
"ani-cli": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "pystardust",
"repo": "ani-cli"
},
"pre_releases": false,
"version_upper_bound": null,
"version": "v4.6",
"revision": "c7e6838647b57411d791bd250417eb0925d74cca",
"url": "https://api.github.com/repos/pystardust/ani-cli/tarball/v4.6",
"hash": "1ni9pzjb5qh87iz7c8252bx79qadr1qx6jnkqvvjcqrchh7q473a"
},
"cloneit": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "alok8bb",
"repo": "cloneit"
},
"pre_releases": false,
"version_upper_bound": null,
"version": "0.1.0",
"revision": "44402e101b18be0764ddb0b49bf0393e2e83c9c3",
"url": "https://api.github.com/repos/alok8bb/cloneit/tarball/0.1.0",
"hash": "18z4vxrfvyp20kig2s9k5y3034nw39wkj8zzk9qskiisv2ypy90b"
},
"mov-cli": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "mov-cli",
"repo": "mov-cli"
},
"pre_releases": false,
"version_upper_bound": null,
"version": "1.5.4",
"revision": "5f0ec5a69d37b286966d39b6596b3b76d5302387",
"url": "https://api.github.com/repos/mov-cli/mov-cli/tarball/1.5.4",
"hash": "0n6k9vyq21r88x5zgidaafjlhia20dx0psdpys7dyfr8azh0y6js"
},
"nixpkgs": {
"type": "Channel",
"name": "nixpkgs-unstable",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-23.11pre543441.b644d97bda6d/nixexprs.tar.xz",
"hash": "1xq7rz2bcb115xkahpvslsqpliisv2587z93izz81lna77r4na1d"
}
},
"version": 3
}

4
pkgs/ani-cli/README.md Normal file
View file

@ -0,0 +1,4 @@
# ani-cli
ani-cli is already in nixpkgs. The sole reason it's been put in this overlay is so that
I can receive the updates _as they happen_ and not wait until a maintainer bumps it up.

View file

@ -9,33 +9,35 @@
fzf,
mpv,
aria2,
}:
stdenvNoCC.mkDerivation rec {
pname = "ani-cli";
version = "4.6";
pins,
}: let
pin = pins.ani-cli;
in
stdenvNoCC.mkDerivation {
pname = "ani-cli";
inherit (pin) version;
src = fetchFromGitHub {
owner = "pystardust";
repo = "${pname}";
rev = "v${version}";
hash = "sha256-ahyCD4QsYyb3xtNK03HITeF0+hJFIHZ+PAjisuS/Kdo=";
};
src = fetchFromGitHub {
inherit (pin.repository) owner repo;
sha256 = pin.hash;
rev = pin.revision;
};
nativeBuildInputs = [makeWrapper];
nativeBuildInputs = [makeWrapper];
installPhase = ''
runHook preInstall
install -Dm755 ani-cli $out/bin/ani-cli
wrapProgram $out/bin/ani-cli \
--prefix PATH : ${lib.makeBinPath [gnugrep gnused wget fzf mpv aria2]}
runHook postInstall
'';
installPhase = ''
runHook preInstall
install -Dm755 ani-cli $out/bin/ani-cli
wrapProgram $out/bin/ani-cli \
--prefix PATH : ${lib.makeBinPath [gnugrep gnused wget fzf mpv aria2]}
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/pystardust/ani-cli";
description = "A cli tool to browse and play anime";
license = licenses.gpl3Plus;
maintainers = with maintainers; [skykanin];
platforms = platforms.unix;
};
}
meta = with lib; {
homepage = "https://github.com/pystardust/ani-cli";
description = "A cli tool to browse and play anime";
license = licenses.gpl3Plus;
maintainers = with maintainers; [NotAShelf];
platforms = platforms.unix;
};
}

View file

@ -18,13 +18,22 @@
config.allowUnfree = true;
};
packages = {
ani-cli = pkgs.callPackage ./ani-cli {};
rat = pkgs.callPackage ./rat {};
mov-cli = pkgs.callPackage ./mov-cli {};
reposilite-bin = pkgs.callPackage ./reposilite-bin {};
cloneit = pkgs.callPackage ./cloneit {};
packages = let
pins = import ../npins;
mkPackage = path: {__functor = self: self.override;} // (pkgs.callPackage path {inherit pins;});
in {
# packages that follow npins entries
# they can be updated via npins
ani-cli = mkPackage ./ani-cli;
rat = mkPackage ./rat;
mov-cli = mkPackage ./mov-cli;
# static packages
# need manual intervention with each update
cloneit = pkgs.callPackage ./cloneit {};
reposilite-bin = pkgs.callPackage ./reposilite-bin {};
# patched packages
foot-transparent = pkgs.foot.overrideAttrs (old: {
patches =
(old.patches or [])

View file

@ -1,53 +1,54 @@
{
lib,
pkgs,
python3Packages,
fetchFromGitHub,
fetchPypi,
}:
python3Packages.buildPythonPackage rec {
pname = "mov-cli";
version = "1.5.1";
format = "pyproject";
pins,
}: let
pin = pins.mov-cli;
in
python3Packages.buildPythonPackage {
format = "pyproject";
pname = "mov-cli";
inherit (pin) version;
src = fetchFromGitHub {
owner = "mov-cli";
repo = "mov-cli";
rev = "${version}";
hash = "sha256-ixv9guHfXy1kQbpAWAVwPtpxX5IwAQ8CQ2hvhM7sewg=";
};
src = fetchFromGitHub {
inherit (pin.repository) owner repo;
sha256 = pin.hash;
rev = pin.revision;
};
propagatedBuildInputs = with python3Packages; [
poetry-core
pycryptodome
lxml
six
beautifulsoup4
tldextract
(python3Packages.httpx.overrideAttrs (_old: {
src = fetchFromGitHub {
owner = "encode";
repo = "httpx";
rev = "refs/tags/0.24.0";
hash = "sha256-eLCqmYKfBZXCQvFFh5kGoO91rtsvjbydZhPNtjL3Zaw=";
};
}))
(
python3Packages.buildPythonPackage rec {
pname = "krfzf_py";
version = "0.0.4";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-W0wpR1/HRrtYC3vqEwh+Jwkgwnfa49LCFIArOXaSPCE=";
propagatedBuildInputs = with python3Packages; [
poetry-core
pycryptodome
lxml
six
beautifulsoup4
tldextract
(python3Packages.httpx.overrideAttrs (_old: {
src = fetchFromGitHub {
owner = "encode";
repo = "httpx";
rev = "refs/tags/0.24.0";
hash = "sha256-eLCqmYKfBZXCQvFFh5kGoO91rtsvjbydZhPNtjL3Zaw=";
};
}
)
];
}))
(
python3Packages.buildPythonPackage rec {
pname = "krfzf_py";
version = "0.0.4";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-W0wpR1/HRrtYC3vqEwh+Jwkgwnfa49LCFIArOXaSPCE=";
};
}
)
];
meta = with lib; {
homepage = "https://github.com/mov-cli/mov-cli";
description = "A cli tool to browse and watch movies";
license = licenses.gpl3Only;
mainProgram = "mov-cli";
};
}
meta = with lib; {
homepage = "https://github.com/mov-cli/mov-cli";
description = "A cli tool to browse and watch movies";
license = licenses.gpl3Only;
mainProgram = "mov-cli";
};
}

View file

@ -5,6 +5,7 @@
makeWrapper,
pkgs,
lib,
pins,
}:
stdenv.mkDerivation rec {
pname = "rat";