nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchgit,
5 graphviz,
6 gettext,
7 autoreconfHook,
8 disarchive,
9 git,
10 glibcLocales,
11 guile,
12 guile-avahi,
13 guile-gcrypt,
14 guile-git,
15 guile-gnutls,
16 guile-json,
17 guile-lib,
18 guile-lzlib,
19 guile-lzma,
20 guile-semver,
21 guile-ssh,
22 guile-sqlite3,
23 guile-zlib,
24 guile-zstd,
25 help2man,
26 makeWrapper,
27 pkg-config,
28 po4a,
29 scheme-bytestructures,
30 slirp4netns,
31 texinfo,
32 bzip2,
33 libgcrypt,
34 sqlite,
35 nixosTests,
36
37 stateDir ? "/var",
38 storeDir ? "/gnu/store",
39 confDir ? "/etc",
40}:
41stdenv.mkDerivation (finalAttrs: {
42 pname = "guix";
43 version = "1.5.0";
44
45 src = fetchgit {
46 url = "https://codeberg.org/guix/guix.git";
47 tag = "v${finalAttrs.version}";
48 hash = "sha256-/g8JMUGM5GaZjtPLnl4vlrBNYMxSTjsHUDdhKLtHaQA=";
49 };
50
51 patches = [
52 ./missing-cstdint-include.patch
53 ];
54
55 postPatch = ''
56 sed nix/local.mk -i -E \
57 -e "s|^sysvinitservicedir = .*$|sysvinitservicedir = $out/etc/init.d|" \
58 -e "s|^openrcservicedir = .*$|openrcservicedir = $out/etc/openrc|"
59 '';
60
61 strictDeps = true;
62
63 nativeBuildInputs = [
64 autoreconfHook
65 disarchive
66 git
67 graphviz
68 gettext
69 glibcLocales
70 guile
71 guile-avahi
72 guile-gcrypt
73 guile-git
74 guile-gnutls
75 guile-json
76 guile-lib
77 guile-lzlib
78 guile-lzma
79 guile-semver
80 guile-ssh
81 guile-sqlite3
82 guile-zlib
83 guile-zstd
84 help2man
85 makeWrapper
86 pkg-config
87 po4a
88 scheme-bytestructures
89 slirp4netns
90 texinfo
91 ];
92
93 buildInputs = [
94 bzip2
95 guile
96 libgcrypt
97 sqlite
98 ];
99
100 propagatedBuildInputs = [
101 disarchive
102 guile-avahi
103 guile-gcrypt
104 guile-git
105 guile-gnutls
106 guile-json
107 guile-lib
108 guile-lzlib
109 guile-lzma
110 guile-semver
111 guile-ssh
112 guile-sqlite3
113 guile-zlib
114 guile-zstd
115 scheme-bytestructures
116 slirp4netns
117 ];
118
119 configureFlags = [
120 "--with-store-dir=${storeDir}"
121 "--localstatedir=${stateDir}"
122 "--sysconfdir=${confDir}"
123 "--with-bash-completion-dir=$(out)/etc/bash_completion.d"
124 "--with-zsh-completion-dir=$(out)/share/zsh/site-functions"
125 "--with-fish-completion-dir=$(out)/share/fish/vendor_completions.d"
126 "--with-apparmor-profile-dir=$(out)/etc/apparmor.d"
127 ];
128
129 preAutoreconf = ''
130 echo ${finalAttrs.version} > .tarball-version
131 ./bootstrap
132 '';
133
134 enableParallelBuilding = true;
135
136 postInstall = ''
137 for f in $out/bin/*; do
138 wrapProgram $f \
139 --prefix GUILE_LOAD_PATH : "$out/${guile.siteDir}:$GUILE_LOAD_PATH" \
140 --prefix GUILE_LOAD_COMPILED_PATH : "$out/${guile.siteCcacheDir}:$GUILE_LOAD_COMPILED_PATH" \
141 --prefix GUILE_EXTENSIONS_PATH : "${guile-ssh}/lib/guile/3.0/extensions"
142 done
143 '';
144
145 passthru.tests = {
146 inherit (nixosTests) guix;
147 };
148
149 meta = {
150 description = "Functional package manager with a Scheme interface";
151 longDescription = ''
152 GNU Guix is a purely functional package manager for the GNU system, and a distribution thereof.
153 In addition to standard package management features, Guix supports
154 transactional upgrades and roll-backs, unprivileged package management,
155 per-user profiles, and garbage collection.
156 It provides Guile Scheme APIs, including high-level embedded
157 domain-specific languages (EDSLs), to describe how packages are built
158 and composed.
159 A user-land free software distribution for GNU/Linux comes as part of
160 Guix.
161 Guix is based on the Nix package manager.
162 '';
163 homepage = "https://guix.gnu.org/";
164 changelog = "https://codeberg.org/guix/guix/raw/tag/v${finalAttrs.version}/NEWS";
165 license = lib.licenses.gpl3Plus;
166 mainProgram = "guix";
167 maintainers = with lib.maintainers; [
168 cafkafk
169 hpfr
170 ];
171 platforms = lib.platforms.linux;
172 };
173})