add programs.nix-script module

This commit is contained in:
Daiderd Jordan 2016-12-27 20:41:27 +01:00
parent 563a2b35b7
commit c75776e589
No known key found for this signature in database
GPG key ID: D02435D05B810C96
3 changed files with 51 additions and 8 deletions

View file

@ -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
];
};
}