From eac170f1bc86a45575fa1a38a6198bac44d4bd10 Mon Sep 17 00:00:00 2001 From: Christian Harke Date: Mon, 16 Oct 2023 21:59:31 +0200 Subject: [PATCH] Add termux-file-editor script --- home/roles/mobile/bin/default.nix | 37 +++++++++++++++++++ .../mobile/bin/scripts/termux-file-editor | 2 + home/roles/mobile/default.nix | 5 ++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 home/roles/mobile/bin/default.nix create mode 100644 home/roles/mobile/bin/scripts/termux-file-editor diff --git a/home/roles/mobile/bin/default.nix b/home/roles/mobile/bin/default.nix new file mode 100644 index 00000000..17e50dd4 --- /dev/null +++ b/home/roles/mobile/bin/default.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + inherit (config.lib.custom) genAttrs'; + + cfg = config.custom.roles.mobile.bin; + + mkUserBinScript = name: + { + name = "bin/${name}"; + value = { + source = ./scripts + "/${name}"; + target = config.home.homeDirectory + "/bin/${name}"; + executable = true; + }; + }; + +in + +{ + options = { + custom.roles.mobile.bin = { + enable = mkEnableOption "Mobile user bin scripts"; + }; + }; + + config = mkIf cfg.enable { + xdg.configFile = genAttrs' + [ + "termux-file-editor" + ] + mkUserBinScript; + }; +} diff --git a/home/roles/mobile/bin/scripts/termux-file-editor b/home/roles/mobile/bin/scripts/termux-file-editor new file mode 100644 index 00000000..48bd5f00 --- /dev/null +++ b/home/roles/mobile/bin/scripts/termux-file-editor @@ -0,0 +1,2 @@ +#!/bin/sh +vim $1 diff --git a/home/roles/mobile/default.nix b/home/roles/mobile/default.nix index 51764c74..50d05be3 100644 --- a/home/roles/mobile/default.nix +++ b/home/roles/mobile/default.nix @@ -34,7 +34,10 @@ in identities = [ logseqSshKey logseqSshPubKey ]; }; - roles.homeage.secrets = [ logseqSshKey logseqSshPubKey ]; + roles = { + homeage.secrets = [ logseqSshKey logseqSshPubKey ]; + mobile.bin.enable = true; + }; }; }; }