1{ lib
2, resholve
3, fetchFromGitHub
4, asciidoc
5, bash
6, coreutils
7, gawk
8, gnugrep
9, gnum4
10, pacman
11, util-linux
12, chrootPath ? [
13 "/usr/local/sbin"
14 "/usr/local/bin"
15 "/usr/bin"
16 "/usr/bin/site_perl"
17 "/usr/bin/vendor_perl"
18 "/usr/bin/core_perl"
19 ]
20}:
21
22resholve.mkDerivation rec {
23 pname = "arch-install-scripts";
24 version = "28";
25
26 src = fetchFromGitHub {
27 owner = "archlinux";
28 repo = "arch-install-scripts";
29 rev = "v${version}";
30 hash = "sha256-TytCeejhjWYDzWFjGubUl08OrsAQa9fFULoamDfbdDY=";
31 };
32
33 nativeBuildInputs = [ asciidoc gnum4 ];
34
35 postPatch = ''
36 substituteInPlace ./Makefile \
37 --replace "PREFIX = /usr/local" "PREFIX ?= /usr/local"
38 substituteInPlace ./pacstrap.in \
39 --replace "cp -a" "cp -LR --no-preserve=mode" \
40 --replace "unshare pacman" "unshare ${pacman}/bin/pacman" \
41 --replace 'gnupg "$newroot/etc/pacman.d/"' 'gnupg "$newroot/etc/pacman.d/" && chmod 700 "$newroot/etc/pacman.d/gnupg"'
42 echo "export PATH=${lib.strings.makeSearchPath "" chrootPath}:\$PATH" >> ./common
43 '';
44
45 installFlags = [ "PREFIX=$(out)" ];
46
47 doCheck = true;
48
49 solutions = {
50 # Give each solution a short name. This is what you'd use to
51 # override its settings, and it shows in (some) error messages.
52 profile = {
53 # the only *required* arguments are the 3 below
54
55 # Specify 1 or more $out-relative script paths. Unlike many
56 # builders, resholve.mkDerivation modifies the output files during
57 # fixup (to correctly resolve in-package sourcing).
58 scripts = [ "bin/arch-chroot" "bin/genfstab" "bin/pacstrap" ];
59
60 # "none" for no shebang, "${bash}/bin/bash" for bash, etc.
61 interpreter = "${bash}/bin/bash";
62
63 # packages resholve should resolve executables from
64 inputs = [ coreutils gawk gnugrep pacman util-linux ];
65
66 execer = [ "cannot:${pacman}/bin/pacman-key" ];
67
68 # TODO: no good way to resolve mount/umount in Nix builds for now
69 # see https://github.com/abathur/resholve/issues/29
70 fix = {
71 mount = true;
72 umount = true;
73 };
74
75 keep = [ "$setup" "$pid_unshare" "$mount_unshare" "${pacman}/bin/pacman" ];
76 };
77 };
78
79 meta = with lib; {
80 description = "Useful scripts for installing Arch Linux";
81 longDescription = ''
82 A small suite of scripts aimed at automating some menial tasks when installing Arch Linux.
83 '';
84 homepage = "https://github.com/archlinux/arch-install-scripts";
85 license = licenses.gpl2Only;
86 maintainers = with maintainers; [ samlukeyes123 ];
87 platforms = platforms.linux;
88 };
89}