refactor: add lib.my for useful functions
This commit is contained in:
parent
8e7a85b21a
commit
567e4eb551
2 changed files with 40 additions and 17 deletions
16
lib/default.nix
Normal file
16
lib/default.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ lib, ... }:
|
||||
|
||||
lib.makeExtensible (self: rec {
|
||||
mkDate = longDate: lib.concatStringsSep "-" [
|
||||
(builtins.substring 0 4 longDate)
|
||||
(builtins.substring 4 2 longDate)
|
||||
(builtins.substring 6 2 longDate)
|
||||
];
|
||||
mkVersionSrc = src: "unstable-" + builtins.substring 0 7 src.rev;
|
||||
mkVersionInput = input:
|
||||
let
|
||||
date = mkDate (input.lastModifiedDate or "19700101");
|
||||
rev = input.shortRev or "dirty";
|
||||
in
|
||||
"unstable-${date}_${rev}}";
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue