diff --git a/lib/default.nix b/lib/default.nix index 1af41db..906bf70 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -56,7 +56,7 @@ in oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { inherit zig2nix; }; oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim { }; oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs { }; - oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go { inherit self;}; + oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go { inherit self lib; }; default = oizys-go; }); devShells = forAllSystems (pkgs: { diff --git a/lib/extended.nix b/lib/extended.nix index 4a064e3..f5d14a6 100644 --- a/lib/extended.nix +++ b/lib/extended.nix @@ -1,12 +1,14 @@ final: prev: let inherit (final) + concatStringsSep hasSuffix mkEnableOption mkIf mkOption types ; + inherit (builtins) listToAttrs substring; in rec { enabled = { @@ -19,7 +21,7 @@ rec { # ["a" "b"] -> {a.enable = true; b.enable = true;} enableAttrs = attrs: - builtins.listToAttrs ( + listToAttrs ( map (attr: { name = attr; value = enabled; @@ -28,7 +30,7 @@ rec { # ["a" "b"] -> {a.enable = false; b.enable = false;} disableAttrs = attrs: - builtins.listToAttrs ( + listToAttrs ( map (attr: { name = attr; value = disabled; @@ -50,4 +52,13 @@ rec { }; config = mkIf config.oizys.${attr}.enable content; }; + + # generate date string with '-' from long date + mkDate = + longDate: + (concatStringsSep "-" [ + (substring 0 4 longDate) + (substring 4 2 longDate) + (substring 6 2 longDate) + ]); } diff --git a/modules/nix.nix b/modules/nix.nix index 36ccc72..e66deb9 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -26,7 +26,6 @@ pkgs.nixfmt-rfc-style pkgs.nix-output-monitor - self.packages.${pkgs.system}.default ]; diff --git a/pkgs/oizys/oizys-go/default.nix b/pkgs/oizys/oizys-go/default.nix index f1123c7..4ae8cdd 100644 --- a/pkgs/oizys/oizys-go/default.nix +++ b/pkgs/oizys/oizys-go/default.nix @@ -8,20 +8,14 @@ nix-output-monitor, ... }: -let -mkDate = - longDate: - (lib.concatStringsSep "-" [ - (builtins.substring 0 4 longDate) - (builtins.substring 4 2 longDate) - (builtins.substring 6 2 longDate) - ]); +let + inherit (lib) mkDate cleanSource makeBinPath; in buildGoModule { pname = "oizys"; - version = "date=${mkDate self.lastModifiedDate}"; + version = "d${mkDate self.lastModifiedDate}"; - src = lib.cleanSource ./.; + src = cleanSource ./.; vendorHash = "sha256-Geqcp0/7I1IF2IfaYyIChz7SOCF+elIEdcz2VsAU0hQ="; nativeBuildInputs = [ @@ -36,6 +30,11 @@ buildGoModule { postFixup = '' wrapProgram $out/bin/oizys \ - --prefix PATH ':' ${lib.makeBinPath [ gh nix-output-monitor ]} + --prefix PATH ':' ${ + makeBinPath [ + gh + nix-output-monitor + ] + } ''; }