nixpkgs/modules/installer/tools/nixos-checkout.nix
Eelco Dolstra 41a8f23189 * Revert to the old (r10556) version of the nixos-checkout script. It
was never intended as a generic "check out anything" script; it's
  just a convenience script to obtain the NixOS trunk after
  installation.  So that's what it should do.

svn path=/nixos/trunk/; revision=27005
2011-04-27 15:34:33 +00:00

41 lines
991 B
Nix

# This module generates the nixos-checkout script, which replaces the
# NixOS and Nixpkgs source trees in /etc/nixos/{nixos,nixpkgs} with
# Subversion checkouts.
{config, pkgs, ...}:
with pkgs.lib;
let
nixosCheckout = pkgs.substituteAll {
name = "nixos-checkout";
dir = "bin";
isExecutable = true;
src = pkgs.writeScript "nixos-checkout"
''
cd /etc/nixos
# Move any old nixos or nixpkgs directories out of the way.
backupTimestamp=$(date "+%Y%m%d%H%M%S")
if test -e nixos -a ! -e nixos/.svn; then
mv nixos nixos-$backupTimestamp
fi
if test -e nixpkgs -a ! -e nixpkgs/.svn; then
mv nixpkgs nixpkgs-$backupTimestamp
fi
# Check out the NixOS and Nixpkgs sources.
svn co https://svn.nixos.org/repos/nix/nixos/trunk nixos
svn co https://svn.nixos.org/repos/nix/nixpkgs/trunk nixpkgs
'';
};
in
{
environment.systemPackages = [ nixosCheckout ];
}