mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 09:29:41 +08:00
pistol: deduplicate platform-dependent files
This commit is contained in:
committed by
Austin Horstman
parent
802ce0a7b1
commit
a1a11393d9
@@ -9,6 +9,9 @@ let
|
||||
|
||||
cfg = config.programs.pistol;
|
||||
|
||||
configDir =
|
||||
if pkgs.stdenv.hostPlatform.isDarwin then "Library/Preferences" else config.xdg.configHome;
|
||||
|
||||
configFile = lib.concatStringsSep "\n" (
|
||||
map (
|
||||
{
|
||||
@@ -74,9 +77,7 @@ in
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.all (
|
||||
@@ -90,15 +91,9 @@ in
|
||||
];
|
||||
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
}
|
||||
|
||||
(mkIf (cfg.associations != [ ] && pkgs.stdenv.hostPlatform.isDarwin) {
|
||||
home.file."Library/Preferences/pistol/pistol.conf".text = configFile;
|
||||
})
|
||||
|
||||
(mkIf (cfg.associations != [ ] && !pkgs.stdenv.hostPlatform.isDarwin) {
|
||||
xdg.configFile."pistol/pistol.conf".text = configFile;
|
||||
})
|
||||
]
|
||||
);
|
||||
home.file."${configDir}/pistol/pistol.conf" = mkIf (cfg.associations != [ ]) {
|
||||
text = configFile;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user