diff options
author | William Carroll <wpcarro@gmail.com> | 2020-03-13T17·25+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-03-13T17·25+0000 |
commit | c46fd5ee14869511eee9a05f677e4c4f89c4024c (patch) | |
tree | b60a126ab128b7173ff98da10f2649b25f575a60 /configs | |
parent | beeed2baa2ae80dd357ef880819a71926a4dfa44 (diff) |
Define wrapNonNixProgram as a helper utility
Write a simple Nix expression to DRY up my writeShellScriptBin wrapper pattern.
Diffstat (limited to 'configs')
-rw-r--r-- | configs/.config/nixpkgs/home.nix | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/configs/.config/nixpkgs/home.nix b/configs/.config/nixpkgs/home.nix index 5d1f575eabe9..0c01a458ffb4 100644 --- a/configs/.config/nixpkgs/home.nix +++ b/configs/.config/nixpkgs/home.nix @@ -1,6 +1,10 @@ { config, pkgs, ... }: -{ +let + wrapNonNixProgram = { path, as }: pkgs.writeShellScriptBin as '' + exec ${path} "$@" + ''; +in { home = { packages = with pkgs; [ bat @@ -41,9 +45,7 @@ programs.git = { enable = true; - package = pkgs.writeShellScriptBin "git" '' - exec /usr/bin/git "$@" - ''; + package = wrapNonNixProgram { path = "/usr/bin/git"; as = "git"; }; userName = "William Carroll"; userEmail = "wpcarro@gmail.com"; aliases = { @@ -145,10 +147,7 @@ enable = true; latitude = "51.49"; longitude = "-0.18"; - # The redshift from <nixpkgs> isn't working on gLinux. - package = pkgs.writeShellScriptBin "redshift" '' - exec /usr/bin/redshift "$@" - ''; + package = wrapNonNixProgram { path = "/usr/bin/redshift"; as = "redshift"; }; }; # Hide the cursor during X sessions after 1 second. |