I would like to define rc-files of my software via Nix. Therefore I define a new package in config.nix
which will contain a config file:
{ pkgs, ... }:
{
packageOverrides = pkgs : with pkgs; {
custom-config = import ./custom-config {
inherit (pkgs) stdenv;
};
};
}
Then in custom-config/default.nix the file is defined inline:
{ stdenv }:
stdenv.mkDerivation rec {
name = "custom-config";
stdenv.mkDerivation {
name = "CustomConfig";
src = builtins.toFile "customrc" ''
# content
'';
};
}
The last part missing is: Add a specific environment variable to the users default shell, like CUSTOM_CONFIG_RC
, which is honored by to relevant program.
Can anybody give me a hint? I am just starting to grasp the language.