commit 042090a95f7f29bb496724464a0e12ce56eab743
parent 137b923f553617d774306d2bb24f090277f01543
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Thu, 6 Aug 2020 01:23:15 +0300
Add openorienteering-mapper module
Diffstat:
2 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/modules/default.nix b/modules/default.nix
@@ -6,6 +6,7 @@
gpxsee = ./home-manager/programs/gpxsee.nix;
josm = ./home-manager/programs/josm.nix;
nnn = ./home-manager/programs/nnn.nix;
+ openorienteering-mapper = ./home-manager/programs/openorienteering-mapper.nix;
qmapshack = ./home-manager/programs/qmapshack.nix;
slack-term = ./home-manager/programs/slack-term.nix;
};
diff --git a/modules/home-manager/programs/openorienteering-mapper.nix b/modules/home-manager/programs/openorienteering-mapper.nix
@@ -0,0 +1,52 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.programs.openorienteering-mapper;
+ configDir = "${config.xdg.configHome}/OpenOrienteering.org";
+ configFile = "${configDir}/Mapper.conf";
+ domain = "org.openorienteering.Mapper";
+in
+{
+ meta.maintainers = [ maintainers.sikmir ];
+
+ options.programs.openorienteering-mapper = {
+ enable = mkEnableOption "An orienteering mapmaking program";
+
+ package = mkOption {
+ default = pkgs.openorienteering-mapper;
+ defaultText = literalExample "pkgs.openorienteering-mapper";
+ example = "pkgs.nur.repos.sikmir.openorienteering-mapper-bin";
+ description = "OpenOrienteering Mapper package to install.";
+ type = types.package;
+ };
+ };
+
+ config = mkIf cfg.enable (
+ mkMerge [
+ {
+ home.packages = [ cfg.package ];
+ }
+
+ (
+ mkIf pkgs.stdenv.isLinux {
+ home.activation.createConfigFile = config.lib.dag.entryAfter [ "writeBoundary" ] ''
+ $DRY_RUN_CMD mkdir -p ${configDir}
+ $DRY_RUN_CMD touch ${configFile}
+ '';
+ }
+ )
+
+ {
+ home.activation.tipsVisible =
+ config.lib.dag.entryAfter [ "writeBoundary" ]
+ (
+ if pkgs.stdenv.isDarwin then
+ "$DRY_RUN_CMD /usr/bin/defaults write ${domain} HomeScreen.tipsVisible -bool false"
+ else
+ "$DRY_RUN_CMD ${pkgs.crudini}/bin/crudini $VERBOSE_ARG --set ${configFile} HomeScreen tipsVisible 0"
+ );
+ }
+ ]
+ );
+}