summaryrefslogtreecommitdiff
path: root/modules/programs
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2016-12-27 20:41:27 +0100
committerDaiderd Jordan <daiderd@gmail.com>2016-12-27 20:47:52 +0100
commitc75776e589a92c732ea5be4cd203c380e6d17e77 (patch)
tree2dcf1866d6462abe82fcd58db55d0755550dbfa9 /modules/programs
parent563a2b35b72e5dc1b28739eb90e850b61c600bde (diff)
add programs.nix-script module
Diffstat (limited to 'modules/programs')
-rw-r--r--modules/programs/nix-script.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/modules/programs/nix-script.nix b/modules/programs/nix-script.nix
new file mode 100644
index 0000000..d970138
--- /dev/null
+++ b/modules/programs/nix-script.nix
@@ -0,0 +1,47 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.nix-script;
+
+ nix-script = pkgs.substituteAll {
+ inherit (cfg) name;
+ src = ../../pkgs/nix-tools/nix-script.sh;
+ dir = "bin";
+ isExecutable = true;
+ };
+
+in
+
+{
+ options = {
+
+ programs.nix-script.enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable the nix script.
+ '';
+ };
+
+ programs.nix-script.name = mkOption {
+ type = types.str;
+ default = "nix";
+ description = ''
+ Name to use for the nix script.
+ '';
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages =
+ [ # Nix wrapper script
+ nix-script
+ ];
+
+ };
+}