mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
nushell: use formats.toml to generate configuration
This commit is contained in:
parent
a4e146693e
commit
19c7d4e29f
1 changed files with 4 additions and 12 deletions
|
@ -6,16 +6,7 @@ let
|
|||
|
||||
cfg = config.programs.nushell;
|
||||
|
||||
configFile = config:
|
||||
pkgs.runCommand "config.toml" {
|
||||
buildInputs = [ pkgs.remarshal ];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
} ''
|
||||
remarshal -if json -of toml \
|
||||
< ${pkgs.writeText "config.json" (builtins.toJSON config)} \
|
||||
> $out
|
||||
'';
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.Philipp-M ];
|
||||
|
@ -62,7 +53,8 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."nu/config.toml" =
|
||||
mkIf (cfg.settings != { }) { source = configFile cfg.settings; };
|
||||
xdg.configFile."nu/config.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "nushell-config" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue