diff options
-rw-r--r-- | custom.nix | 5 | ||||
-rw-r--r-- | gui/pkgs/tasker.nix | 13 | ||||
-rw-r--r-- | host/obelix.nix | 2 | ||||
-rw-r--r-- | tasks/default.nix | 23 |
4 files changed, 35 insertions, 8 deletions
@@ -21,12 +21,15 @@ in { default = "~/"; }; type = mkOption { - type = types.enum [ "launcher" "terminal" ]; + type = types.enum [ "launcher" "terminal" "environment" ]; default = "launcher"; }; command = mkOption { type = types.str; }; + environment = mkOption { + type = types.package; + }; }; }); }; diff --git a/gui/pkgs/tasker.nix b/gui/pkgs/tasker.nix index bc87ee9..fa1a319 100644 --- a/gui/pkgs/tasker.nix +++ b/gui/pkgs/tasker.nix @@ -6,16 +6,21 @@ pkgs.lib.mapAttrsToList (name: conf: let executable = true; destination = "/bin/tasker_cmd_" + name; text = pkgs.lib.attrByPath [ conf.type ] "" { - terminal = '' - #!/bin/sh - exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} ${conf.command} - ''; launcher = '' #!/bin/sh pushd ${conf.directory} exec ${conf.command} popd ''; + terminal = '' + #!/bin/sh + exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} ${conf.command} + ''; + environment = '' + #!/bin/sh + exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} nix-shell \ + ${builtins.unsafeDiscardStringContext conf.environment.drvPath} --command fish + ''; }; }; shortcut = pkgs.writeTextFile { diff --git a/host/obelix.nix b/host/obelix.nix index 45cf20d..6fd02bc 100644 --- a/host/obelix.nix +++ b/host/obelix.nix @@ -10,8 +10,8 @@ custom.tasks = { "compustream_shell" = { description = "compustream dev shell"; + type = "terminal"; directory = "~/projects/dev/compustream"; - terminal = true; command = "nix-shell --command fish"; }; }; diff --git a/tasks/default.nix b/tasks/default.nix index e851c24..6966fd2 100644 --- a/tasks/default.nix +++ b/tasks/default.nix @@ -1,6 +1,15 @@ -{ pkgs ? import <nixpkgs> { }, ... }: +{ pkgs, ... }: -{ +let + mkShellDerivation = n: ps: pkgs.stdenvNoCC.mkDerivation rec { + name = n; + buildInputs = ps; + shellHook = '' + export NIX_SHELL_NAME="${name}" + ''; + }; + +in { custom.tasks = { bsc_edit = { description = "Grid refinement BSc thesis editor"; @@ -29,5 +38,15 @@ directory = "~/projects/contrib/openlb"; command = "nix-shell --command fish"; }; + cpp_shell = { + description = "Generic C++ shell environment"; + type = "environment"; + directory = "~/"; + environment = mkShellDerivation "cpp-env" (with pkgs; [ + cmake + gcc8 + gdb cgdb + ]); + }; }; } |