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