aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-02-24 21:16:45 +0100
committerAdrian Kummerlaender2019-02-24 21:16:45 +0100
commit224ac2ea3e7585bc732397b9bf39a8e0fd24fbc3 (patch)
treee9da6f97cce840275849589139e2218ff36f9194
parentf87582250fd324cd04886cd84a7ee58d03133b13 (diff)
downloadnixos_home-224ac2ea3e7585bc732397b9bf39a8e0fd24fbc3.tar
nixos_home-224ac2ea3e7585bc732397b9bf39a8e0fd24fbc3.tar.gz
nixos_home-224ac2ea3e7585bc732397b9bf39a8e0fd24fbc3.tar.bz2
nixos_home-224ac2ea3e7585bc732397b9bf39a8e0fd24fbc3.tar.lz
nixos_home-224ac2ea3e7585bc732397b9bf39a8e0fd24fbc3.tar.xz
nixos_home-224ac2ea3e7585bc732397b9bf39a8e0fd24fbc3.tar.zst
nixos_home-224ac2ea3e7585bc732397b9bf39a8e0fd24fbc3.zip
Add Tasker types for opening terminal / vim in local nix-shell
-rw-r--r--custom.nix2
-rw-r--r--gui/pkgs/tasker.nix13
-rw-r--r--host/obelix.nix3
-rw-r--r--tasks/default.nix17
4 files changed, 25 insertions, 10 deletions
diff --git a/custom.nix b/custom.nix
index 06b6676..88745ad 100644
--- a/custom.nix
+++ b/custom.nix
@@ -21,7 +21,7 @@ in {
default = "~/";
};
type = mkOption {
- type = types.enum [ "launcher" "terminal" "environment" ];
+ type = types.enum [ "launcher" "terminal" "local-shell" "local-editor" "environment" ];
default = "launcher";
};
command = mkOption {
diff --git a/gui/pkgs/tasker.nix b/gui/pkgs/tasker.nix
index fa1a319..6bad2d6 100644
--- a/gui/pkgs/tasker.nix
+++ b/gui/pkgs/tasker.nix
@@ -1,6 +1,7 @@
{ pkgs, tasks, ... }:
pkgs.lib.mapAttrsToList (name: conf: let
+
command = pkgs.writeTextFile {
name = "tasker_cmd_" + name;
executable = true;
@@ -16,6 +17,16 @@ pkgs.lib.mapAttrsToList (name: conf: let
#!/bin/sh
exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} ${conf.command}
'';
+ local-shell = ''
+ #!/bin/sh
+ exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} nix-shell --command fish
+ '';
+ local-editor = ''
+ #!/bin/sh
+ pushd ${conf.directory}
+ exec nix-shell --run 'nvim-qt --no-ext-tabline'
+ popd
+ '';
environment = ''
#!/bin/sh
exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} nix-shell \
@@ -23,6 +34,7 @@ pkgs.lib.mapAttrsToList (name: conf: let
'';
};
};
+
shortcut = pkgs.writeTextFile {
name = "tasker_shortcut_" + name;
executable = false;
@@ -36,6 +48,7 @@ pkgs.lib.mapAttrsToList (name: conf: let
Terminal=false
'';
};
+
in pkgs.symlinkJoin {
name = "tasker_task_" + name;
paths = [ shortcut ];
diff --git a/host/obelix.nix b/host/obelix.nix
index 6fd02bc..b38ab68 100644
--- a/host/obelix.nix
+++ b/host/obelix.nix
@@ -10,9 +10,8 @@
custom.tasks = {
"compustream_shell" = {
description = "compustream dev shell";
- type = "terminal";
directory = "~/projects/dev/compustream";
- command = "nix-shell --command fish";
+ type = "local-shell";
};
};
}
diff --git a/tasks/default.nix b/tasks/default.nix
index 6966fd2..3af769f 100644
--- a/tasks/default.nix
+++ b/tasks/default.nix
@@ -14,34 +14,37 @@ in {
bsc_edit = {
description = "Grid refinement BSc thesis editor";
directory = "~/university/documents/bachelor/arbeit";
- command = "nix-shell --run 'nvim-qt --no-ext-tabline'";
+ type = "local-editor";
};
+
bsc_shell = {
description = "Grid refinement BSc thesis shell";
- type = "terminal";
directory = "~/university/documents/bachelor/arbeit";
- command = "nix-shell --command fish";
+ type = "local-shell";
};
+
bsc_view = {
description = "Grid refinement BSc thesis PDF";
directory = "~/university/documents/bachelor/arbeit";
command = "evince build/main.pdf";
};
+
olb_edit = {
description = "OpenLB editor";
directory = "~/projects/contrib/openlb";
- command = "nix-shell --run 'nvim-qt --no-ext-tabline'";
+ type = "local-editor";
};
+
olb_shell = {
description = "OpenLB shell";
- type = "terminal";
directory = "~/projects/contrib/openlb";
- command = "nix-shell --command fish";
+ type = "local-shell";
};
+
cpp_shell = {
description = "Generic C++ shell environment";
- type = "environment";
directory = "~/";
+ type = "environment";
environment = mkShellDerivation "cpp-env" (with pkgs; [
cmake
gcc8