From 4bda7bcd1eb2410ff7466fd4da2b5345ece6763f Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 22 Feb 2019 20:34:18 +0100 Subject: Declare tasks as attribute option This way it is easy to support e.g. host specific tasks --- custom.nix | 12 +++++++++--- gui/default.nix | 9 +++++++-- gui/tasker.nix | 38 -------------------------------------- home.nix | 4 ++++ tasks/default.nix | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 43 deletions(-) delete mode 100644 gui/tasker.nix create mode 100644 tasks/default.nix diff --git a/custom.nix b/custom.nix index 266a37e..acc8f0e 100644 --- a/custom.nix +++ b/custom.nix @@ -1,8 +1,14 @@ { pkgs, ... }: { - options.custom.hidpi = pkgs.lib.mkOption { - type = pkgs.lib.types.bool; - description = "Configure UI for high DPI displays"; + options.custom = { + hidpi = pkgs.lib.mkOption { + type = pkgs.lib.types.bool; + description = "Configure UI for high DPI displays"; + }; + + tasks = pkgs.lib.mkOption { + type = pkgs.lib.types.attrs; + }; }; } diff --git a/gui/default.nix b/gui/default.nix index 6948139..93cf8c3 100644 --- a/gui/default.nix +++ b/gui/default.nix @@ -9,14 +9,13 @@ in { ./kitty.nix ./vim.nix ./zathura.nix - # desktop shortcuts for project specific tasks - ./tasker.nix # applications grouped by purpose ./apps/file.nix ./apps/web.nix ./apps/dev.nix ]; +# hidpi specific xorg flags xresources.extraConfig = pkgs.lib.mkIf hidpi '' Xft.dpi: 160 Xft.autohint: 0 @@ -26,4 +25,10 @@ in { Xft.antialias: 1 Xft.rgba: rgb ''; + +# desktop shortcuts for project specific tasks + home.packages = pkgs.callPackage ./pkgs/tasker.nix { + inherit pkgs; + tasks = config.custom.tasks; + }; } diff --git a/gui/tasker.nix b/gui/tasker.nix deleted file mode 100644 index e7092ba..0000000 --- a/gui/tasker.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ pkgs, ... }: - -let - tasks = { - "bsc_edit" = { - description = "Grid refinement BSc thesis editor"; - directory = "~/university/documents/bachelor/arbeit"; - terminal = false; - command = "nix-shell --run 'nvim-qt --no-ext-tabline'"; - }; - "bsc_shell" = { - description = "Grid refinement BSc thesis shell"; - directory = "~/university/documents/bachelor/arbeit"; - terminal = true; - command = "nix-shell --command fish"; - }; - "bsc_view" = { - description = "Grid refinement BSc thesis PDF"; - directory = "~/university/documents/bachelor/arbeit"; - terminal = false; - command = "evince build/main.pdf"; - }; - "olb_edit" = { - description = "OpenLB editor"; - directory = "~/projects/contrib/openlb"; - terminal = false; - command = "nix-shell --run 'nvim-qt --no-ext-tabline'"; - }; - "olb_shell" = { - description = "OpenLB shell"; - directory = "~/projects/contrib/openlb"; - terminal = true; - command = "nix-shell --command fish"; - }; - }; -in { - home.packages = pkgs.callPackage ./pkgs/tasker.nix { inherit pkgs; inherit tasks; }; -} diff --git a/home.nix b/home.nix index 3cc427d..d0dbb69 100644 --- a/home.nix +++ b/home.nix @@ -7,8 +7,12 @@ }; imports = [ + # define options custom to this config ./custom.nix + # load host specific stuff ./host/current.nix + # task shortcuts common to all setups + ./tasks/default.nix ]; home = { diff --git a/tasks/default.nix b/tasks/default.nix new file mode 100644 index 0000000..9fbee61 --- /dev/null +++ b/tasks/default.nix @@ -0,0 +1,36 @@ +{ ... }: + +{ + custom.tasks = { + "bsc_edit" = { + description = "Grid refinement BSc thesis editor"; + directory = "~/university/documents/bachelor/arbeit"; + terminal = false; + command = "nix-shell --run 'nvim-qt --no-ext-tabline'"; + }; + "bsc_shell" = { + description = "Grid refinement BSc thesis shell"; + directory = "~/university/documents/bachelor/arbeit"; + terminal = true; + command = "nix-shell --command fish"; + }; + "bsc_view" = { + description = "Grid refinement BSc thesis PDF"; + directory = "~/university/documents/bachelor/arbeit"; + terminal = false; + command = "evince build/main.pdf"; + }; + "olb_edit" = { + description = "OpenLB editor"; + directory = "~/projects/contrib/openlb"; + terminal = false; + command = "nix-shell --run 'nvim-qt --no-ext-tabline'"; + }; + "olb_shell" = { + description = "OpenLB shell"; + directory = "~/projects/contrib/openlb"; + terminal = true; + command = "nix-shell --command fish"; + }; + }; +} -- cgit v1.2.3