Nix Cookbook: Difference between revisions

imported>Ixxie
m Fixed section levels.
imported>Dustinlacewell
Added "Creating Shell Scripts" cookbook
Line 1: Line 1:


== Environment Tasks ==
=== Creating Shell Scripts ===
Arbitrary system shell scripts can be created with [https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L58 pkgs.writeScriptBin]. It creates a derivation which you add to [https://nixos.org/nixos/manual/#sec-declarative-package-mgmt environment.systemPackages].
<syntaxHighlight lang="nix">
{ config, pkgs, lib, ... }:
with lib;
let
  helloWorld = pkgs.writeScriptBin "helloWorld" ''
#!${pkgs.stdenv.shell}
echo Hello World'';
in {
  config.environment.systemPackages = [ helloWorld ];
}
</syntaxHighlight>


== Debugging ==
== Debugging ==