mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-08-16 18:00:30 +03:00
rename: generic lock -> dream lock
This commit is contained in:
parent
aa7902a09e
commit
33c7912037
@ -177,7 +177,7 @@ def translate(args):
|
||||
proc = sp.run(
|
||||
[
|
||||
"nix", "build", "--impure", "-L", "--expr",
|
||||
f"(import {dream2nix_src} {{}}).fetchSources {{ genericLock = {output}; }}"
|
||||
f"(import {dream2nix_src} {{}}).fetchSources {{ dreamLock = {output}; }}"
|
||||
],
|
||||
capture_output=True,
|
||||
)
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
{
|
||||
fetchedSources,
|
||||
genericLock,
|
||||
dreamLock,
|
||||
}:
|
||||
|
||||
let
|
||||
python = pkgs."${genericLock.buildSystem.pythonAttr}";
|
||||
python = pkgs."${dreamLock.buildSystem.pythonAttr}";
|
||||
in
|
||||
|
||||
python.pkgs.buildPythonPackage {
|
||||
|
@ -39,16 +39,16 @@ rec {
|
||||
|
||||
|
||||
# automatically find a suitable builder for a given generic lock
|
||||
findBuilder = genericLock:
|
||||
findBuilder = dreamLock:
|
||||
let
|
||||
buildSystem = genericLock.generic.buildSystem;
|
||||
buildSystem = dreamLock.generic.buildSystem;
|
||||
in
|
||||
builders."${buildSystem}".default;
|
||||
|
||||
|
||||
# detect if granular or combined fetching must be used
|
||||
findFetcher = genericLock:
|
||||
if null != genericLock.generic.sourcesCombinedHash then
|
||||
findFetcher = dreamLock:
|
||||
if null != dreamLock.generic.sourcesCombinedHash then
|
||||
fetchers.combinedFetcher
|
||||
else
|
||||
fetchers.defaultFetcher;
|
||||
@ -63,17 +63,17 @@ rec {
|
||||
|
||||
fetchSources =
|
||||
{
|
||||
genericLock,
|
||||
builder ? findBuilder (parseLock genericLock),
|
||||
fetcher ? findFetcher (parseLock genericLock),
|
||||
dreamLock,
|
||||
builder ? findBuilder (parseLock dreamLock),
|
||||
fetcher ? findFetcher (parseLock dreamLock),
|
||||
sourceOverrides ? oldSources: {},
|
||||
}:
|
||||
let
|
||||
# if generic lock is a file, read and parse it
|
||||
genericLock' = (parseLock genericLock);
|
||||
dreamLock' = (parseLock dreamLock);
|
||||
fetched = fetcher {
|
||||
sources = genericLock'.sources;
|
||||
sourcesCombinedHash = genericLock'.generic.sourcesCombinedHash;
|
||||
sources = dreamLock'.sources;
|
||||
sourcesCombinedHash = dreamLock'.generic.sourcesCombinedHash;
|
||||
};
|
||||
sourcesToReplace = sourceOverrides fetched.fetchedSources;
|
||||
sourcesOverridden = lib.mapAttrs (pname: source:
|
||||
@ -101,17 +101,17 @@ rec {
|
||||
# automatically build package defined by generic lock
|
||||
buildPackage =
|
||||
{
|
||||
genericLock,
|
||||
builder ? findBuilder (parseLock genericLock),
|
||||
fetcher ? findFetcher (parseLock genericLock),
|
||||
dreamLock,
|
||||
builder ? findBuilder (parseLock dreamLock),
|
||||
fetcher ? findFetcher (parseLock dreamLock),
|
||||
sourceOverrides ? oldSources: {},
|
||||
}@args:
|
||||
let
|
||||
# if generic lock is a file, read and parse it
|
||||
genericLock' = (parseLock genericLock);
|
||||
dreamLock' = (parseLock dreamLock);
|
||||
in
|
||||
builder {
|
||||
genericLock = genericLock';
|
||||
dreamLock = dreamLock';
|
||||
fetchedSources = (fetchSources args).fetchedSources;
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,7 @@ def main():
|
||||
)
|
||||
|
||||
# create generic lock
|
||||
generic_lock = dict(
|
||||
dream_lock = dict(
|
||||
sources={},
|
||||
generic={
|
||||
"buildSystem": "python",
|
||||
@ -68,7 +68,7 @@ def main():
|
||||
|
||||
# populate sources of generic lock
|
||||
for pname, data in packages.items():
|
||||
generic_lock['sources'][pname] = dict(
|
||||
dream_lock['sources'][pname] = dict(
|
||||
url=data['url'],
|
||||
hash=data['sha256'],
|
||||
type='fetchurl',
|
||||
@ -77,7 +77,7 @@ def main():
|
||||
# dump generic lock to stdout (json)
|
||||
print(jsonInput['outputFile'])
|
||||
with open(jsonInput['outputFile'], 'w') as lock:
|
||||
json.dump(generic_lock, lock, indent=2)
|
||||
json.dump(dream_lock, lock, indent=2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user