nixos-configuration/pkgs/overlays/selfExpr.nix

22 lines
508 B
Nix
Raw Normal View History

{ 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" ]
'';
};
}