]>
Commit | Line | Data |
---|---|---|
27dd65fc IB |
1 | { |
2 | inputs.nixpkgs.url = "github:NixOS/nixpkgs"; | |
3 | ||
4 | description = "Useful libs"; | |
5 | outputs = { self, nixpkgs }: { | |
6 | lib = rec { | |
27dd65fc IB |
7 | withNarKeyCompat = flakeCompat: path: moduleAttrs: |
8 | let module = (flakeCompat path).${moduleAttrs}; | |
bc0f9fcf | 9 | key = builtins.hashString "sha256" (builtins.path { inherit path; name = "source"; }); |
27dd65fc | 10 | in if builtins.isFunction module |
bc0f9fcf IB |
11 | then args@{ config, lib, pkgs, ... }: (module args // { inherit key; }) |
12 | else module // { inherit key; }; | |
27dd65fc IB |
13 | |
14 | withNarKey = dep: moduleAttrs: | |
15 | let module = dep.${moduleAttrs}; | |
bc0f9fcf | 16 | key = builtins.hashString "sha256" (builtins.path { path = dep.sourceInfo.outPath; name = "source"; }); |
27dd65fc | 17 | in if builtins.isFunction module |
bc0f9fcf IB |
18 | then args@{ config, lib, pkgs, ... }: (module args // { inherit key; }) |
19 | else module // { inherit key; }; | |
27dd65fc IB |
20 | }; |
21 | }; | |
22 | } |