aboutsummaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-10-31 15:55:40 +0100
committerKarel Kočí <cynerd@email.cz>2022-10-31 15:59:16 +0100
commitc5a4325596fbb71e75f4f945db5ab70881b43357 (patch)
tree7c4a7c1caad0ef6b5457179978eec47d383a69f0 /pkgs
parentbd45b922601eeb7b5d15f9e51ed7e855a690a281 (diff)
downloadnixos-personal-c5a4325596fbb71e75f4f945db5ab70881b43357.tar.gz
nixos-personal-c5a4325596fbb71e75f4f945db5ab70881b43357.tar.bz2
nixos-personal-c5a4325596fbb71e75f4f945db5ab70881b43357.zip
pkgs: add dev
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/default.nix3
-rw-r--r--pkgs/dev/default.nix29
-rwxr-xr-xpkgs/dev/dev.sh15
3 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 7c1350b..d2d7828 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -6,6 +6,9 @@ let
personalpkgs = rec {
luks-hw-password = callPackage ./luks-hw-password { };
+ dev = callPackage ./dev {
+ devShells = self.devShells.${nixpkgs.system};
+ };
delft-icon-theme = callPackage ./theme/delft-icon-theme.nix { };
background-lnxpcs = callPackage ./theme/background-lnxpcs.nix { };
diff --git a/pkgs/dev/default.nix b/pkgs/dev/default.nix
new file mode 100644
index 0000000..9238f4d
--- /dev/null
+++ b/pkgs/dev/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenvNoCC
+, makeShellWrapper, bash, nix
+, devShells
+}:
+
+with lib;
+
+let
+
+ shells = concatStringsSep ":" (mapAttrsToList (n: v: "${n}=${v}") devShells);
+
+in stdenvNoCC.mkDerivation rec {
+ name = "personal-devshells";
+ src = ./.;
+
+ nativeBuildInputs = [ makeShellWrapper ];
+ installPhase = ''
+ makeShellWrapper ${./dev.sh} $out/bin/dev \
+ --prefix PATH : ${lib.makeBinPath [ bash nix ]} \
+ --set DEV_SHELLS "${shells}" \
+ --set DEV_FLAKE "${../..}"
+ '';
+
+ meta = with lib; {
+ description = "Console version of Stardict program";
+ homepage = "https://dushistov.github.io/sdcv/";
+ license = licenses.gpl2;
+ };
+}
diff --git a/pkgs/dev/dev.sh b/pkgs/dev/dev.sh
new file mode 100755
index 0000000..f88224a
--- /dev/null
+++ b/pkgs/dev/dev.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+set -eu
+
+target="$1"
+shift
+
+known_shells="$(tr ':' '\n' <<<"${DEV_SHELLS:-}")"
+while IFS='=' read name val; do
+ if [ "$target" == "$name" ]; then
+ target="$DEV_FLAKE#$name"
+ break
+ fi
+done <<<"$known_shells"
+
+exec nix develop "$target" -c zsh "$@"