Skip to content

Commit b55c44d

Browse files
committed
basic flake.nix support with lib.packs
impure and sandbox options should be passed as: $ nix build .#pkgs.zlib -L --impure --option sandbox false
1 parent 646d0e6 commit b55c44d

File tree

4 files changed

+206
-4
lines changed

4 files changed

+206
-4
lines changed

flake.lock

+44
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
description = "Flake for NixPACK";
3+
4+
inputs.spack = { url="github:spack/spack"; flake=false; };
5+
#inputs.spack = { url="github:flatironinstitute/spack/fi-nixpack"; flake=false; };
6+
inputs.nixpkgs.url = "github:dguibert/nixpkgs/pu-nixpack";
7+
8+
outputs = inputs: let
9+
nixpkgsFor = system: import inputs.nixpkgs {
10+
inherit system;
11+
config = {
12+
replaceStdenv = import ./nixpkgs/stdenv.nix;
13+
allowUnfree = true;
14+
cudaSupport = true;
15+
};
16+
overlays = [(import ./nixpkgs/overlay.nix)];
17+
};
18+
19+
nixosPacks = system: let
20+
pkgs = nixpkgsFor system;
21+
gccWithFortran = pkgs.wrapCC (pkgs.gcc.cc.override {
22+
langFortran = true;
23+
});
24+
in inputs.self.lib.packs {
25+
inherit system;
26+
os = "nixos21";
27+
global.verbose = "true";
28+
spackConfig.config.source_cache="/tmp/spack_cache";
29+
spackPython = "${pkgs.python3}/bin/python3";
30+
spackEnv = {
31+
# pure environment PATH
32+
PATH=/*"/run/current-system/sw/bin:"
33+
+*/inputs.nixpkgs.lib.concatStringsSep ":"
34+
(builtins.map (x: "${x}/bin")
35+
[
36+
pkgs.bash
37+
pkgs.coreutils
38+
pkgs.gnumake
39+
pkgs.gnutar
40+
pkgs.gzip
41+
pkgs.bzip2
42+
pkgs.xz
43+
pkgs.gawk
44+
pkgs.gnused
45+
pkgs.gnugrep
46+
pkgs.glib
47+
pkgs.binutils.bintools # glib: locale
48+
pkgs.patch
49+
pkgs.texinfo
50+
pkgs.diffutils
51+
pkgs.pkgconfig
52+
pkgs.gitMinimal
53+
pkgs.findutils
54+
]);
55+
#PATH="/run/current-system/sw/bin:${pkgs.gnumake}/bin:${pkgs.binutils.bintools}/bin";
56+
LOCALE_ARCHIVE="/run/current-system/sw/lib/locale/locale-archive";
57+
LIBRARY_PATH=/*"/run/current-system/sw/bin:"
58+
+*/inputs.nixpkgs.lib.concatStringsSep ":"
59+
(builtins.map (x: "${x}/lib")
60+
[
61+
(inputs.nixpkgs.lib.getLib pkgs.binutils.bintools) # ucx (configure fails) libbfd not found
62+
]);
63+
};
64+
65+
package = {
66+
compiler = { name="gcc"; extern=gccWithFortran; version=gccWithFortran.version; };
67+
perl = { extern=pkgs.perl; version=pkgs.perl.version; };
68+
openssh = { extern=pkgs.openssh; version=pkgs.openssh.version; };
69+
openssl = { extern=pkgs.symlinkJoin { name="openssl"; paths = [ pkgs.openssl.all ]; }; version=pkgs.openssl.version; };
70+
openmpi = {
71+
version = "4.1";
72+
variants = {
73+
fabrics = {
74+
none = false;
75+
ucx = true;
76+
};
77+
schedulers = {
78+
none = false;
79+
slurm = false;
80+
};
81+
pmi = false;
82+
pmix = false;
83+
static = false;
84+
thread_multiple = true;
85+
legacylaunchers = true;
86+
};
87+
};
88+
};
89+
repoPatch = {
90+
dyninst = spec: old: {
91+
patches = [ ./patch/dyninst-nixos.patch ];
92+
};
93+
openmpi = spec: old: {
94+
build = {
95+
setup = ''
96+
configure_args = pkg.configure_args()
97+
if spec.satisfies("~pmix"):
98+
if '--without-mpix' in configure_args: configure_args.remove('--without-pmix')
99+
pkg.configure_args = lambda: configure_args
100+
'';
101+
};
102+
};
103+
};
104+
};
105+
in {
106+
lib = (import packs/lib.nix) // {
107+
packs = {
108+
...
109+
}@args: import ./packs ({
110+
inherit (inputs) spack nixpkgs;
111+
} // args);
112+
};
113+
114+
115+
packages.x86_64-linux = nixosPacks "x86_64-linux";
116+
117+
defaultPackage.x86_64-linux = inputs.self.packages.x86_64-linux.hello;
118+
119+
};
120+
}

nixpkgs/overlay.nix

+22-4
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,37 @@ self: pkgs:
22
with pkgs;
33

44
{
5+
coreutils = coreutils.overrideAttrs (old: {
6+
doCheck = false; # failure test-getaddrinfo
7+
});
8+
gnutls = gnutls.overrideAttrs (old: {
9+
doCheck = false; # failure test-getaddrinfo
10+
});
11+
libgpg-error = libgpg-error.overrideAttrs (old: {
12+
doCheck = false; # failure FAIL: t-argparse 1.42
13+
});
14+
p11-kit = p11-kit.overrideAttrs (old: {
15+
doCheck = false; # failure ERROR: test-path - missing test plan
16+
});
17+
518
nss_sss = callPackage sssd/nss-client.nix { };
619

720
libuv = libuv.overrideAttrs (old: {
821
doCheck = false; # failure
922
});
1023

11-
coreutils = coreutils.overrideAttrs (old: {
12-
doCheck = false; # df/total-verify broken on ceph
13-
});
14-
1524
nix = (nix.override {
1625
withAWS = false;
1726
}).overrideAttrs (old: {
1827
patches = [../patch/nix-ignore-fsea.patch];
1928
doInstallCheck = false;
2029
});
2130

31+
git = git.overrideAttrs (old: {
32+
doCheck = false; # failure
33+
doInstallCheck = false; # failure
34+
});
35+
2236
gtk3 = gtk3.override {
2337
trackerSupport = false;
2438
};
@@ -33,6 +47,10 @@ with pkgs;
3347
'';
3448
});
3549

50+
openssh = openssh.overrideAttrs (old: {
51+
doCheck = false; # failure
52+
});
53+
3654
openssl_1_0_2 = openssl_1_0_2.overrideAttrs (old: {
3755
postPatch = old.postPatch + ''
3856
sed -i 's:define\s\+X509_CERT_FILE\s\+.*$:define X509_CERT_FILE "/etc/pki/tls/certs/ca-bundle.crt":' crypto/cryptlib.h

patch/dyninst-nixos.patch

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/scripts/dynsysname b/scripts/dynsysname
2+
index 6906fb224..ce385e046 100755
3+
--- a/scripts/dynsysname
4+
+++ b/scripts/dynsysname
5+
@@ -1,4 +1,4 @@
6+
-#!/bin/bash
7+
+#!/usr/bin/env bash
8+
9+
P=$1
10+
11+
diff --git a/scripts/sysname b/scripts/sysname
12+
index 16f540483..dccd3e677 100755
13+
--- a/scripts/sysname
14+
+++ b/scripts/sysname
15+
@@ -1,4 +1,4 @@
16+
-#!/bin/bash
17+
+#!/usr/bin/env bash
18+
# $Id: sysname,v 1.6 2005/08/09 16:13:16 gquinn Exp $
19+
# Attempt to guess a canonical system name.
20+
# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.

0 commit comments

Comments
 (0)