Skip to content

Instantly share code, notes, and snippets.

@asgeir
Created September 3, 2017 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asgeir/c0e57383d56b1aa962a62831a52b5961 to your computer and use it in GitHub Desktop.
Save asgeir/c0e57383d56b1aa962a62831a52b5961 to your computer and use it in GitHub Desktop.
diff -uraN nix.orig/fix_perllibdir.patch nix.new/fix_perllibdir.patch
--- nix.orig/fix_perllibdir.patch 1970-01-01 00:00:00.000000000 +0000
+++ nix.new/fix_perllibdir.patch 2017-09-03 19:06:47.423884723 +0000
@@ -0,0 +1,12 @@
+diff -ura a/Makefile.config.in b/Makefile.config.in
+--- a/Makefile.config.in 1970-01-01 00:00:01.000000000 +0000
++++ b/Makefile.config.in 2017-09-03 17:04:53.032445157 +0000
+@@ -26,7 +26,7 @@
+ mandir = @mandir@
+ perl = @perl@
+ perlbindings = @perlbindings@
+-perllibdir = @perllibdir@
++perllibdir = $(shell perl -V:vendorarch|cut -d\' -f2)
+ pkglibdir = $(libdir)/$(PACKAGE_NAME)
+ prefix = @prefix@
+ storedir = @storedir@
diff -uraN nix.orig/nix.install nix.new/nix.install
--- nix.orig/nix.install 1970-01-01 00:00:00.000000000 +0000
+++ nix.new/nix.install 2017-09-03 19:03:24.024861446 +0000
@@ -0,0 +1,91 @@
+
+pre_install () {
+ # Check that the group and users don't already exist
+ if [[ -n $(cut -d: -f1 /etc/group | grep -w nixbld) ]]; then
+ echo "The nixbld group already exists. This install cannot proceed."
+ exit 1
+ fi
+
+ for i in {1..10}; do
+ if [[ -n $(cut -d: -f1 /etc/passwd | grep -w nixbld$i) ]]; then
+ echo "The nixbld$i user already exists. This install cannot proceed."
+ exit 1
+ fi
+ done
+}
+
+create_users () {
+ # Create a nixbld group.
+ groupadd -r nixbld
+
+ # Create 10 nixbld{i} users
+ for i in {1..10}; do
+ useradd -g nixbld -G nixbld -r -N -M -d /var/empty -s /sbin/nologin nixbld$i
+ done
+}
+
+delete_users() {
+ # Remove the users
+ for i in {1..10}; do
+ userdel nixbld$i
+ done
+
+ # Remove the group
+ groupdel nixbld
+}
+
+create_store() {
+ # Create nix folders and set permissions
+ mkdir -p /nix/store
+ chown root.nixbld /nix/store
+ chmod 1775 /nix/store
+ mkdir -p -m 1777 /nix/var/nix/gcroots/per-user
+ mkdir -p -m 1777 /nix/var/nix/profiles/per-user
+}
+
+restore_store() {
+ # Restore folder permissions
+ chmod 755 /nix/store
+ chown root.root /nix/store
+}
+
+daemon_info() {
+ if [ ! -d /nix/var/nix/profiles/per-user/root ]; then
+ echo "To start the nix daemon, execute one of the following:"
+ echo
+ echo " systemctl enable nix-daemon.socket # Sets the daemon to start on next boot"
+ echo " systemctl enable --now nix-daemon.socket # Starts now and on next boot too"
+ echo
+ echo "Also, if this is a new install, you need to start a new login shell or otherwise"
+ echo
+ echo " source /etc/profile.d/nix.sh"
+ echo " source /etc/profile.d/nix-daemon.sh"
+ echo
+ echo "Once your environment is set-up, you will need to add some channels. You can see how"
+ echo "to do that here:"
+ echo " https://nixos.org/nix/manual/#sec-channels"
+ fi
+}
+
+post_install() {
+ create_users
+ create_store
+ daemon_info
+}
+
+pre_upgrade() {
+ systemctl stop nix-daemon.socket
+ systemctl stop nix-daemon
+}
+
+post_upgrade() {
+ delete_users
+ create_users
+ create_store
+ daemon_info
+}
+
+pre_remove() {
+ restore_store
+ delete_users
+}
diff -uraN nix.orig/PKGBUILD nix.new/PKGBUILD
--- nix.orig/PKGBUILD 2017-06-12 20:18:08.000000000 +0000
+++ nix.new/PKGBUILD 2017-09-03 18:49:02.584931141 +0000
@@ -4,7 +4,7 @@
# Contributor: koral <koral at mailoo dot org>
pkgname=nix
-pkgver=1.11.10
+pkgver=1.11.14
pkgrel=1
pkgdesc="A purely functional package manager"
arch=('i686' 'x86_64')
@@ -12,8 +12,15 @@
license=('LGPL')
depends=('perl-www-curl' 'perl-dbd-sqlite' 'gc' 'libsodium')
makedepends=('bzip2' 'gc' 'openssl')
-source=("https://nixos.org/releases/nix/nix-$pkgver/nix-$pkgver.tar.xz")
-sha256sums=('b29a458c2b803bcc07d8b58cd016ca6ad0788a73ca74edaeaebc588961322467')
+install=nix.install
+source=("https://nixos.org/releases/nix/nix-$pkgver/nix-$pkgver.tar.xz" "fix_perllibdir.patch")
+sha256sums=('26593c831addf1d40f6b7d131f394cb0f9fbec9e46471369faed16eaa2c4b7e4'
+ '6d5a79602944b560f9b571c8db4efa1b26d4495e6160c5e18c2efbdd2e611c80')
+
+prepare() {
+ cd "$pkgname-$pkgver"
+ patch -Np1 -i "${srcdir}/fix_perllibdir.patch"
+}
build () {
cd "$pkgname-$pkgver"
diff -uraN nix.orig/.SRCINFO nix.new/.SRCINFO
--- nix.orig/.SRCINFO 2017-06-12 20:18:08.000000000 +0000
+++ nix.new/.SRCINFO 2017-09-03 19:07:41.784514888 +0000
@@ -1,8 +1,9 @@
pkgbase = nix
pkgdesc = A purely functional package manager
- pkgver = 1.11.10
+ pkgver = 1.11.14
pkgrel = 1
url = https://nixos.org/nix
+ install = nix.install
arch = i686
arch = x86_64
license = LGPL
@@ -13,8 +14,10 @@
depends = perl-dbd-sqlite
depends = gc
depends = libsodium
- source = https://nixos.org/releases/nix/nix-1.11.10/nix-1.11.10.tar.xz
- sha256sums = b29a458c2b803bcc07d8b58cd016ca6ad0788a73ca74edaeaebc588961322467
+ source = https://nixos.org/releases/nix/nix-1.11.14/nix-1.11.14.tar.xz
+ source = fix_perllibdir.patch
+ sha256sums = 26593c831addf1d40f6b7d131f394cb0f9fbec9e46471369faed16eaa2c4b7e4
+ sha256sums = 6d5a79602944b560f9b571c8db4efa1b26d4495e6160c5e18c2efbdd2e611c80
pkgname = nix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment