mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
Move all of NixOS to nixos/ in preparation of the repository merge
This commit is contained in:
parent
6070bc016b
commit
5c1f8cbc70
481 changed files with 0 additions and 0 deletions
55
nixos/modules/installer/tools/nixos-checkout.nix
Normal file
55
nixos/modules/installer/tools/nixos-checkout.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
# This module generates the nixos-checkout script, which replaces the
|
||||
# NixOS and Nixpkgs source trees in /etc/nixos/{nixos,nixpkgs} with
|
||||
# Git checkouts.
|
||||
|
||||
{config, pkgs, ...}:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
nixosCheckout = pkgs.substituteAll {
|
||||
name = "nixos-checkout";
|
||||
dir = "bin";
|
||||
isExecutable = true;
|
||||
src = pkgs.writeScript "nixos-checkout"
|
||||
''
|
||||
#! ${pkgs.stdenv.shell} -e
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
||||
echo "Usage: `basename $0` [PREFIX]. See NixOS Manual for more info."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
prefix="$1"
|
||||
if [ -z "$prefix" ]; then prefix=/etc/nixos; fi
|
||||
mkdir -p "$prefix"
|
||||
cd "$prefix"
|
||||
|
||||
if [ -z "$(type -P git)" ]; then
|
||||
echo "installing Git..."
|
||||
nix-env -iA nixos.pkgs.git || nix-env -i git
|
||||
fi
|
||||
|
||||
# Move any old nixos or nixpkgs directories out of the way.
|
||||
backupTimestamp=$(date "+%Y%m%d%H%M%S")
|
||||
|
||||
if [ -e nixos -a ! -e nixos/.git ]; then
|
||||
mv nixos nixos-$backupTimestamp
|
||||
fi
|
||||
|
||||
if [ -e nixpkgs -a ! -e nixpkgs/.git ]; then
|
||||
mv nixpkgs nixpkgs-$backupTimestamp
|
||||
fi
|
||||
|
||||
# Check out the NixOS and Nixpkgs sources.
|
||||
git clone git://github.com/NixOS/nixos.git nixos
|
||||
git clone git://github.com/NixOS/nixpkgs.git nixpkgs
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
environment.systemPackages = [ nixosCheckout ];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue