summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-01-24 14:54:49 +0000
committerMike Vink <mike1994vink@gmail.com>2023-01-24 14:55:23 +0000
commit687c37c3bf1793256bbb979b4283da2b7425020b (patch)
treed17ed26b7e75bedfc4efcbd98ec9d4a7d36adf6c
parent5996523f1c6a9c1c84cd9e90d69a0bcb53ad02f8 (diff)
fix kubeconfig-merge
-rw-r--r--home.nix3
-rw-r--r--shell-scripts.nix20
-rw-r--r--shell-scripts/kubeconfig-merge5
3 files changed, 21 insertions, 7 deletions
diff --git a/home.nix b/home.nix
index f3ff86c..4c90e7c 100644
--- a/home.nix
+++ b/home.nix
@@ -28,6 +28,7 @@
dmenu
stow
(nerdfonts.override {fonts = ["FiraCode"];})
+ subversion
ripgrep
inotify-tools
@@ -42,7 +43,7 @@
(import ./home/st.nix {inherit pkgs;})
]
- ++ (import ./shell-scripts.nix {inherit pkgs;});
+ ++ (import ./shell-scripts.nix {inherit pkgs config;});
programs.direnv = {
enable = true;
diff --git a/shell-scripts.nix b/shell-scripts.nix
index 5cec1eb..32d77d0 100644
--- a/shell-scripts.nix
+++ b/shell-scripts.nix
@@ -1,11 +1,23 @@
-{pkgs, ...}:
+{pkgs, config, ...}:
with builtins; let
script-names = attrNames (readDir ./shell-scripts);
package = (
- filename: let
- contents = readFile ./shell-scripts/${filename};
+ filename: with pkgs; let
in
- pkgs.writeShellScriptBin filename contents
+ stdenv.mkDerivation {
+ name = filename;
+
+ buildCommand = ''
+ install -Dm755 $script $out/bin/${filename}
+ '';
+
+ script = substituteAll {
+ src = ./shell-scripts/${filename};
+ isExecutable = true;
+ inherit bash;
+ home = config.home.homeDirectory;
+ };
+ }
);
packages = map package script-names;
in
diff --git a/shell-scripts/kubeconfig-merge b/shell-scripts/kubeconfig-merge
index 31e09f6..b7d9c37 100644
--- a/shell-scripts/kubeconfig-merge
+++ b/shell-scripts/kubeconfig-merge
@@ -1,2 +1,3 @@
-#!/usr/bin/env sh
-KUBECONFIG=~/.kube/config:${PWD}/$1 kubectl config view --flatten > ~/.kube/config
+#!@bash@/bin/bash
+cp ${HOME}/.kube/config /tmp/.kube_config
+KUBECONFIG=/tmp/.kube_config:$1 kubectl config view --flatten > ${HOME}/.kube/config