feat: add lib infrastructure and test it with version check

This commit is contained in:
Malte Tammena 2024-03-10 21:15:13 +01:00
parent 121e07c127
commit 528814ac52
3 changed files with 7 additions and 2 deletions

View file

@ -181,6 +181,8 @@
};
in
builtins.listToAttrs (builtins.map genSystem listOfHosts);
# Additional library functions
flake.lib = (builtins.import ./lib) {inherit (inputs.nixpkgs) lib;};
# Iso for USB
flake.packages.x86_64-linux.iso = inputs.self.nixosConfigurations.radix-balthica.config.system.build.isoImage;
# VM for testing

View file

@ -1,6 +1,6 @@
{
pkgs,
lib,
inputs,
...
}: {
imports = [
@ -27,7 +27,7 @@
'';
services.xserver.desktopManager.kodi.package = let
youtubePlugin = pkgs.kodiPackages.youtube.overrideAttrs (old: rec {
version = lib.throwIf (lib.versionOlder hashes.youtubePlugin.version old.version) "Youtube Plugin override outdated" hashes.youtubePlugin.version;
version = inputs.self.lib.versionIfNewer hashes.youtubePlugin.version old.version "Youtube Plugin override outdated";
src = pkgs.fetchFromGitHub {
inherit (hashes.youtubePlugin) hash;

3
lib/default.nix Normal file
View file

@ -0,0 +1,3 @@
{lib, ...}: {
versionIfNewer = newVersion: oldVersion: message: lib.throwIf (lib.versionOlder newVersion oldVersion) message newVersion;
}