-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from phaer/phaer/python-improvements
style changes in mach-nix-xs
- Loading branch information
Showing
5 changed files
with
134 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{config, lib, ...}: let | ||
l = lib // builtins; | ||
t = l.types; | ||
|
||
# Attributes we never want to copy from nixpkgs | ||
excludedNixpkgsAttrs = l.genAttrs | ||
[ | ||
"all" | ||
"args" | ||
"builder" | ||
"name" | ||
"pname" | ||
"version" | ||
"src" | ||
"outputs" | ||
] | ||
(name: null); | ||
|
||
extractOverrideAttrs = overrideFunc: | ||
(overrideFunc (old: {passthru.old = old;})) | ||
.old; | ||
|
||
extractPythonAttrs = pythonPackage: let | ||
pythonAttrs = extractOverrideAttrs pythonPackage.overridePythonAttrs; | ||
in | ||
l.filterAttrs (name: _: ! excludedNixpkgsAttrs ? ${name}) pythonAttrs; | ||
|
||
in { | ||
imports = [ | ||
./interface.nix | ||
]; | ||
|
||
config.attrs-from-nixpkgs.lib = { inherit extractOverrideAttrs extractPythonAttrs; }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{config, lib, ...}: let | ||
l = lib // builtins; | ||
t = l.types; | ||
|
||
in { | ||
options.attrs-from-nixpkgs = { | ||
|
||
lib.extractOverrideAttrs = l.mkOption { | ||
type = t.functionTo t.attrs; | ||
description = '' | ||
Helper function to extract attrs from nixpkgs to be re-used as overrides. | ||
''; | ||
readOnly = true; | ||
}; | ||
|
||
# Extracts derivation args from a nixpkgs python package. | ||
lib.extractPythonAttrs = l.mkOption { | ||
type = t.functionTo t.attrs; | ||
description = '' | ||
Helper function to extract python attrs from nixpkgs to be re-used as overrides. | ||
''; | ||
readOnly = true; | ||
}; | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters