2009-05-29 14:24:48 +02:00
|
|
|
# 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, ...}:
|
2009-05-24 20:28:30 +02:00
|
|
|
|
|
|
|
with pkgs.lib;
|
2008-08-26 21:45:06 +02:00
|
|
|
|
2009-05-29 14:24:48 +02:00
|
|
|
let
|
|
|
|
|
|
|
|
nixosCheckout = pkgs.substituteAll {
|
2008-08-26 21:45:06 +02:00
|
|
|
name = "nixos-checkout";
|
2009-05-29 14:24:48 +02:00
|
|
|
dir = "bin";
|
|
|
|
isExecutable = true;
|
2011-04-27 17:34:33 +02:00
|
|
|
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.
|
2011-10-06 13:29:44 +02:00
|
|
|
${pkgs.subversion}/bin/svn co https://nixos.org/repos/nix/nixos/trunk nixos
|
|
|
|
${pkgs.subversion}/bin/svn co https://nixos.org/repos/nix/nixpkgs/trunk nixpkgs
|
2011-04-27 17:34:33 +02:00
|
|
|
'';
|
2008-08-26 21:45:06 +02:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-05-29 14:24:48 +02:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2011-04-27 17:42:14 +02:00
|
|
|
environment.systemPackages =
|
|
|
|
[ nixosCheckout
|
|
|
|
# Since the checkout script depends on Subversion, we may as
|
|
|
|
# well put it in $PATH.
|
|
|
|
pkgs.subversion
|
|
|
|
];
|
2008-08-26 21:45:06 +02:00
|
|
|
}
|