22 lines
508 B
Nix
22 lines
508 B
Nix
|
{ nixpkgsPath ? <nixpkgs> }:
|
||
|
|
||
|
self: super: {
|
||
|
selfExpr = let
|
||
|
config = builtins.removeAttrs self.config [ "_undeclared" ];
|
||
|
configJson = builtins.toJSON config;
|
||
|
in
|
||
|
self.writeTextFile {
|
||
|
name = "nixpkgs-self";
|
||
|
destination = "/default.nix";
|
||
|
text = ''
|
||
|
{ ... } @ args:
|
||
|
|
||
|
import ${builtins.toString nixpkgsPath} {
|
||
|
config = (builtins.fromJSON '''
|
||
|
${configJson}
|
||
|
''') // args.config or {};
|
||
|
} // builtins.removeAttrs args [ "config" ]
|
||
|
'';
|
||
|
};
|
||
|
}
|