pkgs/overlay: create selfExpr
adds a package that references nixpkgs config of nixpkgs that created it is retained
This commit is contained in:
parent
88f348a2c9
commit
9cd9d8fe3c
1 changed files with 21 additions and 0 deletions
21
pkgs/overlays/selfExpr.nix
Normal file
21
pkgs/overlays/selfExpr.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ 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" ]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue