refactor(pkgs): improve versioning
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-06-13 22:27:54 -04:00
parent 927a3fbfb1
commit d17a69372a
29 changed files with 165 additions and 112 deletions

View file

@ -1,7 +1,9 @@
{pkgs, ...} @ inputs: let {
trash = pkgs.callPackage ./trash-d.nix inputs; pkgs,
in { self,
home.packages = [trash]; ...
}: {
home.packages = [self.packages.${pkgs.system}.trash-d];
programs.bash.shellAliases.rm = "trash"; programs.bash.shellAliases.rm = "trash";
} }

View file

@ -1,31 +0,0 @@
{
trash-d-src,
stdenv,
dmd,
dub,
ronn,
...
}:
stdenv.mkDerivation {
name = "trash";
version = trash-d-src.shortRev;
src = trash-d-src;
buildInputs = [dub dmd ronn];
buildPhase = ''
# https://github.com/svanderburg/node2nix/issues/217#issuecomment-751311272
export HOME=$(mktemp -d)
dub build
'';
installPhase = ''
mkdir -p $out/bin $out/man/man1
cp -a ./build/trash $out/bin/
ronn --roff --pipe MANUAL.md > $out/man/man1/trash.1
'';
}

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "codeberg.org/forgejo/forgejo"; imageName = "codeberg.org/forgejo/forgejo";
imageDigest = "sha256:7918c661718554aefb5901f2c6336b12a1bed427f2b080ee732ca6cd0324f8fd"; imageDigest = "sha256:fd0411ca373739a6513d82887ab44915f5732adbc5c21dfa1e01d4f4779f7e09";
sha256 = "0rvncgami6p777qrlnblyxkjyjabk6npgjzq3isxw77gffvxvj9y"; sha256 = "0jimix4rq7ic56b1dy61jlv3k7wmc25pjdgv7blhjg81zis21ylc";
finalImageName = "codeberg.org/forgejo/forgejo"; finalImageName = "codeberg.org/forgejo/forgejo";
finalImageTag = "7.0.3"; finalImageTag = "7.0.4";
} }

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "postgres"; imageName = "postgres";
imageDigest = "sha256:da8b991e3909fc95a272fcbeb1e0d79ce1a7028fe1549b1ba0ed0a6a45e126cb"; imageDigest = "sha256:92e5719074c63b2d30bc8eff29c7f18785a5a5cef01a87dc9e725080747fc57b";
sha256 = "1mkskwa4s7j86qj42b7sgdjp9s3c838i3i5lmba0l69pdmgygs3m"; sha256 = "10ld7pda7svs35939lmch0shc1rjdmrsksiv247656m67yyp1g3j";
finalImageName = "postgres"; finalImageName = "postgres";
finalImageTag = "14"; finalImageTag = "14";
} }

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "postgres"; imageName = "postgres";
imageDigest = "sha256:da8b991e3909fc95a272fcbeb1e0d79ce1a7028fe1549b1ba0ed0a6a45e126cb"; imageDigest = "sha256:92e5719074c63b2d30bc8eff29c7f18785a5a5cef01a87dc9e725080747fc57b";
sha256 = "1mkskwa4s7j86qj42b7sgdjp9s3c838i3i5lmba0l69pdmgygs3m"; sha256 = "10ld7pda7svs35939lmch0shc1rjdmrsksiv247656m67yyp1g3j";
finalImageName = "postgres"; finalImageName = "postgres";
finalImageTag = "14"; finalImageTag = "14";
} }

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "rssbridge/rss-bridge"; imageName = "rssbridge/rss-bridge";
imageDigest = "sha256:f64dc2fa2c81c0930a447cd937e965d7bb6443c4f09883375f60c28ddb7d1883"; imageDigest = "sha256:e1040b00324d3b3e660beefe91f21d8fd632fb338a11150ae9ec482b9bcd33fe";
sha256 = "0shdpj2whs0a8k4537a7gpdsf1v7iwbh8hvcj3vz25wfm4dvrg79"; sha256 = "1ffwzrmxhlhhm4vgypv24j716l1wyr6nn4iz2icc1g2a0ywzi0bi";
finalImageName = "rssbridge/rss-bridge"; finalImageName = "rssbridge/rss-bridge";
finalImageTag = "latest"; finalImageTag = "latest";
} }

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "ghcr.io/immich-app/immich-machine-learning"; imageName = "ghcr.io/immich-app/immich-machine-learning";
imageDigest = "sha256:ea112b507c71c32815f1c02782e20a2f5e8dc42d3ea1177b4fed4f25fce4c9d5"; imageDigest = "sha256:9db20e5c2033bef01fa2be50fa0a2c3d62e43f069aedde4d49a65e65a436d40b";
sha256 = "05xl2gakjxi60y3b4vgzxmrsrxix9hp12pc2yjsrmq2i93dhypsk"; sha256 = "01cchdlp322nbw0rs6akcx569wbqf1lydwvq6zw9lpwkhrsyrrvx";
finalImageName = "ghcr.io/immich-app/immich-machine-learning"; finalImageName = "ghcr.io/immich-app/immich-machine-learning";
finalImageTag = "v1.106.3"; finalImageTag = "v1.106.4";
} }

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "ghcr.io/immich-app/immich-server"; imageName = "ghcr.io/immich-app/immich-server";
imageDigest = "sha256:80b9e59c55869ec3f4cfa204ce1ad096356252b834b5cc2b6421dff69aaa2e8a"; imageDigest = "sha256:d39cb7ecbcc9924f2c51a3e0deb8a469075996c6ba9e1384eb2ddb550984848e";
sha256 = "0k7qwk02r92kq852j4zw8i4kjczldpkkcw5iqmn0dk3r1zzy9n2y"; sha256 = "0ynfw50bga8av98mbnnznm9ih3lar9xim7njby8vwbs455iiz6g4";
finalImageName = "ghcr.io/immich-app/immich-server"; finalImageName = "ghcr.io/immich-app/immich-server";
finalImageTag = "v1.106.3"; finalImageTag = "v1.106.4";
} }

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "ghcr.io/fallenbagel/jellyseerr"; imageName = "ghcr.io/fallenbagel/jellyseerr";
imageDigest = "sha256:e82b4c83bd453916c38ba7a9df8e7d324d4b696998ac815ed58c93b94b09adc0"; imageDigest = "sha256:e14379fc17d16e902c3d9234425e0da5e4926d3fe1eeb0f1cb4538f4b0618490";
sha256 = "0vk8vyqcaplbwp7xm94g91vspbfiwq4k3pp0n1h5jq33qjks1svb"; sha256 = "1apma6asq7pbka2n7jfxry6qy1bf43lnkwly5s3d93zvq7y1r4wm";
finalImageName = "ghcr.io/fallenbagel/jellyseerr"; finalImageName = "ghcr.io/fallenbagel/jellyseerr";
finalImageTag = "develop"; finalImageTag = "develop";
} }

View file

@ -1,7 +1,7 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "nextcloud"; imageName = "nextcloud";
imageDigest = "sha256:40a5a898dfbb37a907321b37dfe05f36e6f0f693c9bbbbe420af22906e975a74"; imageDigest = "sha256:0bb498026da9fee4c7c703a9ed682aa2aee825a82946c6944a872cbedb44a272";
sha256 = "1ahpz4a1pdbg7554ydqzfagra32snd6pc7dv1afq5pwyd03cllr4"; sha256 = "1ahpz4a1pdbg7554ydqzfagra32snd6pc7dv1afq5pwyd03cllr4";
finalImageName = "nextcloud"; finalImageName = "nextcloud";
finalImageTag = "29.0.1-fpm"; finalImageTag = "29.0.1-fpm";

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "nginx"; imageName = "nginx";
imageDigest = "sha256:0f04e4f646a3f14bf31d8bc8d885b6c951fdcf42589d06845f64d18aec6a3c4d"; imageDigest = "sha256:0acaab7c2237e052dc5adf1694ebce0b374063a62b2a1b7f2b3bc9cd3fb8c1ff";
sha256 = "159z86nw6riirs9ix4zix7qawhfngl5fkx7ypmi6ib0sfayc8pw2"; sha256 = "099ivwfqsb1d8svj1kxy2bnvr8zwf4sgw4816dkghsb4jqnij270";
finalImageName = "nginx"; finalImageName = "nginx";
finalImageTag = "latest"; finalImageTag = "latest";
} }

View file

@ -11,7 +11,7 @@
gen = import ./vuetorrent.nix; gen = import ./vuetorrent.nix;
in in
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {
name = "vuetorrent"; pname = "vuetorrent";
inherit (gen) version; inherit (gen) version;
nativeBuildInputs = [pkgs.unzip]; nativeBuildInputs = [pkgs.unzip];

View file

@ -42,7 +42,7 @@
secrets, secrets,
... ...
}: let }: let
inherit (import ./lib.nix inputs) mkNixOS mkNixOnDroid mkPkgs; inherit (import ./lib.nix inputs) mkVersion mkNixOS mkNixOnDroid mkPkgs;
supportedSystems = ["x86_64-linux" "aarch64-linux"]; supportedSystems = ["x86_64-linux" "aarch64-linux"];
@ -98,12 +98,12 @@
legacyPackages = perSystem (system: pkgs: { legacyPackages = perSystem (system: pkgs: {
dracula = dracula =
pkgs.lib.recurseIntoAttrs pkgs.lib.recurseIntoAttrs
(pkgs.callPackage ./pkgs/dracula ({} // inputs)); (pkgs.callPackage ./pkgs/dracula ({inherit mkVersion;} // inputs));
}); });
packages = packages =
perSystem (system: pkgs: perSystem (system: pkgs:
import ./pkgs ({inherit self system pkgs;} // inputs)); import ./pkgs ({inherit self system pkgs mkVersion;} // inputs));
devShells = perSystem (_: pkgs: { devShells = perSystem (_: pkgs: {
default = pkgs.mkShell { default = pkgs.mkShell {

Binary file not shown.

View file

@ -6,6 +6,8 @@
nixpkgs-wayland, nixpkgs-wayland,
... ...
} @ inputs: rec { } @ inputs: rec {
mkVersion = src: "0pre+" + src.shortRev;
# Import pkgs from a nixpkgs # Import pkgs from a nixpkgs
mkPkgs = system: input: mkPkgs = system: input:
import input { import input {

View file

@ -3,19 +3,23 @@
pkgs, pkgs,
piper-src, piper-src,
... ...
}: { } @ inputs: let
inherit (import ../lib.nix inputs) mkVersion;
in {
services.ratbagd = { services.ratbagd = {
enable = true; enable = true;
package = pkgs.libratbag.overrideAttrs { package = pkgs.libratbag.overrideAttrs {
version = libratbag-src.shortRev; pname = "libratbag";
version = mkVersion libratbag-src;
src = libratbag-src; src = libratbag-src;
}; };
}; };
environment.systemPackages = [ environment.systemPackages = [
(pkgs.piper.overrideAttrs { (pkgs.piper.overrideAttrs {
name = "piper-${piper-src.shortRev}"; pname = "piper";
version = mkVersion piper-src;
src = piper-src; src = piper-src;
mesonFlags = [ mesonFlags = [

View file

@ -1,11 +1,12 @@
{ {
buildGoModule, buildGoModule,
curseforge-server-downloader-src, curseforge-server-downloader-src,
mkVersion,
... ...
}: }:
buildGoModule { buildGoModule {
pname = "curseforge-server-downloader"; pname = "curseforge-server-downloader";
version = "unstable"; version = mkVersion curseforge-server-downloader-src;
src = curseforge-server-downloader-src; src = curseforge-server-downloader-src;
doCheck = false; doCheck = false;

View file

@ -1,28 +1,31 @@
{ {
pkgs, pkgs,
curseforge-server-downloader-src, mkVersion,
gpu-screen-recorder-src,
pam-fprint-grosshack-src,
pokemon-colorscripts-src,
... ...
} @ inputs: { } @ inputs: {
coloryou = pkgs.callPackage ./coloryou {}; coloryou = pkgs.callPackage ./coloryou {};
curseforge-server-downloader = pkgs.callPackage ./curseforge-server-downloader { curseforge-server-downloader = pkgs.callPackage ./curseforge-server-downloader {
inherit curseforge-server-downloader-src; inherit (inputs) curseforge-server-downloader-src;
inherit mkVersion;
}; };
gpu-screen-recorder = pkgs.callPackage ./gpu-screen-recorder { gpu-screen-recorder = pkgs.callPackage ./gpu-screen-recorder {
inherit gpu-screen-recorder-src; inherit (inputs) gpu-screen-recorder-src;
}; };
pam-fprint-grosshack = pkgs.callPackage ./pam-fprint-grosshack { pam-fprint-grosshack = pkgs.callPackage ./pam-fprint-grosshack {
inherit pam-fprint-grosshack-src; inherit (inputs) pam-fprint-grosshack-src;
}; };
pokemon-colorscripts = pkgs.callPackage ./pokemon-colorscripts { pokemon-colorscripts = pkgs.callPackage ./pokemon-colorscripts {
inherit pokemon-colorscripts-src; inherit (inputs) pokemon-colorscripts-src;
inherit mkVersion;
}; };
repl = pkgs.callPackage ./repl {}; repl = pkgs.callPackage ./repl {};
trash-d = pkgs.callPackage ./trash-d {
inherit (inputs) trash-d-src;
};
} }

View file

@ -1,11 +1,12 @@
{ {
bat-theme-src, bat-theme-src,
mkVersion,
stdenv, stdenv,
... ...
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "dracula-bat"; pname = "dracula-bat";
version = bat-theme-src.shortRev; version = mkVersion bat-theme-src;
src = bat-theme-src; src = bat-theme-src;

View file

@ -1,9 +1,22 @@
{pkgs, ...} @ inputs: {pkgs, ...} @ inputs:
pkgs.lib.makeScope pkgs.newScope (drac: { pkgs.lib.makeScope pkgs.newScope (drac: {
bat = drac.callPackage ./bat.nix {inherit (inputs) bat-theme-src;}; bat = drac.callPackage ./bat.nix {
git = drac.callPackage ./git.nix {inherit (inputs) git-theme-src;}; inherit (inputs) bat-theme-src mkVersion;
};
git = drac.callPackage ./git.nix {
inherit (inputs) git-theme-src mkVersion;
};
gtk = import ./gtk.nix {inherit (inputs) gtk-theme-src pkgs;}; gtk = import ./gtk.nix {inherit (inputs) gtk-theme-src pkgs;};
plymouth = drac.callPackage ./plymouth.nix {inherit (inputs) dracula-plymouth-src;};
sioyek = drac.callPackage ./sioyek.nix {inherit (inputs) sioyek-theme-src;}; plymouth = drac.callPackage ./plymouth.nix {
wallpaper = pkgs.fetchurl (import ./wallpaper.nix); inherit (inputs) dracula-plymouth-src mkVersion;
};
sioyek = drac.callPackage ./sioyek.nix {
inherit (inputs) sioyek-theme-src mkVersion;
};
wallpaper = drac.callPackage ./wallpaper.nix {};
}) })

View file

@ -1,11 +1,12 @@
{ {
stdenv, stdenv,
git-theme-src, git-theme-src,
mkVersion,
... ...
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "dracula-git"; pname = "dracula-git";
version = git-theme-src.shortRev; version = mkVersion git-theme-src;
src = git-theme-src; src = git-theme-src;

View file

@ -3,7 +3,7 @@
pkgs, pkgs,
... ...
}: }:
pkgs.dracula-theme.overrideAttrs { pkgs.dracula-theme.overrideAttrs (o: {
version = gtk-theme-src.shortRev; version = o.version + "+" + gtk-theme-src.shortRev;
src = gtk-theme-src; src = gtk-theme-src;
} })

View file

@ -1,11 +1,12 @@
{ {
stdenv, stdenv,
dracula-plymouth-src, dracula-plymouth-src,
mkVersion,
... ...
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "dracula-plymouth"; pname = "dracula-plymouth";
version = dracula-plymouth-src.shortRev; version = mkVersion dracula-plymouth-src;
src = dracula-plymouth-src; src = dracula-plymouth-src;

View file

@ -1,11 +1,12 @@
{ {
mkVersion,
sioyek-theme-src, sioyek-theme-src,
stdenv, stdenv,
... ...
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "dracula-sioyek"; pname = "dracula-sioyek";
version = sioyek-theme-src.shortRev; version = mkVersion sioyek-theme-src;
src = sioyek-theme-src; src = sioyek-theme-src;

View file

@ -1,4 +1,20 @@
{ {
fetchurl,
stdenv,
...
}:
stdenv.mkDerivation {
pname = "dracula-wallpaper";
version = "";
src = fetchurl {
url = "https://raw.githubusercontent.com/aynp/dracula-wallpapers/main/Art/4k/Waves%201.png"; url = "https://raw.githubusercontent.com/aynp/dracula-wallpapers/main/Art/4k/Waves%201.png";
hash = "sha256-f9FwSOSvqTeDj4bOjYUQ6TM+/carCD9o5dhg/MnP/lk="; hash = "sha256-f9FwSOSvqTeDj4bOjYUQ6TM+/carCD9o5dhg/MnP/lk=";
};
phases = ["installPhase"];
installPhase = ''
cp $src $out
'';
} }

View file

@ -25,7 +25,7 @@
.version; .version;
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "gpu-screen-recorder"; pname = "gpu-screen-recorder";
version = "${tag}+${gpu-screen-recorder-src.shortRev}"; version = "${tag}+${gpu-screen-recorder-src.shortRev}";
src = gpu-screen-recorder-src; src = gpu-screen-recorder-src;

View file

@ -12,10 +12,13 @@
libpam-wrapper, libpam-wrapper,
pam-fprint-grosshack-src, pam-fprint-grosshack-src,
... ...
}: }: let
inherit (builtins) elemAt head readFile split;
tag = head (split "'" (elemAt (split " version: '" (readFile "${pam-fprint-grosshack-src}/meson.build")) 2));
in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "pam-fprint-grosshack"; pname = "pam-fprint-grosshack";
version = pam-fprint-grosshack-src.shortRev; version = "${tag}+${pam-fprint-grosshack-src.shortRev}";
src = pam-fprint-grosshack-src; src = pam-fprint-grosshack-src;

View file

@ -1,12 +1,13 @@
{ {
mkVersion,
stdenv, stdenv,
python3Packages, python3Packages,
pokemon-colorscripts-src, pokemon-colorscripts-src,
... ...
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "pokemon-colorscripts"; pname = "pokemon-colorscripts";
version = pokemon-colorscripts-src.shortRev; version = mkVersion pokemon-colorscripts-src;
src = pokemon-colorscripts-src; src = pokemon-colorscripts-src;

35
pkgs/trash-d/default.nix Normal file
View file

@ -0,0 +1,35 @@
{
dmd,
dub,
trash-d-src,
ronn,
stdenv,
...
}: let
inherit (builtins) fromJSON readFile;
tag = (fromJSON (readFile "${trash-d-src}/dub.json")).version;
in
stdenv.mkDerivation {
pname = "trash";
version = "${tag}+${trash-d-src.shortRev}";
src = trash-d-src;
buildInputs = [dub dmd ronn];
buildPhase = ''
# https://github.com/svanderburg/node2nix/issues/217#issuecomment-751311272
export HOME=$(mktemp -d)
dub build
'';
installPhase = ''
mkdir -p $out/bin $out/man/man1
cp -a ./build/trash $out/bin/
ronn --roff --pipe MANUAL.md > $out/man/man1/trash.1
'';
}