Wroclaw
9cd9d8fe3c
adds a package that references nixpkgs config of nixpkgs that created it is retained
21 lines
508 B
Nix
21 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" ]
|
|
'';
|
|
};
|
|
}
|