Compare commits

..

26 Commits

Author SHA1 Message Date
a173af654f
Fix osu cross-compilation
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 16:23:46 +01:00
2fff7e4a7b
Set mpich default compilers from targetPackages
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 16:23:46 +01:00
a761b73336
Enable meta.cross for mpich related packages
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 16:23:46 +01:00
86eb796771
Disable meta.cross for gpi-2 and tagaspi
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 16:23:46 +01:00
08633435cf
Fix nativeBuildInputs for tagaspi
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 16:23:46 +01:00
39d64456a4
Fix nativeBuildInputs for gpi-2
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 16:23:46 +01:00
410040a4a0
Fix mpich cross compilation (disable fortran)
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 16:23:46 +01:00
fc69ef3217 Enable pam_slurm_adopt in all compute nodes
Prevents access to owl1 and owl2 too if the user doesn't have any jobs
running there.

Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-31 11:41:50 +01:00
1d025f7a38 Don't suspend owl compute nodes
Currently the owl nodes are located on top of the rack and turning them
off causes a high temperature increase at that region, which accumulates
heat from the whole rack. To maximize airflow we will leave them on at
all times. This also makes allocations immediate at the extra cost of
around 200 W.

In the future, if we include more nodes in SLURM we can configure those
to turn off if needed.

Fixes: rarias/jungle#156
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-31 11:41:44 +01:00
7989779c8f Filter out packages by platform from crossSet
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
Tested-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 11:21:13 +01:00
7d721084a7 Add meta to cudainfo
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 11:20:01 +01:00
796d34a549 Set amd-uprof platforms to x86_64-linux only
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-31 11:19:57 +01:00
5ff1b1343b Add nixgen to all machines
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-29 16:28:05 +01:00
c5cc13fad8 Add nixgen package
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-29 16:27:56 +01:00
2e09314a7e Update OmpSs-2 LLVM to 2025.11
Reviewed-by: Aleix Boné <abonerib@bsc.es>
Tested-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-29 16:22:57 +01:00
217d9c1fc0 Update NODES to 1.4
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-29 16:21:46 +01:00
f47ab7757e Update nOS-V to 4.0.0
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-29 16:21:43 +01:00
4b265c071e Update ovni to 1.13.0
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-29 16:21:32 +01:00
019826d09e Add OmpSs-2 release timers and services
Send a reminder email to the STAR group to mark the release cycle dates.

Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-28 12:38:37 +01:00
a294daf7e3 Use specific mail-robot group to send mail
Allows any user to be able to send mail from the robot account as long
as it is added to the mail-robot group.

Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-28 12:38:17 +01:00
a7018250ca Add missing slurm package to overlay
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-28 11:44:40 +01:00
e3d1785285 Run a shell in the allocated node with salloc
By default, salloc will open a new shell in the *current* node instead
of in the allocated node. This often causes users to leave the extra
shell running once the allocation ends. Repeating this process several
times causes chains of shells.

By running the shell in the remote node, once the allocation ends the
shell finishes as well.

Fixes: rarias/jungle#174
See: https://slurm.schedmd.com/faq.html#prompt
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-28 11:44:14 +01:00
ab86243a07
Add missing which in nodes checkPhase
When enabling checks, the build log is polluted with errors.

Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
Tested-by: Aleix Boné <abonerib@bsc.es>
2025-10-23 15:59:21 +02:00
14f2393d30 Update website
Add apex page and replace bscpkgs references for jungle after the merge.

See: rarias/jungle-website#1
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-22 15:48:13 +02:00
f115d611e7 Add aaguirre user
Reviewed-by: Aleix Boné <abonerib@bsc.es>
2025-10-22 15:28:29 +02:00
4261d327c6 Include agenix module and package directly
Avoids adding an extra flake input only to fetch a single module and
package.

Reviewed-by: Aleix Boné <abonerib@bsc.es>
Tested-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2025-10-14 09:37:47 +02:00
76 changed files with 3451 additions and 191 deletions

82
flake.lock generated
View File

@ -1,71 +1,5 @@
{
"nodes": {
"agenix": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems"
},
"locked": {
"lastModified": 1750173260,
"narHash": "sha256-9P1FziAwl5+3edkfFcr5HeGtQUtrSdk/MksX39GieoA=",
"owner": "ryantm",
"repo": "agenix",
"rev": "531beac616433bac6f9e2a19feb8e99a22a66baf",
"type": "github"
},
"original": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1744478979,
"narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "43975d782b418ebf4969e9ccba82466728c2851b",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1745494811,
"narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1752436162,
@ -84,24 +18,8 @@
},
"root": {
"inputs": {
"agenix": "agenix",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -1,15 +1,13 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, agenix, ... }:
outputs = { self, nixpkgs, ... }:
let
mkConf = name: nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit nixpkgs agenix; theFlake = self; };
specialArgs = { inherit nixpkgs; theFlake = self; };
modules = [ "${self.outPath}/m/${name}/configuration.nix" ];
};
# For now we only support x86

View File

@ -1,9 +1,8 @@
{ agenix, ... }:
{ pkgs, ... }:
{
imports = [ agenix.nixosModules.default ];
imports = [ ../../module/agenix.nix ];
environment.systemPackages = [
agenix.packages.x86_64-linux.default
];
# Add agenix to system packages
environment.systemPackages = [ pkgs.agenix ];
}

View File

@ -5,8 +5,8 @@
vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option
nix-diff ipmitool freeipmi ethtool lm_sensors cmake gnumake file tree
ncdu config.boot.kernelPackages.perf ldns pv
# From bsckgs overlay
osumb
# From jungle overlay
osumb nixgen
];
programs.direnv.enable = true;

View File

@ -180,6 +180,19 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmMqKqPg4uocNOr3O41kLbZMOMJn3m2ZdN1JvTR96z3 bsccns@arnau-bsc"
];
};
aaguirre = {
uid = 9655;
isNormalUser = true;
home = "/home/Computational/aaguirre";
description = "Alejandro Aguirre";
group = "Computational";
hosts = [ "apex" "hut" ];
hashedPassword = "$6$TXRXQT6jjBvxkxU6$E.sh5KspAm1qeG5Ct7OPHpo8REmbGDwjFGvqeGgTVz3GASGOAnPL7UMZsMAsAKBoahOw.v8LNno6XGrTEPzZH1";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOlRX7ZCnqtUJYCxKgWmgSrFCYuA2LHY96rVwqxXPl86 aaguirre@BSC-8488184117"
];
};
};
groups = {

View File

@ -93,20 +93,4 @@
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = script;
};
# Only allow SSH connections from users who have a SLURM allocation
# See: https://slurm.schedmd.com/pam_slurm_adopt.html
security.pam.services.sshd.rules.account.slurm = {
control = "required";
enable = true;
modulePath = "${pkgs.slurm}/lib/security/pam_slurm_adopt.so";
args = [ "log_level=debug5" ];
order = 999999; # Make it last one
};
# Disable systemd session (pam_systemd.so) as it will conflict with the
# pam_slurm_adopt.so module. What happens is that the shell is first adopted
# into the slurmstepd task and then into the systemd session, which is not
# what we want, otherwise it will linger even if all jobs are gone.
security.pam.services.sshd.startSession = lib.mkForce false;
}

View File

@ -17,6 +17,7 @@
./postgresql.nix
./nginx.nix
./p.nix
./ompss2-timer.nix
#./pxe.nix
];

View File

@ -29,6 +29,9 @@
};
};
# Allow gitea user to send mail
users.users.gitea.extraGroups = [ "mail-robot" ];
services.gitea-actions-runner.instances = {
runrun = {
enable = true;

View File

@ -1,8 +1,11 @@
{ config, lib, ... }:
{
# Robot user that can see the password to send mail from jungle-robot
users.groups.mail-robot = {};
age.secrets.jungleRobotPassword = {
file = ../../secrets/jungle-robot-password.age;
group = "gitea";
group = "mail-robot";
mode = "440";
};

View File

@ -4,8 +4,8 @@ let
name = "jungle-web";
src = pkgs.fetchgit {
url = "https://jungle.bsc.es/git/rarias/jungle-website.git";
rev = "739bf0175a7f05380fe7ad7023ff1d60db1710e1";
hash = "sha256-ea5DzhYTzZ9TmqD+x95rdNdLbxPnBluqlYH2NmBYmc4=";
rev = "52abaf4d71652a9ef77a0b098db14ca33bffff4c";
hash = "sha256-/ul9GazbOrOkmlvSgDz/+2W+V+ir5725Y7mVLc3rb0M=";
};
buildInputs = [ pkgs.hugo ];
buildPhase = ''

85
m/hut/ompss2-timer.nix Normal file
View File

@ -0,0 +1,85 @@
{ config, pkgs, ... }:
{
systemd.timers = {
"ompss2-closing" = {
wantedBy = [ "timers.target" ];
timerConfig = {
Unit = "ompss2-closing.service";
OnCalendar = [ "*-03-15 07:00:00" "*-09-15 07:00:00"];
};
};
"ompss2-freeze" = {
wantedBy = [ "timers.target" ];
timerConfig = {
Unit = "ompss2-freeze.service";
OnCalendar = [ "*-04-15 07:00:00" "*-10-15 07:00:00" ];
};
};
"ompss2-release" = {
wantedBy = [ "timers.target" ];
timerConfig = {
Unit = "ompss2-release.service";
OnCalendar = [ "*-05-15 07:00:00" "*-11-15 07:00:00" ];
};
};
};
systemd.services =
let
closing = pkgs.writeText "closing.txt"
''
Subject: OmpSs-2 release enters closing period
Hi,
You have one month to merge the remaining features for the next OmpSs-2
release. Please, identify what needs to be merged and discuss it in the next
OmpSs-2 meeting.
Thanks!,
Jungle robot
'';
freeze = pkgs.writeText "freeze.txt"
''
Subject: OmpSs-2 release enters freeze period
Hi,
The period to introduce new features or breaking changes is over, only bug
fixes are allowed now. During this time, please prepare the release notes
to be included in the next OmpSs-2 release.
Thanks!,
Jungle robot
'';
release = pkgs.writeText "release.txt"
''
Subject: OmpSs-2 release now
Hi,
The period to introduce bug fixes is now over. Please, proceed to do the
OmpSs-2 release.
Thanks!,
Jungle robot
'';
mkServ = name: mail: {
"ompss2-${name}" = {
script = ''
set -eu
set -o pipefail
cat ${mail} | ${config.security.wrapperDir}/sendmail star@bsc.es
'';
serviceConfig = {
Type = "oneshot";
DynamicUser = true;
Group = "mail-robot";
};
};
};
in
(mkServ "closing" closing) //
(mkServ "freeze" freeze) //
(mkServ "release" release);
}

357
m/module/agenix.nix Normal file
View File

@ -0,0 +1,357 @@
{
config,
options,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.age;
isDarwin = lib.attrsets.hasAttrByPath [ "environment" "darwinConfig" ] options;
ageBin = config.age.ageBin;
users = config.users.users;
sysusersEnabled =
if isDarwin then
false
else
options.systemd ? sysusers && (config.systemd.sysusers.enable || config.services.userborn.enable);
mountCommand =
if isDarwin then
''
if ! diskutil info "${cfg.secretsMountPoint}" &> /dev/null; then
num_sectors=1048576
dev=$(hdiutil attach -nomount ram://"$num_sectors" | sed 's/[[:space:]]*$//')
newfs_hfs -v agenix "$dev"
mount -t hfs -o nobrowse,nodev,nosuid,-m=0751 "$dev" "${cfg.secretsMountPoint}"
fi
''
else
''
grep -q "${cfg.secretsMountPoint} ramfs" /proc/mounts ||
mount -t ramfs none "${cfg.secretsMountPoint}" -o nodev,nosuid,mode=0751
'';
newGeneration = ''
_agenix_generation="$(basename "$(readlink ${cfg.secretsDir})" || echo 0)"
(( ++_agenix_generation ))
echo "[agenix] creating new generation in ${cfg.secretsMountPoint}/$_agenix_generation"
mkdir -p "${cfg.secretsMountPoint}"
chmod 0751 "${cfg.secretsMountPoint}"
${mountCommand}
mkdir -p "${cfg.secretsMountPoint}/$_agenix_generation"
chmod 0751 "${cfg.secretsMountPoint}/$_agenix_generation"
'';
chownGroup = if isDarwin then "admin" else "keys";
# chown the secrets mountpoint and the current generation to the keys group
# instead of leaving it root:root.
chownMountPoint = ''
chown :${chownGroup} "${cfg.secretsMountPoint}" "${cfg.secretsMountPoint}/$_agenix_generation"
'';
setTruePath = secretType: ''
${
if secretType.symlink then
''
_truePath="${cfg.secretsMountPoint}/$_agenix_generation/${secretType.name}"
''
else
''
_truePath="${secretType.path}"
''
}
'';
installSecret = secretType: ''
${setTruePath secretType}
echo "decrypting '${secretType.file}' to '$_truePath'..."
TMP_FILE="$_truePath.tmp"
IDENTITIES=()
for identity in ${toString cfg.identityPaths}; do
test -r "$identity" || continue
test -s "$identity" || continue
IDENTITIES+=(-i)
IDENTITIES+=("$identity")
done
test "''${#IDENTITIES[@]}" -eq 0 && echo "[agenix] WARNING: no readable identities found!"
mkdir -p "$(dirname "$_truePath")"
[ "${secretType.path}" != "${cfg.secretsDir}/${secretType.name}" ] && mkdir -p "$(dirname "${secretType.path}")"
(
umask u=r,g=,o=
test -f "${secretType.file}" || echo '[agenix] WARNING: encrypted file ${secretType.file} does not exist!'
test -d "$(dirname "$TMP_FILE")" || echo "[agenix] WARNING: $(dirname "$TMP_FILE") does not exist!"
LANG=${
config.i18n.defaultLocale or "C"
} ${ageBin} --decrypt "''${IDENTITIES[@]}" -o "$TMP_FILE" "${secretType.file}"
)
chmod ${secretType.mode} "$TMP_FILE"
mv -f "$TMP_FILE" "$_truePath"
${optionalString secretType.symlink ''
[ "${secretType.path}" != "${cfg.secretsDir}/${secretType.name}" ] && ln -sfT "${cfg.secretsDir}/${secretType.name}" "${secretType.path}"
''}
'';
testIdentities = map (path: ''
test -f ${path} || echo '[agenix] WARNING: config.age.identityPaths entry ${path} not present!'
'') cfg.identityPaths;
cleanupAndLink = ''
_agenix_generation="$(basename "$(readlink ${cfg.secretsDir})" || echo 0)"
(( ++_agenix_generation ))
echo "[agenix] symlinking new secrets to ${cfg.secretsDir} (generation $_agenix_generation)..."
ln -sfT "${cfg.secretsMountPoint}/$_agenix_generation" ${cfg.secretsDir}
(( _agenix_generation > 1 )) && {
echo "[agenix] removing old secrets (generation $(( _agenix_generation - 1 )))..."
rm -rf "${cfg.secretsMountPoint}/$(( _agenix_generation - 1 ))"
}
'';
installSecrets = builtins.concatStringsSep "\n" (
[ "echo '[agenix] decrypting secrets...'" ]
++ testIdentities
++ (map installSecret (builtins.attrValues cfg.secrets))
++ [ cleanupAndLink ]
);
chownSecret = secretType: ''
${setTruePath secretType}
chown ${secretType.owner}:${secretType.group} "$_truePath"
'';
chownSecrets = builtins.concatStringsSep "\n" (
[ "echo '[agenix] chowning...'" ]
++ [ chownMountPoint ]
++ (map chownSecret (builtins.attrValues cfg.secrets))
);
secretType = types.submodule (
{ config, ... }:
{
options = {
name = mkOption {
type = types.str;
default = config._module.args.name;
defaultText = literalExpression "config._module.args.name";
description = ''
Name of the file used in {option}`age.secretsDir`
'';
};
file = mkOption {
type = types.path;
description = ''
Age file the secret is loaded from.
'';
};
path = mkOption {
type = types.str;
default = "${cfg.secretsDir}/${config.name}";
defaultText = literalExpression ''
"''${cfg.secretsDir}/''${config.name}"
'';
description = ''
Path where the decrypted secret is installed.
'';
};
mode = mkOption {
type = types.str;
default = "0400";
description = ''
Permissions mode of the decrypted secret in a format understood by chmod.
'';
};
owner = mkOption {
type = types.str;
default = "0";
description = ''
User of the decrypted secret.
'';
};
group = mkOption {
type = types.str;
default = users.${config.owner}.group or "0";
defaultText = literalExpression ''
users.''${config.owner}.group or "0"
'';
description = ''
Group of the decrypted secret.
'';
};
symlink = mkEnableOption "symlinking secrets to their destination" // {
default = true;
};
};
}
);
in
{
imports = [
(mkRenamedOptionModule [ "age" "sshKeyPaths" ] [ "age" "identityPaths" ])
];
options.age = {
ageBin = mkOption {
type = types.str;
default = "${pkgs.age}/bin/age";
defaultText = literalExpression ''
"''${pkgs.age}/bin/age"
'';
description = ''
The age executable to use.
'';
};
secrets = mkOption {
type = types.attrsOf secretType;
default = { };
description = ''
Attrset of secrets.
'';
};
secretsDir = mkOption {
type = types.path;
default = "/run/agenix";
description = ''
Folder where secrets are symlinked to
'';
};
secretsMountPoint = mkOption {
type =
types.addCheck types.str (
s:
(builtins.match "[ \t\n]*" s) == null # non-empty
&& (builtins.match ".+/" s) == null
) # without trailing slash
// {
description = "${types.str.description} (with check: non-empty without trailing slash)";
};
default = "/run/agenix.d";
description = ''
Where secrets are created before they are symlinked to {option}`age.secretsDir`
'';
};
identityPaths = mkOption {
type = types.listOf types.path;
default =
if isDarwin then
[
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_rsa_key"
]
else if (config.services.openssh.enable or false) then
map (e: e.path) (
lib.filter (e: e.type == "rsa" || e.type == "ed25519") config.services.openssh.hostKeys
)
else
[ ];
defaultText = literalExpression ''
if isDarwin
then [
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_rsa_key"
]
else if (config.services.openssh.enable or false)
then map (e: e.path) (lib.filter (e: e.type == "rsa" || e.type == "ed25519") config.services.openssh.hostKeys)
else [];
'';
description = ''
Path to SSH keys to be used as identities in age decryption.
'';
};
};
config = mkIf (cfg.secrets != { }) (mkMerge [
{
assertions = [
{
assertion = cfg.identityPaths != [ ];
message = "age.identityPaths must be set, for example by enabling openssh.";
}
];
}
(optionalAttrs (!isDarwin) {
# When using sysusers we no longer be started as an activation script
# because those are started in initrd while sysusers is started later.
systemd.services.agenix-install-secrets = mkIf sysusersEnabled {
wantedBy = [ "sysinit.target" ];
after = [ "systemd-sysusers.service" ];
unitConfig.DefaultDependencies = "no";
path = [ pkgs.mount ];
serviceConfig = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "agenix-install" (concatLines [
newGeneration
installSecrets
chownSecrets
]);
RemainAfterExit = true;
};
};
# Create a new directory full of secrets for symlinking (this helps
# ensure removed secrets are actually removed, or at least become
# invalid symlinks).
system.activationScripts = mkIf (!sysusersEnabled) {
agenixNewGeneration = {
text = newGeneration;
deps = [
"specialfs"
];
};
agenixInstall = {
text = installSecrets;
deps = [
"agenixNewGeneration"
"specialfs"
];
};
# So user passwords can be encrypted.
users.deps = [ "agenixInstall" ];
# Change ownership and group after users and groups are made.
agenixChown = {
text = chownSecrets;
deps = [
"users"
"groups"
];
};
# So other activation scripts can depend on agenix being done.
agenix = {
text = "";
deps = [ "agenixChown" ];
};
};
})
(optionalAttrs isDarwin {
launchd.daemons.activate-agenix = {
script = ''
set -e
set -o pipefail
export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin:/usr/sbin:/sbin"
${newGeneration}
${installSecrets}
${chownSecrets}
exit 0
'';
serviceConfig = {
RunAtLoad = true;
KeepAlive.SuccessfulExit = false;
};
};
})
]);
}

View File

@ -1,4 +1,4 @@
{ lib, ... }:
{ lib, pkgs, ... }:
{
imports = [
@ -21,4 +21,20 @@
};
services.slurm.client.enable = true;
# Only allow SSH connections from users who have a SLURM allocation
# See: https://slurm.schedmd.com/pam_slurm_adopt.html
security.pam.services.sshd.rules.account.slurm = {
control = "required";
enable = true;
modulePath = "${pkgs.slurm}/lib/security/pam_slurm_adopt.so";
args = [ "log_level=debug5" ];
order = 999999; # Make it last one
};
# Disable systemd session (pam_systemd.so) as it will conflict with the
# pam_slurm_adopt.so module. What happens is that the shell is first adopted
# into the slurmstepd task and then into the systemd session, which is not
# what we want, otherwise it will linger even if all jobs are gone.
security.pam.services.sshd.startSession = lib.mkForce false;
}

View File

@ -1,31 +1,6 @@
{ config, pkgs, ... }:
let
suspendProgram = pkgs.writeShellScript "suspend.sh" ''
exec 1>>/var/log/power_save.log 2>>/var/log/power_save.log
set -x
export "PATH=/run/current-system/sw/bin:$PATH"
echo "$(date) Suspend invoked $0 $*" >> /var/log/power_save.log
hosts=$(scontrol show hostnames $1)
for host in $hosts; do
echo Shutting down host: $host
ipmitool -I lanplus -H ''${host}-ipmi -P "" -U "" chassis power off
done
'';
resumeProgram = pkgs.writeShellScript "resume.sh" ''
exec 1>>/var/log/power_save.log 2>>/var/log/power_save.log
set -x
export "PATH=/run/current-system/sw/bin:$PATH"
echo "$(date) Suspend invoked $0 $*" >> /var/log/power_save.log
hosts=$(scontrol show hostnames $1)
for host in $hosts; do
echo Starting host: $host
ipmitool -I lanplus -H ''${host}-ipmi -P "" -U "" chassis power on
done
'';
in {
{
services.slurm = {
controlMachine = "apex";
clusterName = "jungle";
@ -59,16 +34,6 @@ in {
# the resources. Use the task/cgroup plugin to enable process containment.
TaskPlugin=task/affinity,task/cgroup
# Power off unused nodes until they are requested
SuspendProgram=${suspendProgram}
SuspendTimeout=60
ResumeProgram=${resumeProgram}
ResumeTimeout=300
SuspendExcNodes=fox
# Turn the nodes off after 1 hour of inactivity
SuspendTime=3600
# Reduce port range so we can allow only this range in the firewall
SrunPortRange=60000-61000
@ -86,9 +51,7 @@ in {
# when a task runs (srun) so we can ssh early.
PrologFlags=Alloc,Contain,X11
# LaunchParameters=ulimit_pam_adopt will set RLIMIT_RSS in processes
# adopted by the external step, similar to tasks running in regular steps
# LaunchParameters=ulimit_pam_adopt
LaunchParameters=use_interactive_step
SlurmdDebug=debug5
#DebugFlags=Protocol,Cgroup
'';

View File

@ -4,8 +4,8 @@ let
name = "jungle-web";
src = pkgs.fetchgit {
url = "https://jungle.bsc.es/git/rarias/jungle-website.git";
rev = "739bf0175a7f05380fe7ad7023ff1d60db1710e1";
hash = "sha256-ea5DzhYTzZ9TmqD+x95rdNdLbxPnBluqlYH2NmBYmc4=";
rev = "52abaf4d71652a9ef77a0b098db14ca33bffff4c";
hash = "sha256-/ul9GazbOrOkmlvSgDz/+2W+V+ir5725Y7mVLc3rb0M=";
};
buildInputs = [ pkgs.hugo ];
buildPhase = ''

View File

@ -7,6 +7,7 @@ let
callPackage = final.callPackage;
bscPkgs = {
agenix = prev.callPackage ./pkgs/agenix/default.nix { };
amd-uprof = prev.callPackage ./pkgs/amd-uprof/default.nix { };
bench6 = callPackage ./pkgs/bench6/default.nix { };
bigotes = callPackage ./pkgs/bigotes/default.nix { };
@ -36,6 +37,7 @@ let
nanos6 = callPackage ./pkgs/nanos6/default.nix { };
nanos6Debug = final.nanos6.override { enableDebug = true; };
nixtools = callPackage ./pkgs/nixtools/default.nix { };
nixgen = callPackage ./pkgs/nixgen/default.nix { };
# Broken because of pkgsStatic.libcap
# See: https://github.com/NixOS/nixpkgs/pull/268791
#nix-wrap = callPackage ./pkgs/nix-wrap/default.nix { };
@ -50,6 +52,7 @@ let
prometheus-slurm-exporter = prev.callPackage ./pkgs/slurm-exporter/default.nix { };
#pscom = callPackage ./pkgs/parastation/pscom.nix { }; # Unmaintaned
#psmpi = callPackage ./pkgs/parastation/psmpi.nix { }; # Unmaintaned
slurm = import ./pkgs/slurm/default.nix { slurm = prev.slurm; };
sonar = callPackage ./pkgs/sonar/default.nix { };
stdenvClangOmpss2 = final.stdenv.override { cc = final.clangOmpss2; allowedRequisites = null; };
stdenvClangOmpss2Nanos6 = final.stdenv.override { cc = final.clangOmpss2Nanos6; allowedRequisites = null; };
@ -98,14 +101,16 @@ let
pkgsTopLevel = filterAttrs (_: isDerivation) bscPkgs;
# Native build in that platform doesn't imply cross build works
canCrossCompile = platform: pkg:
canCrossCompile = platform: default: pkg:
(isDerivation pkg) &&
# Must be defined explicitly
(pkg.meta.cross or false) &&
(meta.availableOn platform pkg);
# If meta.cross is undefined, use default
(pkg.meta.cross or default) &&
(meta.availableOn final.pkgsCross.${platform}.stdenv.hostPlatform pkg);
# For now only RISC-V
crossSet = { riscv64 = final.pkgsCross.riscv64.bsc.pkgsTopLevel; };
crossSet = genAttrs [ "riscv64" ] (platform:
filterAttrs (_: canCrossCompile platform true)
final.pkgsCross.${platform}.bsc.pkgsTopLevel);
buildList = name: paths:
final.runCommandLocal name { } ''
@ -125,7 +130,7 @@ let
# For now only RISC-V
crossList = buildList "ci-cross"
(filter
(canCrossCompile final.pkgsCross.riscv64.stdenv.hostPlatform)
(canCrossCompile "riscv64" false) # opt-in (pkgs with: meta.cross = true)
(builtins.attrValues crossSet.riscv64));
in bscPkgs // {

212
pkgs/agenix/agenix.sh Normal file
View File

@ -0,0 +1,212 @@
#!/usr/bin/env bash
set -Eeuo pipefail
PACKAGE="agenix"
function show_help () {
echo "$PACKAGE - edit and rekey age secret files"
echo " "
echo "$PACKAGE -e FILE [-i PRIVATE_KEY]"
echo "$PACKAGE -r [-i PRIVATE_KEY]"
echo ' '
echo 'options:'
echo '-h, --help show help'
# shellcheck disable=SC2016
echo '-e, --edit FILE edits FILE using $EDITOR'
echo '-r, --rekey re-encrypts all secrets with specified recipients'
echo '-d, --decrypt FILE decrypts FILE to STDOUT'
echo '-i, --identity identity to use when decrypting'
echo '-v, --verbose verbose output'
echo ' '
echo 'FILE an age-encrypted file'
echo ' '
echo 'PRIVATE_KEY a path to a private SSH key used to decrypt file'
echo ' '
echo 'EDITOR environment variable of editor to use when editing FILE'
echo ' '
echo 'If STDIN is not interactive, EDITOR will be set to "cp /dev/stdin"'
echo ' '
echo 'RULES environment variable with path to Nix file specifying recipient public keys.'
echo "Defaults to './secrets.nix'"
echo ' '
echo "agenix version: @version@"
echo "age binary path: @ageBin@"
echo "age version: $(@ageBin@ --version)"
}
function warn() {
printf '%s\n' "$*" >&2
}
function err() {
warn "$*"
exit 1
}
test $# -eq 0 && (show_help && exit 1)
REKEY=0
DECRYPT_ONLY=0
DEFAULT_DECRYPT=(--decrypt)
while test $# -gt 0; do
case "$1" in
-h|--help)
show_help
exit 0
;;
-e|--edit)
shift
if test $# -gt 0; then
export FILE=$1
else
echo "no FILE specified"
exit 1
fi
shift
;;
-i|--identity)
shift
if test $# -gt 0; then
DEFAULT_DECRYPT+=(--identity "$1")
else
echo "no PRIVATE_KEY specified"
exit 1
fi
shift
;;
-r|--rekey)
shift
REKEY=1
;;
-d|--decrypt)
shift
DECRYPT_ONLY=1
if test $# -gt 0; then
export FILE=$1
else
echo "no FILE specified"
exit 1
fi
shift
;;
-v|--verbose)
shift
set -x
;;
*)
show_help
exit 1
;;
esac
done
RULES=${RULES:-./secrets.nix}
function cleanup {
if [ -n "${CLEARTEXT_DIR+x}" ]
then
rm -rf -- "$CLEARTEXT_DIR"
fi
if [ -n "${REENCRYPTED_DIR+x}" ]
then
rm -rf -- "$REENCRYPTED_DIR"
fi
}
trap "cleanup" 0 2 3 15
function keys {
(@nixInstantiate@ --json --eval --strict -E "(let rules = import $RULES; in rules.\"$1\".publicKeys)" | @jqBin@ -r .[]) || exit 1
}
function armor {
(@nixInstantiate@ --json --eval --strict -E "(let rules = import $RULES; in (builtins.hasAttr \"armor\" rules.\"$1\" && rules.\"$1\".armor))") || exit 1
}
function decrypt {
FILE=$1
KEYS=$2
if [ -z "$KEYS" ]
then
err "There is no rule for $FILE in $RULES."
fi
if [ -f "$FILE" ]
then
DECRYPT=("${DEFAULT_DECRYPT[@]}")
if [[ "${DECRYPT[*]}" != *"--identity"* ]]; then
if [ -f "$HOME/.ssh/id_rsa" ]; then
DECRYPT+=(--identity "$HOME/.ssh/id_rsa")
fi
if [ -f "$HOME/.ssh/id_ed25519" ]; then
DECRYPT+=(--identity "$HOME/.ssh/id_ed25519")
fi
fi
if [[ "${DECRYPT[*]}" != *"--identity"* ]]; then
err "No identity found to decrypt $FILE. Try adding an SSH key at $HOME/.ssh/id_rsa or $HOME/.ssh/id_ed25519 or using the --identity flag to specify a file."
fi
@ageBin@ "${DECRYPT[@]}" -- "$FILE" || exit 1
fi
}
function edit {
FILE=$1
KEYS=$(keys "$FILE") || exit 1
ARMOR=$(armor "$FILE") || exit 1
CLEARTEXT_DIR=$(@mktempBin@ -d)
CLEARTEXT_FILE="$CLEARTEXT_DIR/$(basename -- "$FILE")"
DEFAULT_DECRYPT+=(-o "$CLEARTEXT_FILE")
decrypt "$FILE" "$KEYS" || exit 1
[ ! -f "$CLEARTEXT_FILE" ] || cp -- "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before"
[ -t 0 ] || EDITOR='cp -- /dev/stdin'
$EDITOR "$CLEARTEXT_FILE"
if [ ! -f "$CLEARTEXT_FILE" ]
then
warn "$FILE wasn't created."
return
fi
[ -f "$FILE" ] && [ "$EDITOR" != ":" ] && @diffBin@ -q -- "$CLEARTEXT_FILE.before" "$CLEARTEXT_FILE" && warn "$FILE wasn't changed, skipping re-encryption." && return
ENCRYPT=()
if [[ "$ARMOR" == "true" ]]; then
ENCRYPT+=(--armor)
fi
while IFS= read -r key
do
if [ -n "$key" ]; then
ENCRYPT+=(--recipient "$key")
fi
done <<< "$KEYS"
REENCRYPTED_DIR=$(@mktempBin@ -d)
REENCRYPTED_FILE="$REENCRYPTED_DIR/$(basename -- "$FILE")"
ENCRYPT+=(-o "$REENCRYPTED_FILE")
@ageBin@ "${ENCRYPT[@]}" <"$CLEARTEXT_FILE" || exit 1
mkdir -p -- "$(dirname -- "$FILE")"
mv -f -- "$REENCRYPTED_FILE" "$FILE"
}
function rekey {
FILES=$( (@nixInstantiate@ --json --eval -E "(let rules = import $RULES; in builtins.attrNames rules)" | @jqBin@ -r .[]) || exit 1)
for FILE in $FILES
do
warn "rekeying $FILE..."
EDITOR=: edit "$FILE"
cleanup
done
}
[ $REKEY -eq 1 ] && rekey && exit 0
[ $DECRYPT_ONLY -eq 1 ] && DEFAULT_DECRYPT+=("-o" "-") && decrypt "${FILE}" "$(keys "$FILE")" && exit 0
edit "$FILE" && cleanup && exit 0

66
pkgs/agenix/default.nix Normal file
View File

@ -0,0 +1,66 @@
{
lib,
stdenv,
age,
jq,
nix,
mktemp,
diffutils,
replaceVars,
ageBin ? "${age}/bin/age",
shellcheck,
}:
let
bin = "${placeholder "out"}/bin/agenix";
in
stdenv.mkDerivation rec {
pname = "agenix";
version = "0.15.0";
src = replaceVars ./agenix.sh {
inherit ageBin version;
jqBin = "${jq}/bin/jq";
nixInstantiate = "${nix}/bin/nix-instantiate";
mktempBin = "${mktemp}/bin/mktemp";
diffBin = "${diffutils}/bin/diff";
};
dontUnpack = true;
doInstallCheck = true;
installCheckInputs = [ shellcheck ];
postInstallCheck = ''
shellcheck ${bin}
${bin} -h | grep ${version}
test_tmp=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
export HOME="$test_tmp/home"
export NIX_STORE_DIR="$test_tmp/nix/store"
export NIX_STATE_DIR="$test_tmp/nix/var"
mkdir -p "$HOME" "$NIX_STORE_DIR" "$NIX_STATE_DIR"
function cleanup {
rm -rf "$test_tmp"
}
trap "cleanup" 0 2 3 15
mkdir -p $HOME/.ssh
cp -r "${./example}" $HOME/secrets
chmod -R u+rw $HOME/secrets
(
umask u=rw,g=r,o=r
cp ${./example_keys/user1.pub} $HOME/.ssh/id_ed25519.pub
chown $UID $HOME/.ssh/id_ed25519.pub
)
(
umask u=rw,g=,o=
cp ${./example_keys/user1} $HOME/.ssh/id_ed25519
chown $UID $HOME/.ssh/id_ed25519
)
cd $HOME/secrets
test $(${bin} -d secret1.age) = "hello"
'';
installPhase = ''
install -D $src ${bin}
'';
meta.description = "age-encrypted secrets for NixOS";
}

View File

@ -0,0 +1,7 @@
age-encryption.org/v1
-> ssh-ed25519 V3XmEA zirqdzZZ1E+sedBn7fbEHq4ntLEkokZ4GctarBBOHXY
Rvs5YHaAUeCZyNwPedubPcHClWYIuXXWA5zadXPWY6w
-> ssh-ed25519 KLPP8w BVp4rDkOYSQyn8oVeHFeinSqW+pdVtxBF9+5VM1yORY
bMwppAi8Nhz0328taU4AzUkTVyWtSLvFZG6c5W/Fs78
--- xCbqLhXAcOziO2wmbjTiSQfZvt5Rlsc4SCvF+iEzpQA
ôKB£î/²ZÅÈrÙ%¾à4¡´—Mq5×Ô_ÌÂ݆ã„Ò11 ܨqM;& ¢‡LríÂÒføû”]>N

View File

@ -0,0 +1,7 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFYzWG1FQSBpZkZW
aFpLNnJxc0VUMHRmZ2dZS0pjMGVENnR3OHd5K0RiT1RjRUhibFZBCnN5UG5vUjA3
SXpsNGtiVUw4T0tIVFo5Wkk5QS9NQlBndzVvektiQ0ozc0kKLS0tIGxyY1Q4dEZ1
VGZEanJyTFNta2JNRmpZb2FnK2JyS1hSVml1UGdMNWZKQXMKYla+wTXcRedyZoEb
LVWaSx49WoUTU0KBPJg9RArxaeC23GoCDzR/aM/1DvYU
-----END AGE ENCRYPTED FILE-----

View File

@ -0,0 +1,9 @@
age-encryption.org/v1
-> ssh-ed25519 KLPP8w s1DYZRlZuSsyhmZCF1lFB+E9vB8bZ/+ZhBRlx8nprwE
nmYVCsVBrX2CFXXPU+D+bbkkIe/foofp+xoUrg9DHZw
-> ssh-ed25519 V3XmEA Pwv3oCwcY0DX8rY48UNfsj9RumWsn4dbgorYHCwObgI
FKxRYkL3JHtJxUwymWDF0rAtJ33BivDI6IfPsfumM90
-> V'v(/u$-grease em/Vgf 2qDuk
7I3iiQLPGi1COML9u/JeYkr7EqbSLoU
--- 57WJRigUGtmcObrssS3s4PvmR8wgh1AOC/ijJn1s3xI
<EFBFBD>'K©Æ·Y&7GÆOÝòFj±kÆXç«BnuJöê:9Ê(ÙÏX¬#¼AíÄÞÃÚ§j,ê_ÈþÝ?ÝZ“¥vœ¹V96]oks~%£c Îe^CÅ%JQ5€<H¢z}îCý,°pŒ¿*!W§§ÈA±º­Ò…dC¼K)¿¢-žy

Binary file not shown.

View File

@ -0,0 +1,5 @@
age-encryption.org/v1
-> ssh-ed25519 V3XmEA OB4+1FbPhQ3r6iGksM7peWX5it8NClpXIq/o5nnP7GA
FmHVUj+A5i5+bDFgySQskmlvynnosJiWUTJmBRiNA9I
--- tP+3mFVtd7ogVu1Lkboh55zoi5a77Ht08Uc/QuIviv4
¤¬Xæ{”ïOŠ£èätMXxÔvÓª(¬IÁmyPÇï¸è+3²S3i

View File

@ -0,0 +1,23 @@
let
user1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0idNvgGiucWgup/mP78zyC23uFjYq0evcWdjGQUaBH";
system1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJDyIr/FSz1cJdcoW69R+NrWzwGK/+3gJpqD1t8L2zE";
in
{
"secret1.age".publicKeys = [
user1
system1
];
"secret2.age".publicKeys = [ user1 ];
"passwordfile-user1.age".publicKeys = [
user1
system1
];
"-leading-hyphen-filename.age".publicKeys = [
user1
system1
];
"armored-secret.age" = {
publicKeys = [ user1 ];
armor = true;
};
}

View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACDyQ8iK/xUs9XCXXKFuvUfja1s8Biv/t4Caag9bfC9sxAAAAJA3yvCWN8rw
lgAAAAtzc2gtZWQyNTUxOQAAACDyQ8iK/xUs9XCXXKFuvUfja1s8Biv/t4Caag9bfC9sxA
AAAEA+J2V6AG1NriAIvnNKRauIEh1JE9HSdhvKJ68a5Fm0w/JDyIr/FSz1cJdcoW69R+Nr
WzwGK/+3gJpqD1t8L2zEAAAADHJ5YW50bUBob21lMQE=
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJDyIr/FSz1cJdcoW69R+NrWzwGK/+3gJpqD1t8L2zE

View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACC9InTb4BornFoLqf5j+/M8gtt7hY2KtHr3FnYxkFGgRwAAAJC2JJ8htiSf
IQAAAAtzc2gtZWQyNTUxOQAAACC9InTb4BornFoLqf5j+/M8gtt7hY2KtHr3FnYxkFGgRw
AAAEDxt5gC/s53IxiKAjfZJVCCcFIsdeERdIgbYhLO719+Kb0idNvgGiucWgup/mP78zyC
23uFjYq0evcWdjGQUaBHAAAADHJ5YW50bUBob21lMQE=
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0idNvgGiucWgup/mP78zyC23uFjYq0evcWdjGQUaBH

23
pkgs/agenix/update.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e
# All operations are done relative to root
GITROOT=$(git rev-parse --show-toplevel)
cd "$GITROOT"
REVISION=${1:-main}
TMPCLONE=$(mktemp -d)
trap "rm -rf ${TMPCLONE}" EXIT
git clone https://github.com/ryantm/agenix.git --revision="$REVISION" "$TMPCLONE" --depth=1
cp "${TMPCLONE}/pkgs/agenix.sh" pkgs/agenix/agenix.sh
cp "${TMPCLONE}/pkgs/agenix.nix" pkgs/agenix/default.nix
sed -i 's#../example#./example#' pkgs/agenix/default.nix
cp "${TMPCLONE}/example/"* pkgs/agenix/example/
cp "${TMPCLONE}/example_keys/"* pkgs/agenix/example_keys/
cp "${TMPCLONE}/modules/age.nix" m/module/agenix.nix

View File

@ -90,7 +90,7 @@ in
meta = {
description = "Performance analysis tool-suite for x86 based applications";
homepage = "https://www.amd.com/es/developer/uprof.html";
platforms = lib.platforms.linux;
platforms = [ "x86_64-linux" ];
license = lib.licenses.unfree;
maintainers = with lib.maintainers.bsc; [ rarias varcila ];
};

View File

@ -0,0 +1,25 @@
{ stdenv, lib, fetchurl, pkg-config, glib, libuuid, popt, elfutils, swig4, python3 }:
stdenv.mkDerivation rec {
name = "babeltrace-1.5.8";
src = fetchurl {
url = "https://www.efficios.com/files/babeltrace/${name}.tar.bz2";
sha256 = "1hkg3phnamxfrhwzmiiirbhdgckzfkqwhajl0lmr1wfps7j47wcz";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ glib libuuid popt elfutils swig4 python3 ];
meta = with lib; {
description = "Command-line tool and library to read and convert LTTng tracefiles";
homepage = "https://www.efficios.com/babeltrace";
license = licenses.mit;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
configureFlags = [
"--enable-python-bindings"
];
}

View File

@ -0,0 +1,34 @@
{
stdenv
, fetchurl
, pkg-config
, glib
, libuuid
, popt
, elfutils
, python3
, swig4
, ncurses
, breakpointHook
}:
stdenv.mkDerivation rec {
pname = "babeltrace2";
version = "2.0.3";
src = fetchurl {
url = "https://www.efficios.com/files/babeltrace/${pname}-${version}.tar.bz2";
sha256 = "1804pyq7fz6rkcz4r1abkkn0pfnss13m6fd8if32s42l4lajadm5";
};
enableParallelBuilding = true;
nativeBuildInputs = [ pkg-config ];
buildInputs = [ glib libuuid popt elfutils python3 swig4 ncurses breakpointHook ];
hardeningDisable = [ "all" ];
configureFlags = [
"--enable-python-plugins"
"--enable-python-bindings"
];
}

54
pkgs/clsync/default.nix Normal file
View File

@ -0,0 +1,54 @@
{ stdenv
, fetchFromGitHub
, libcap
, libcgroup
, libmhash
, doxygen
, graphviz
, autoreconfHook
, pkg-config
, glib
}:
let
version = "0.4.4";
in stdenv.mkDerivation {
pname = "clsync";
inherit version;
src = fetchFromGitHub {
repo = "clsync";
owner = "clsync";
rev = "v${version}";
sha256 = "0sdiyfwp0iqr6l1sirm51pirzmhi4jzgky5pzfj24nn71q3fwqgz";
};
outputs = [ "out" "dev" ];
buildInputs = [
autoreconfHook
libcap
libcgroup
libmhash
doxygen
graphviz
pkg-config
glib
];
preConfigure = ''
./configure --help
'';
enableParallelBuilding = true;
meta = with lib; {
description = "File live sync daemon based on inotify/kqueue/bsm (Linux, FreeBSD), written in GNU C";
homepage = "https://github.com/clsync/clsync";
license = licenses.gpl3Plus;
maintainers = [ ];
platforms = platforms.linux;
};
}

51
pkgs/cn6/default.nix Normal file
View File

@ -0,0 +1,51 @@
{
stdenv
, lib
, babeltrace2
, pkg-config
, uthash
, enableTest ? false
, mpi ? null
, clangOmpss2 ? null
, tampi ? null
}:
with lib;
assert (enableTest -> (mpi != null));
assert (enableTest -> (clangOmpss2 != null));
assert (enableTest -> (tampi != null));
stdenv.mkDerivation rec {
pname = "cn6";
version = "${src.shortRev}";
buildInputs = [
babeltrace2
pkg-config
uthash
mpi
] ++ optionals (enableTest) [ mpi clangOmpss2 tampi ];
src = builtins.fetchGit {
url = "ssh://git@bscpm04.bsc.es/rarias/cn6.git";
ref = "master";
rev = "c72c3b66b720c2a33950f536fc819051c8f20a69";
};
makeFlags = [ "PREFIX=$(out)" ];
postBuild = optionalString (enableTest) ''
(
cd test
make timediff timediff_mpi
)
'';
postInstall = optionalString (enableTest) ''
(
cd test
cp timediff timediff_mpi sync-err.sh $out/bin/
)
'';
}

21
pkgs/cpuid/default.nix Normal file
View File

@ -0,0 +1,21 @@
{
stdenv
, perl # For the pod2man command
}:
stdenv.mkDerivation rec {
version = "20201006";
pname = "cpuid";
buildInputs = [ perl ];
# Replace /usr install directory for $out
postPatch = ''
sed -i "s@/usr@$out@g" Makefile
'';
src = builtins.fetchTarball {
url = "http://www.etallen.com/cpuid/${pname}-${version}.src.tar.gz";
sha256 = "04qhs938gs1kjxpsrnfy6lbsircsprfyh4db62s5cf83a1nrwn9w";
};
}

View File

@ -1,5 +1,6 @@
{
stdenv
, lib
, cudatoolkit
, cudaPackages
, autoAddDriverRunpath
@ -40,4 +41,9 @@ stdenv.mkDerivation (finalAttrs: {
'';
installPhase = "touch $out";
};
meta = {
platforms = [ "x86_64-linux" ];
maintainers = with lib.maintainers.bsc; [ rarias ];
};
})

25
pkgs/dummy/default.nix Normal file
View File

@ -0,0 +1,25 @@
{
stdenv
}:
stdenv.mkDerivation rec {
name = "dummy";
src = null;
dontUnpack = true;
dontBuild = true;
programPath = "/bin/dummy";
installPhase = ''
mkdir -p $out/bin
cat > $out/bin/dummy <<EOF
#!/bin/sh
echo Hello worlda!
EOF
chmod +x $out/bin/dummy
'';
}

58
pkgs/fftw/default.nix Normal file
View File

@ -0,0 +1,58 @@
{ fetchurl, stdenv, lib, llvmPackages ? null, precision ? "double", perl, mpi }:
with lib;
assert stdenv.cc.isClang -> llvmPackages != null;
assert elem precision [ "single" "double" "long-double" "quad-precision" ];
let
version = "3.3.8";
withDoc = stdenv.cc.isGNU;
in
stdenv.mkDerivation {
name = "fftw-${precision}-${version}";
src = fetchurl {
urls = [
"http://fftw.org/fftw-${version}.tar.gz"
"ftp://ftp.fftw.org/pub/fftw/fftw-${version}.tar.gz"
];
sha256 = "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1";
};
outputs = [ "out" "dev" "man" ]
++ optional withDoc "info"; # it's dev-doc only
outputBin = "dev"; # fftw-wisdom
buildInputs = [ mpi ]
++ lib.optionals stdenv.cc.isClang [
# TODO: This may mismatch the LLVM version sin the stdenv, see #79818.
llvmPackages.openmp
];
configureFlags =
[ "--enable-shared"
"--enable-threads"
"--enable-mpi"
"--disable-openmp"
]
++ optional (precision != "double") "--enable-${precision}"
# all x86_64 have sse2
# however, not all float sizes fit
++ optional (stdenv.isx86_64 && (precision == "single" || precision == "double") ) "--enable-sse2"
# doc generation causes Fortran wrapper generation which hard-codes gcc
++ optional (!withDoc) "--disable-doc";
enableParallelBuilding = true;
checkInputs = [ perl ];
meta = with lib; {
description = "Fastest Fourier Transform in the West library";
homepage = "http://www.fftw.org/";
license = licenses.gpl2Plus;
maintainers = [ maintainers.spwhitt ];
platforms = platforms.unix;
};
}

View File

@ -9,7 +9,6 @@
, automake
, libtool
, mpi
, rsync
, gfortran
}:
@ -44,13 +43,24 @@ stdenv.mkDerivation rec {
configureFlags = [
"--with-infiniband=${rdma-core-all}"
"--with-mpi=${mpiAll}"
"--with-mpi=yes" # fixes mpi detection when cross-compiling
"--with-slurm"
"CFLAGS=-fPIC"
"CXXFLAGS=-fPIC"
];
buildInputs = [ slurm mpiAll rdma-core-all autoconf automake libtool rsync gfortran ];
nativeBuildInputs = [
autoconf
automake
gfortran
libtool
];
buildInputs = [
slurm
mpiAll
rdma-core-all
];
hardeningDisable = [ "all" ];
@ -60,5 +70,6 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl3Plus;
cross = false; # infiniband detection does not work
};
}

View File

@ -0,0 +1,46 @@
From 1454525f70b43a6957b7c9e1870e997368787da3 Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Fri, 8 Nov 2019 21:59:21 -0500
Subject: [PATCH] Fix cross-compilation by looking for `ar`.
---
Makefile.am | 2 +-
configure.ac | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index d18c49b8..b1b53338 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -494,7 +494,7 @@ CCC=@CXX@
# INSTALL_INFO
# LN_S
-AR=ar
+AR=@AR@
ETAGS=etags
ETAGSFLAGS=
# Flag that tells etags to assume C++.
diff --git a/configure.ac b/configure.ac
index 28e75f17..2449b9f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,7 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([src/include/config.h:src/include/config.hin])
AC_CONFIG_SRCDIR([src/roff/groff/groff.cpp])
+AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
@@ -72,6 +73,7 @@ GROFF_DOC_CHECK
GROFF_MAKEINFO
GROFF_TEXI2DVI
AC_PROG_RANLIB
+AC_CHECK_TOOL([AR], [ar], [ar])
GROFF_INSTALL_SH
GROFF_INSTALL_INFO
AC_PROG_INSTALL
--
2.23.0

127
pkgs/groff/default.nix Normal file
View File

@ -0,0 +1,127 @@
{ stdenv, lib, fetchurl, perl
, ghostscript #for postscript and html output
, psutils, netpbm #for html output
, buildPackages
, autoreconfHook
, pkg-config
, texinfo
}:
stdenv.mkDerivation rec {
pname = "groff";
version = "1.22.4";
src = fetchurl {
url = "mirror://gnu/groff/${pname}-${version}.tar.gz";
sha256 = "14q2mldnr1vx0l9lqp9v2f6iww24gj28iyh4j2211hyynx67p3p7";
};
enableParallelBuilding = false;
patches = [
./0001-Fix-cross-compilation-by-looking-for-ar.patch
];
postPatch = lib.optionalString (psutils != null) ''
substituteInPlace src/preproc/html/pre-html.cpp \
--replace "psselect" "${psutils}/bin/psselect"
'' + lib.optionalString (netpbm != null) ''
substituteInPlace src/preproc/html/pre-html.cpp \
--replace "pnmcut" "${lib.getBin netpbm}/bin/pnmcut" \
--replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
--replace "pnmtopng" "${lib.getBin netpbm}/bin/pnmtopng"
substituteInPlace tmac/www.tmac.in \
--replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
--replace "pngtopnm" "${lib.getBin netpbm}/bin/pngtopnm" \
--replace "@PNMTOPS_NOSETPAGE@" "${lib.getBin netpbm}/bin/pnmtops -nosetpage"
'';
buildInputs = [ ghostscript psutils netpbm perl ];
nativeBuildInputs = [ autoreconfHook pkg-config texinfo ];
# Builds running without a chroot environment may detect the presence
# of /usr/X11 in the host system, leading to an impure build of the
# package. To avoid this issue, X11 support is explicitly disabled.
# Note: If we ever want to *enable* X11 support, then we'll probably
# have to pass "--with-appresdir", too.
configureFlags = [
"--without-x"
] ++ lib.optionals (ghostscript != null) [
"--with-gs=${ghostscript}/bin/gs"
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
"ac_cv_path_PERL=${buildPackages.perl}/bin/perl"
];
makeFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
# Trick to get the build system find the proper 'native' groff
# http://www.mail-archive.com/bug-groff@gnu.org/msg01335.html
"GROFF_BIN_PATH=${buildPackages.groff}/bin"
"GROFFBIN=${buildPackages.groff}/bin/groff"
];
doCheck = true;
postInstall = ''
for f in 'man.local' 'mdoc.local'; do
cat '${./site.tmac}' >>"$out/share/groff/site-tmac/$f"
done
moveToOutput bin/gropdf $out
moveToOutput bin/pdfmom $out
moveToOutput bin/roff2text $out
moveToOutput bin/roff2pdf $out
moveToOutput bin/roff2ps $out
moveToOutput bin/roff2dvi $out
moveToOutput bin/roff2ps $out
moveToOutput bin/roff2html $out
moveToOutput bin/glilypond $out
moveToOutput bin/mmroff $out
moveToOutput bin/roff2x $out
moveToOutput bin/afmtodit $out
moveToOutput bin/gperl $out
moveToOutput bin/chem $out
moveToOutput share/groff/${version}/font/devpdf $out
# idk if this is needed, but Fedora does it
moveToOutput share/groff/${version}/tmac/pdf.tmac $out
moveToOutput bin/gpinyin $out
moveToOutput lib/groff/gpinyin $out
substituteInPlace $out/bin/gpinyin \
--replace $out/lib/groff/gpinyin $out/lib/groff/gpinyin
moveToOutput bin/groffer $out
moveToOutput lib/groff/groffer $out
substituteInPlace $out/bin/groffer \
--replace $out/lib/groff/groffer $out/lib/groff/groffer
moveToOutput bin/grog $out
moveToOutput lib/groff/grog $out
substituteInPlace $out/bin/grog \
--replace $out/lib/groff/grog $out/lib/groff/grog
'' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
find $out/ -type f -print0 | xargs --null sed -i 's|${buildPackages.perl}|${perl}|'
'';
meta = with lib; {
homepage = "https://www.gnu.org/software/groff/";
description = "GNU Troff, a typesetting package that reads plain text and produces formatted output";
license = licenses.gpl3Plus;
platforms = platforms.all;
maintainers = with maintainers; [ pSub ];
longDescription = ''
groff is the GNU implementation of troff, a document formatting
system. Included in this release are implementations of troff,
pic, eqn, tbl, grn, refer, -man, -mdoc, -mom, and -ms macros,
and drivers for PostScript, TeX dvi format, HP LaserJet 4
printers, Canon CAPSL printers, HTML and XHTML format (beta
status), and typewriter-like devices. Also included is a
modified version of the Berkeley -me macros, the enhanced
version gxditview of the X11 xditview previewer, and an
implementation of the -mm macros.
'';
};
}

16
pkgs/groff/site.tmac Normal file
View File

@ -0,0 +1,16 @@
.
.if n \{\
. \" Character translations for non-keyboard
. \" characters - to make them searchable
. if '\*[.T]'utf8' \{\
. char \- \N'45'
. char - \N'45'
. char ' \N'39'
. char \' \N'39'
. \}
.
. \" Shut off SGR by default (groff colors)
. \" Require GROFF_SGR envvar defined to turn it on
. if '\V[GROFF_SGR]'' \
. output x X tty: sgr 0
.\}

View File

@ -0,0 +1,70 @@
{ stdenv, lib, fetchurl, pkg-config, expat, ncurses
, pciutils, numactl }:
with lib;
stdenv.mkDerivation rec {
name = "hwloc-1.11.6";
src = fetchurl {
url = "http://www.open-mpi.org/software/hwloc/v1.11/downloads/${name}.tar.bz2";
sha256 = "1yl7dm2qplwmnidd712zy12qfvxk28k8ccs694n42ybwdjwzg1bn";
};
nativeBuildInputs = [ pkg-config ];
# Filter out `null' inputs. This allows users to `.override' the
# derivation and set optional dependencies to `null'.
buildInputs = filter (x: x != null)
([ expat ncurses ]
++ (optionals stdenv.isLinux [ numactl ]));
propagatedBuildInputs =
# Since `libpci' appears in `hwloc.pc', it must be propagated.
optional stdenv.isLinux pciutils;
enableParallelBuilding = true;
postInstall =
optionalString (stdenv.isLinux && numactl != null)
'' if [ -d "${numactl}/lib64" ]
then
numalibdir="${numactl}/lib64"
else
numalibdir="${numactl}/lib"
test -d "$numalibdir"
fi
sed -i "$out/lib/libhwloc.la" \
-e "s|-lnuma|-L$numalibdir -lnuma|g"
'';
# Checks disabled because they're impure (hardware dependent) and
# fail on some build machines.
doCheck = false;
meta = {
description = "Portable abstraction of hierarchical architectures for high-performance computing";
longDescription = ''
hwloc provides a portable abstraction (across OS,
versions, architectures, ...) of the hierarchical topology of
modern architectures, including NUMA memory nodes, sockets,
shared caches, cores and simultaneous multithreading. It also
gathers various attributes such as cache and memory
information. It primarily aims at helping high-performance
computing applications with gathering information about the
hardware so as to exploit it accordingly and efficiently.
hwloc may display the topology in multiple convenient
formats. It also offers a powerful programming interface to
gather information about the hardware, bind processes, and much
more.
'';
# http://www.open-mpi.org/projects/hwloc/license.php
license = licenses.bsd3;
homepage = http://www.open-mpi.org/projects/hwloc/;
maintainers = [ ];
platforms = platforms.all;
};
}

View File

@ -0,0 +1,40 @@
{
stdenv
, gcc
, iccUnwrapped
, wrapCCWith
, intelLicense
}:
let
targetConfig = stdenv.targetPlatform.config;
inherit gcc;
in wrapCCWith rec {
cc = iccUnwrapped;
extraBuildCommands = ''
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
echo "-isystem ${iccUnwrapped}/include" >> $out/nix-support/cc-cflags
echo "-isystem ${iccUnwrapped}/include/intel64" >> $out/nix-support/cc-cflags
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
cat "${iccUnwrapped}/nix-support/propagated-build-inputs" >> \
$out/nix-support/propagated-build-inputs
echo "export INTEL_LICENSE_FILE=${intelLicense}" \
>> $out/nix-support/setup-hook
# Create the wrappers for icc and icpc
if [ -e $ccPath/icc ]; then
wrap icc $wrapper $ccPath/icc
fi
if [ -e $ccPath/icpc ]; then
wrap icpc $wrapper $ccPath/icpc
fi
if [ -e $ccPath/ifort ]; then
wrap ifort $wrapper $ccPath/ifort
fi
'';
}

View File

@ -0,0 +1,71 @@
{ stdenv
, lib
, fetchurl
, rpmextract
, autoPatchelfHook
, gcc
, intel-mpi
}:
stdenv.mkDerivation rec {
version = "${year}.${v_a}.${v_b}";
name = "intel-compiler-${version}";
passthru = {
CC = "icc";
CXX = "icpc";
};
# From Arch Linux PKGBUILD
dir_nr="17114";
year="2020";
v_a="4";
v_b="304";
update="4";
composer_xe_dir="compilers_and_libraries_${year}.${v_a}.${v_b}";
tgz="parallel_studio_xe_2020_update${update}_professional_edition.tgz";
src = fetchurl {
url = "https://registrationcenter-download.intel.com/akdlm/irc_nas/tec/${dir_nr}/${tgz}";
sha256 = "1rn9kk5bjj0jfv853b09dxrx7kzvv8dlyzw3hl9ijx9mqr09lrzr";
};
buildInputs = [
rpmextract
autoPatchelfHook
gcc.cc.lib
gcc
intel-mpi
];
# The gcc package is required for building other programs
propagatedBuildInputs = [ gcc ];
installPhase = ''
pwd
ls -l rpm
rpmextract rpm/intel-icc-*.rpm
rpmextract rpm/intel-comp-*.rpm
rpmextract rpm/intel-c-comp-*.rpm
rpmextract rpm/intel-openmp*.rpm
rpmextract rpm/intel-ifort*.rpm
mkdir -p $out/{bin,lib,include}
pushd ./opt/intel/${composer_xe_dir}/linux/
cp -a bin/intel64/* $out/bin/
cp -a compiler/include/* $out/include/
cp -a compiler/lib/intel64_lin/* $out/lib/
ln -s lib $out/lib_lin
rm $out/lib/*.dbg
popd
'';
meta = {
homepage = "https://www.intel.com/content/www/us/en/developer/tools/overview.html";
description = "Intel compiler";
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.unfree;
};
}

View File

@ -0,0 +1,156 @@
{ stdenv
, lib
, fetchurl
, dpkg
, rsync
, libffi
, libelf
, libxml2
, hwloc
, autoPatchelfHook
}:
with lib;
let
getsrc = url: sha256: fetchurl { inherit url sha256; };
version = "2021.2.0";
_debpkgrel = "610";
tbbrel = "357";
# Shorhands
main = "intel-oneapi-dpcpp-cpp";
compiler = "intel-oneapi-compiler-dpcpp-cpp";
shared = "intel-oneapi-compiler-shared";
openmp = "intel-oneapi-openmp";
tbb = "intel-oneapi-tbb";
# From Arch Linux PKGBUILD:
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=intel-oneapi-compiler-dpcpp-cpp
debs = [
# From intel-oneapi-compiler-dpcpp-cpp
"${main}-${version}-${version}-${_debpkgrel}_amd64.deb"
"${compiler}-common-${version}-${version}-${_debpkgrel}_all.deb"
"${compiler}-runtime-${version}-${version}-${_debpkgrel}_amd64.deb"
# From intel-oneapi-compiler-shared
"${shared}-${version}-${version}-${_debpkgrel}_amd64.deb"
"${shared}-runtime-${version}-${version}-${_debpkgrel}_amd64.deb"
"${shared}-common-${version}-${version}-${_debpkgrel}_all.deb"
"${shared}-common-runtime-${version}-${version}-${_debpkgrel}_all.deb"
"${compiler}-classic-fortran-shared-runtime-${version}-${version}-${_debpkgrel}_amd64.deb"
# From intel-oneapi-openmp
"${openmp}-${version}-${version}-${_debpkgrel}_amd64.deb"
"${openmp}-common-${version}-${version}-${_debpkgrel}_all.deb"
# From intel-oneapi-tbb
"${tbb}-${version}-${version}-${tbbrel}_amd64.deb"
"${tbb}-devel-${version}-${version}-${tbbrel}_amd64.deb"
"${tbb}-common-${version}-${version}-${tbbrel}_all.deb"
"${tbb}-common-devel-${version}-${version}-${tbbrel}_all.deb"
];
apthost = "https://apt.repos.intel.com/oneapi/pool/main/";
urls = map (x: apthost + x) debs;
sums = [
# From intel-oneapi-compiler-dpcpp-cpp
"0pwsfzkazr9yf6v6lgwb3p2in6ch3rlcc9qcfarkyqn052p760kk"
"0vzsanldhs4ym4gsfn0zjqm03x53ma1zjkj24hpkhpsvlr2r069w"
"0nx62v6g0wl70lqdh7sh7gfgxbynhrrips9gpj9if60ngz6fm21m"
# From intel-oneapi-compiler-shared
"1al80pcy2r3q2r2pm04sva7rd3z6y287mkdv5jq4p5bfd8yi14d4"
"07rp0cjmbgj48wly9dm6ibxzbsanmgrsjjqr7mx688ms6qbhv314"
"1pf4xckyyhssjknhs6hwampjsz2qjlg81jw2fc441zaccwf25yf3"
"0hk0x4wq60g9wnn9j051v25zcmbasjdzp34xfvrihmcvyws0s69g"
"0dhbw8kshw4abqc9zf891z5ic0x13x3kvhk56nrqkqgcfwps9w8a"
# From intel-oneapi-openmp
"1wqy2sjwlqdh72zhfrxl9pm106hjzfdbbm98cxigbg20fb5lbv5a"
"19nbqypvqcf8c3mwriaqrmp5igjpwvwrb9mq2fxa5i40w7bhlxjl"
# From intel-oneapi-tbb
"1dpii3g861kimky0x7dqcj6hg7zb6i5kw1wgwrxdc5yxhi5slbm9"
"0bl1flm6w0w9nzrh34ig4p9qz2gbdgw9q14as2pwp8flicd8p899"
"0w3kip6q713v1xlfc10ai4v15cbwmbqrv8r1f5x6pfqdbb0bpmbv"
"0v95nmddyi0mjjdvm07w9fm3vq4a0wkx7zxlyzn2f4xg38qc5j73"
];
in
stdenv.mkDerivation {
inherit version;
name = "intel-compiler-${version}";
passthru = {
CC = "icc";
CXX = "icpc";
};
srcs = zipListsWith getsrc urls sums;
buildInputs = [
dpkg
rsync
libffi
libelf
libxml2
hwloc
autoPatchelfHook
stdenv.cc.cc.lib
];
dontBuild = true;
dontStrip = true;
# The gcc package is required for building other programs
#propagatedBuildInputs = [ gcc ];
unpackCmd = ''
dpkg -x $curSrc .
'';
# FIXME: Some dependencies are missing
autoPatchelfIgnoreMissingDeps = true;
#autoPatchelfIgnoreMissingDeps = [ "*" ];
# Compiler
installPhase = ''
mkdir -p $out/{bin,lib,include}
pushd intel/oneapi/compiler/${version}/linux
# Binaries
rsync -a bin/ $out/bin/
rsync -a bin/intel64/ $out/bin/
# Libraries
rsync -a --exclude=oclfpga lib/ $out/lib/
rsync -a compiler/lib/intel64_lin/ $out/lib/
# Headers
rsync -a include/ $out/include/
rsync -a compiler/include/ $out/include/
popd
# TBB
pushd intel/oneapi/tbb/${version}
# Libraries
rsync -a lib/intel64/gcc4.8/ $out/lib/
# Headers
rsync -a include/ $out/include/
popd
'';
meta = {
homepage = "https://www.intel.com/content/www/us/en/developer/tools/overview.html";
description = "Intel compiler";
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.unfree;
};
}

View File

@ -0,0 +1,39 @@
{ stdenv
, requireFile
}:
stdenv.mkDerivation rec {
name = "intel-compiler-license";
version = "2019.7.217";
src = requireFile {
name = "license.lic";
sha256 = "0rgmsqkhpqcfny8j7msa4sgz3prhh248ylh69gjh12dkra77prsj";
message = ''
The Intel Compiler requires a license. You can get one (free of charge) if
you meet the requeriments at the website:
https://software.intel.com/content/www/us/en/develop/articles/qualify-for-free-software.html#opensourcecontributor
Or you can use your own license. Add it to the store with:
$ nix-store --add-fixed sha256 license.lic
/nix/store/2p9v0nvsl3scshjx348z6j32rh7ac0db-license.lic
Notice that the name must match exactly "license.lic".
Then update the hash in the bsc/intel-compiler/license.nix file using the
nix-hash command with:
$ nix-hash --type sha256 --base32 --flat /nix/store/2p9v0nvsl3scshjx348z6j32rh7ac0db-license.lic
06g2xgm1lch6zqfkhb768wacdx46kf61mfvj5wfpyssw0anr0x9q
'';
};
dontUnpack = true;
installPhase = ''
mkdir -p $out
cp $src $out/
'';
}

View File

@ -0,0 +1,29 @@
{
stdenv
, gcc
, iccUnwrapped
, wrapCCWith
}:
let
targetConfig = stdenv.targetPlatform.config;
inherit gcc;
in wrapCCWith rec {
cc = iccUnwrapped;
extraBuildCommands = ''
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
echo "-isystem ${iccUnwrapped}/include" >> $out/nix-support/cc-cflags
echo "-isystem ${iccUnwrapped}/include/icc" >> $out/nix-support/cc-cflags
echo "-isystem ${gcc.cc}/include/c++/${gcc.version}" >> $out/nix-support/cc-cflags
echo "-isystem ${gcc.cc}/include/c++/${gcc.version}/${targetConfig}" >> $out/nix-support/cc-cflags
echo "-L${iccUnwrapped}/lib" >> $out/nix-support/cc-ldflags
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
# Create the wrappers for icx*
wrap lld $wrapper $ccPath/lld
wrap icx $wrapper $ccPath/icx
wrap icpx $wrapper $ccPath/icpx
'';
}

113
pkgs/intel-mpi/default.nix Normal file
View File

@ -0,0 +1,113 @@
{ stdenv
, lib
, rpmextract
, gcc
, zlib
, ucx
, numactl
, rdma-core
, libpsm2
, patchelf
, autoPatchelfHook
, enableDebug ? false
# The _mt version seems to cause seg-faults and deadlocks with the libpsm2
# provider library with programs that call the MPI library without any locking
# mechanism. See https://pm.bsc.es/gitlab/rarias/bscpkgs/-/issues/28. By
# default, we use the non-mt variant, which provides a big lock. If you want to
# use it, take a look at the I_MPI_THREAD_SPLIT env-var as well.
, enableMt ? false
}:
let
lib_variant = (if enableDebug then "debug" else "release");
# See https://software.intel.com/content/www/us/en/develop/documentation/mpi-developer-reference-linux/top/environment-variable-reference/other-environment-variables.html
lib_mt = (if enableMt then "_mt" else "");
lib_name = "${lib_variant}${lib_mt}";
in
stdenv.mkDerivation rec {
name = "intel-mpi-${version}";
version = "2019.10.317";
dir_nr = "17534";
src = builtins.fetchTarball {
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/${dir_nr}/l_mpi_${version}.tgz";
sha256 = "00nimgqywr20dv1ns5kg4r8539gvharn0xfj48i7mhbg8kwf8s08";
};
buildInputs = [
rpmextract
autoPatchelfHook
gcc.cc.lib
zlib
ucx
numactl
rdma-core
libpsm2
patchelf
];
postUnpack = ''
pushd $sourceRoot
rpmextract rpm/intel-mpi-*.rpm
# Predictable name
mv opt/intel/compilers_and_libraries_* opt/intel/compilers_and_libraries
popd
sourceRoot="$sourceRoot/opt/intel/compilers_and_libraries/linux/mpi/intel64"
'';
patches = [
./mpicc.patch
./mpicxx.patch
];
postPatch = ''
for i in bin/mpi* ; do
echo "Fixing paths in $i"
sed -i "s:I_MPI_SUBSTITUTE_INSTALLDIR:$out:g" "$i"
done
'';
dontBuild = true;
installPhase = ''
mkdir -p $out
mv etc $out
mv bin $out
mv include $out
mkdir $out/lib
cp -a lib/lib* $out/lib
cp -a lib/${lib_name}/lib* $out/lib
cp -a libfabric/lib/* $out/lib
cp -a libfabric/lib/prov/* $out/lib
cp -a libfabric/bin/* $out/bin
ln -s . $out/intel64
rm $out/lib/libmpi.dbg
# Fixup Intel PSM2 library missing (now located at PSMX2)
ln -s $out/lib/libpsmx2-fi.so $out/lib/libpsm2-fi.so
'';
dontAutoPatchelf = true;
# The rpath of libfabric.so bundled with Intel MPI is patched to include the
# rdma-core lib path, as is required for dlopen to find the rdma components.
# TODO: Try the upstream libfabric library with rdma support, so we can avoid
# this hack.
postFixup = ''
autoPatchelf -- $out
patchelf --set-rpath "$out/lib:${rdma-core}/lib:${libpsm2}/lib" $out/lib/libfabric.so
echo "Patched RPATH in libfabric.so to: $(patchelf --print-rpath $out/lib/libfabric.so)"
'';
meta = {
homepage = "https://www.intel.com/content/www/us/en/developer/tools/overview.html";
description = "Intel MPI";
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.unfree;
};
}

View File

@ -0,0 +1,20 @@
--- a/bin/mpicc 2021-02-04 18:15:11.233632360 +0100
+++ b/bin/mpicc 2021-02-05 09:33:49.493598479 +0100
@@ -50,7 +50,7 @@
if [ x"$opt_args" == x"" ]; then
case "${compiler_short_name}" in
icc|icx) "$dir"/mpiicc -cc=$compiler_name "$@" ;;
- cc|*gcc*|clang*) "$dir"/mpigcc -cc=$compiler_name "$@" ;;
+ cc|*gcc*|clang*|mcc|echo) "$dir"/mpigcc -cc=$compiler_name "$@" ;;
mpicc) "$dir"/mpigcc "$@" ;;
*)
echo "Error: unsupported compiler name '$compiler_name'."
@@ -60,7 +60,7 @@
else
case "${compiler_short_name}" in
icc|icx) "$dir"/mpiicc -cc=$compiler_name "$@" $opt_args ;;
- cc|*gcc*|clang*) "$dir"/mpigcc -cc=$compiler_name "$@" $opt_args ;;
+ cc|*gcc*|clang*|mcc|echo) "$dir"/mpigcc -cc=$compiler_name "$@" $opt_args ;;
mpicc) "$dir"/mpigcc "$@" $opt_args ;;
*)
echo "Error: unsupported compiler name '$compiler_name'."

View File

@ -0,0 +1,20 @@
--- a/bin/mpicxx 2021-02-04 18:15:11.233632360 +0100
+++ b/bin/mpicxx 2021-02-05 09:36:21.396922569 +0100
@@ -50,7 +50,7 @@
if [ x"$opt_args" == x"" ]; then
case "${compiler_short_name}" in
icc|icpc|dpcpp) "$dir"/mpiicpc -cxx=$compiler_name "$@" ;;
- *g++*) "$dir"/mpigxx -cxx=$compiler_name "$@" ;;
+ *g++*|clang*++|mcxx|echo) "$dir"/mpigxx -cxx=$compiler_name "$@" ;;
mpicxx) "$dir"/mpigxx "$@" ;;
*)
echo "Error: unsupported compiler name '$compiler_name'."
@@ -60,7 +60,7 @@
else
case "${compiler_short_name}" in
icc|icpc|dpcpp) "$dir"/mpiicpc -cxx=$compiler_name "$@" $opt_args ;;
- *g++*) "$dir"/mpigxx -cxx=$compiler_name "$@" $opt_args ;;
+ *g++*|clang*++|mcxx|echo) "$dir"/mpigxx -cxx=$compiler_name "$@" $opt_args ;;
mpicxx) "$dir"/mpigxx "$@" $opt_args ;;
*)
echo "Error: unsupported compiler name '$compiler_name'."

44
pkgs/libpsm2/default.nix Normal file
View File

@ -0,0 +1,44 @@
{ stdenv, lib, fetchFromGitHub, numactl, pkg-config }:
let
version = "11.2.185";
in
stdenv.mkDerivation {
pname = "libpsm2";
inherit version;
preConfigure= ''
export UDEVDIR=$out/etc/udev
substituteInPlace ./Makefile --replace "udevrulesdir}" "prefix}/etc/udev";
'';
enableParallelBuilding = true;
buildInputs = [ numactl pkg-config ];
installFlags = [
"DESTDIR=$(out)"
"UDEVDIR=/etc/udev"
"LIBPSM2_COMPAT_CONF_DIR=/etc"
];
src = fetchFromGitHub {
owner = "intel";
repo = "opa-psm2";
rev = "PSM2_${version}";
sha256 = "062hg4r6gz7pla9df70nqs5i2a3mp1wszmp4l0g771fykhhrxsjg";
};
postInstall = ''
mv $out/usr/* $out
rmdir $out/usr
'';
meta = with lib; {
homepage = "https://github.com/intel/opa-psm2";
description = "The PSM2 library supports a number of fabric media and stacks";
license = with licenses; [ gpl2 bsd3 ];
platforms = [ "x86_64-linux" ];
maintainers = [ maintainers.bzizou ];
};
}

View File

@ -16,19 +16,19 @@
, useGit ? false
, gitUrl ? "ssh://git@bscpm04.bsc.es/llvm-ompss/llvm-mono.git"
, gitBranch ? "master"
, gitCommit ? "880e2341c56bad1dc14e8c369fb3356bec19018e"
, gitCommit ? "872ba63f86edaefc9787984ef3fae9f2f94e0124" # github-release-2025.11
}:
let
stdenv = llvmPackages_latest.stdenv;
release = rec {
version = "2025.06";
version = "2025.11";
src = fetchFromGitHub {
owner = "bsc-pm";
repo = "llvm";
rev = "refs/tags/github-release-${version}";
hash = "sha256-ww9PpRmtz/M9IyLiZ8rAehx2UW4VpQt+svf4XfKBzKo=";
hash = "sha256-UgwMTUkM9Z87dDH205swZFBeFhrcbLAxginViG40pBM=";
};
};

View File

@ -6,6 +6,13 @@
, pmix
, gfortran
, symlinkJoin
# Disabled when cross-compiling
# To fix cross compilation, we should fill the values in:
# https://github.com/pmodels/mpich/blob/main/maint/fcrosscompile/cross_values.txt.in
# For each arch
, enableFortran ? stdenv.hostPlatform == stdenv.buildPlatform
, perl
, targetPackages
}:
let
@ -15,10 +22,13 @@ let
paths = [ pmix.dev pmix.out ];
};
in mpich.overrideAttrs (old: {
buildInput = old.buildInputs ++ [
buildInputs = old.buildInputs ++ [
libfabric
pmixAll
];
nativeBuildInputs = old.nativeBuildInputs ++ [
perl
];
configureFlags = [
"--enable-shared"
"--enable-sharedlib"
@ -31,10 +41,21 @@ in mpich.overrideAttrs (old: {
] ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [
"FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
"FCFLAGS=-fallow-argument-mismatch"
] ++ lib.optionals (!enableFortran) [
"--disable-fortran"
];
preFixup = ''
sed -i 's:^CC=.*:CC=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' $out/bin/mpicc
sed -i 's:^CXX=.*:CXX=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' $out/bin/mpicxx
'' + lib.optionalString enableFortran ''
sed -i 's:^FC=.*:FC=${targetPackages.gfortran or gfortran}/bin/${targetPackages.gfortran.targetPrefix or gfortran.targetPrefix}gfortran:' $out/bin/mpifort
'';
hardeningDisable = [ "all" ];
meta = old.meta // {
maintainers = old.meta.maintainers ++ (with lib.maintainers.bsc; [ rarias ]);
cross = true;
};
})

219
pkgs/nix/default.nix Normal file
View File

@ -0,0 +1,219 @@
{ lib, fetchurl, fetchFromGitHub, callPackage
, storeDir ? "/nix/store"
, stateDir ? "/nix/var"
, confDir ? "/etc"
, boehmgc
, stdenv, llvmPackages_6
}:
let
common =
{ lib, stdenv, fetchpatch, perl, curl, bzip2, sqlite, openssl ? null, xz
, bash, coreutils, gzip, gnutar
, pkg-config, boehmgc, perlPackages, libsodium, brotli, boost, editline, nlohmann_json
, autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook_xsl_ns
, jq, libarchive, rustc, cargo
# Used by tests
, gmock
, busybox-sandbox-shell
, storeDir
, stateDir
, confDir
, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp
, withAWS ? stdenv.isLinux || stdenv.isDarwin, aws-sdk-cpp
, name, suffix ? "", src, crates ? null
}:
let
sh = busybox-sandbox-shell;
nix = stdenv.mkDerivation rec {
inherit name src;
version = lib.getVersion name;
is24 = lib.versionAtLeast version "2.4pre";
isExactly23 = lib.versionAtLeast version "2.3" && lib.versionOlder version "2.4";
VERSION_SUFFIX = suffix;
outputs = [ "out" "dev" "man" "doc" ];
nativeBuildInputs =
[ pkg-config ]
++ lib.optionals is24 [ autoreconfHook autoconf-archive bison flex libxml2 libxslt
docbook5 docbook_xsl_ns jq gmock ];
buildInputs =
[ curl openssl sqlite xz bzip2 nlohmann_json
brotli boost editline
]
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optionals is24 [ libarchive rustc cargo ]
++ lib.optional withLibseccomp libseccomp
++ lib.optional withAWS
((aws-sdk-cpp.override {
apis = ["s3" "transfer"];
customMemoryManagement = false;
}).overrideDerivation (args: {
patches = args.patches or [] ++ [(fetchpatch {
url = "https://github.com/edolstra/aws-sdk-cpp/commit/7d58e303159b2fb343af9a1ec4512238efa147c7.patch";
sha256 = "103phn6kyvs1yc7fibyin3lgxz699qakhw671kl207484im55id1";
})];
}));
propagatedBuildInputs = [ boehmgc ];
# Seems to be required when using std::atomic with 64-bit types
NIX_LDFLAGS = lib.optionalString (stdenv.hostPlatform.system == "armv5tel-linux" || stdenv.hostPlatform.system == "armv6l-linux") "-latomic";
preConfigure =
# Copy libboost_context so we don't get all of Boost in our closure.
# https://github.com/NixOS/nixpkgs/issues/45462
''
mkdir -p $out/lib
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
rm -f $out/lib/*.a
${lib.optionalString stdenv.isLinux ''
chmod u+w $out/lib/*.so.*
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
''}
'' +
# Unpack the Rust crates.
lib.optionalString is24 ''
tar xvf ${crates} -C nix-rust/
mv nix-rust/nix-vendored-crates* nix-rust/vendor
'' +
# For Nix-2.3, patch around an issue where the Nix configure step pulls in the
# build system's bash and other utilities when cross-compiling
lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform && isExactly23) ''
mkdir tmp/
substitute corepkgs/config.nix.in tmp/config.nix.in \
--subst-var-by bash ${bash}/bin/bash \
--subst-var-by coreutils ${coreutils}/bin \
--subst-var-by bzip2 ${bzip2}/bin/bzip2 \
--subst-var-by gzip ${gzip}/bin/gzip \
--subst-var-by xz ${xz}/bin/xz \
--subst-var-by tar ${gnutar}/bin/tar \
--subst-var-by tr ${coreutils}/bin/tr
mv tmp/config.nix.in corepkgs/config.nix.in
'';
configureFlags =
[ "--with-store-dir=${storeDir}"
"--localstatedir=${stateDir}"
"--sysconfdir=${confDir}"
"--disable-init-state"
"--enable-gc"
]
++ lib.optionals stdenv.isLinux [
"--with-sandbox-shell=${sh}/bin/busybox"
]
++ lib.optional (
stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform ? nix && stdenv.hostPlatform.nix ? system
) ''--with-system=${stdenv.hostPlatform.nix.system}''
# RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50
++ lib.optional (!withLibseccomp) "--disable-seccomp-sandboxing";
makeFlags = [ "profiledir=$(out)/etc/profile.d" ];
installFlags = [ "sysconfdir=$(out)/etc" ];
doInstallCheck = false;
# socket path becomes too long otherwise
#preInstallCheck = lib.optional stdenv.isDarwin ''
# export TMPDIR=$NIX_BUILD_TOP
#'';
separateDebugInfo = stdenv.isLinux;
enableParallelBuilding = true;
meta = {
description = "Powerful package manager that makes package management reliable and reproducible";
longDescription = ''
Nix is a powerful package manager for Linux and other Unix systems that
makes package management reliable and reproducible. It provides atomic
upgrades and rollbacks, side-by-side installation of multiple versions of
a package, multi-user package management and easy setup of build
environments.
'';
homepage = "https://nixos.org/";
license = lib.licenses.lgpl2Plus;
maintainers = [ lib.maintainers.eelco ];
platforms = lib.platforms.unix;
outputsToInstall = [ "out" "man" ];
};
passthru = {
perl-bindings = stdenv.mkDerivation {
pname = "nix-perl";
inherit version;
inherit src;
postUnpack = "sourceRoot=$sourceRoot/perl";
# This is not cross-compile safe, don't have time to fix right now
# but noting for future travellers.
nativeBuildInputs =
[ perl pkg-config curl nix libsodium boost autoreconfHook autoconf-archive ];
configureFlags =
[ "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
"--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}"
];
preConfigure = "export NIX_STATE_DIR=$TMPDIR";
preBuild = "unset NIX_INDENT_MAKE";
};
};
};
in nix;
in rec {
nix = nixUnstable;
nixUnstable = lib.lowPrio (callPackage common rec {
name = "nix-2.4${suffix}";
suffix = "pre7534_b92f58f6";
#src = /home/Computational/rarias/nix/nix-rodarima;
src = fetchFromGitHub {
owner = "rodarima";
repo = "nix";
rev = "3a642187c33ed46d952d3a50a83b2576b704fab7";
sha256 = "0s8is2czpkcj1x1kcjqgbnsbbl03w3fwjjiclsd44zh1ij3wb90s";
};
crates = fetchurl {
url = "https://hydra.nixos.org/build/118797694/download/1/nix-vendored-crates-2.4pre7534_b92f58f6.tar.xz";
sha256 = "a4c2612bbd81732bbb899bc0c230e07b16f6b6150ffbb19c4907dedbbc2bf9fc";
};
inherit storeDir stateDir confDir boehmgc;
});
nixFlakes = lib.lowPrio (callPackage common rec {
name = "nix-2.4${suffix}";
suffix = "pre20200521_00b562c";
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "00b562c87ec4c3bbe514f5dc1f4d1c41f66f66bf";
sha256 = "0s8is2czpkcj1x1kcjqgbnsbbl03w3fwjjiclsd44zh1ij3wb90s";
};
crates = fetchurl {
url = "https://hydra.nixos.org/build/118093786/download/1/nix-vendored-crates-2.4pre20200501_941f952.tar.xz";
sha256 = "060f4n5srdbb8vsj0m14aqch7im79a4h5g3nrs41p1xc602vhcdl";
};
inherit storeDir stateDir confDir boehmgc;
});
}

214
pkgs/nix/static.nix Normal file
View File

@ -0,0 +1,214 @@
{ lib, fetchurl, fetchFromGitHub, callPackage
, storeDir ? "/nix/store"
, stateDir ? "/nix/var"
, confDir ? "/etc"
, boehmgc
, stdenv, llvmPackages_6
, sandbox-shell ? "/bin/sh"
}:
let
enableStatic = true;
common =
{ lib, stdenv, fetchpatch, perl, curl, bzip2, sqlite, openssl ? null, xz
, bash, coreutils, gzip, gnutar
, pkg-config, boehmgc, perlPackages, libsodium, brotli, boost, editline, nlohmann_json
, autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook_xsl_ns
, jq, libarchive
# Used by tests
, gmock
, storeDir
, stateDir
, confDir
, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp
, withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp
, enableStatic ? true
, name, suffix ? "", src
}:
let
nix = stdenv.mkDerivation rec {
inherit name src;
version = lib.getVersion name;
is24 = lib.versionAtLeast version "2.4pre";
isExactly23 = lib.versionAtLeast version "2.3" && lib.versionOlder version "2.4";
VERSION_SUFFIX = suffix;
outputs = [ "out" "dev" "man" "doc" ];
nativeBuildInputs =
[ pkg-config ]
++ lib.optionals is24 [ autoreconfHook autoconf-archive bison flex libxml2 libxslt
docbook5 docbook_xsl_ns jq ];
buildInputs =
[ curl openssl sqlite xz bzip2 nlohmann_json
brotli boost editline boehmgc
]
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optionals is24 [ libarchive gmock ]
++ lib.optional withLibseccomp libseccomp
++ lib.optional withAWS
((aws-sdk-cpp.override {
apis = ["s3" "transfer"];
customMemoryManagement = false;
}).overrideDerivation (args: {
patches = args.patches or [] ++ [(fetchpatch {
url = "https://github.com/edolstra/aws-sdk-cpp/commit/7d58e303159b2fb343af9a1ec4512238efa147c7.patch";
sha256 = "103phn6kyvs1yc7fibyin3lgxz699qakhw671kl207484im55id1";
})];
}));
propagatedBuildInputs = [ boehmgc ];
# Seems to be required when using std::atomic with 64-bit types
NIX_LDFLAGS =
# need to list libraries individually until
# https://github.com/NixOS/nix/commit/3e85c57a6cbf46d5f0fe8a89b368a43abd26daba
# is in a release
lib.optionalString enableStatic "-lssl -lbrotlicommon -lssh2 -lz -lnghttp2 -lcrypto"
# need to detect it here until
# https://github.com/NixOS/nix/commits/74b4737d8f0e1922ef5314a158271acf81cd79f8
# is in a release
+ lib.optionalString (stdenv.hostPlatform.system == "armv5tel-linux" || stdenv.hostPlatform.system == "armv6l-linux") "-latomic";
preConfigure =
# Copy libboost_context so we don't get all of Boost in our closure.
# https://github.com/NixOS/nixpkgs/issues/45462
lib.optionalString (!enableStatic) ''
mkdir -p $out/lib
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
rm -f $out/lib/*.a
${lib.optionalString stdenv.isLinux ''
chmod u+w $out/lib/*.so.*
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
''}
'' +
# For Nix-2.3, patch around an issue where the Nix configure step pulls in the
# build system's bash and other utilities when cross-compiling
lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform && isExactly23) ''
mkdir tmp/
substitute corepkgs/config.nix.in tmp/config.nix.in \
--subst-var-by bash ${bash}/bin/bash \
--subst-var-by coreutils ${coreutils}/bin \
--subst-var-by bzip2 ${bzip2}/bin/bzip2 \
--subst-var-by gzip ${gzip}/bin/gzip \
--subst-var-by xz ${xz}/bin/xz \
--subst-var-by tar ${gnutar}/bin/tar \
--subst-var-by tr ${coreutils}/bin/tr
mv tmp/config.nix.in corepkgs/config.nix.in
'';
configureFlags =
[ "--with-store-dir=${storeDir}"
"--localstatedir=${stateDir}"
"--sysconfdir=${confDir}"
"--disable-init-state"
"--enable-gc"
]
++ lib.optionals stdenv.isLinux [
"--with-sandbox-shell=${sandbox-shell}"
]
++ lib.optional (
stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform ? nix && stdenv.hostPlatform.nix ? system
) ''--with-system=${stdenv.hostPlatform.nix.system}''
# RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50
++ lib.optional (!withLibseccomp) "--disable-seccomp-sandboxing";
makeFlags = [ "profiledir=$(out)/etc/profile.d" ]
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "PRECOMPILE_HEADERS=0";
installFlags = [ "sysconfdir=$(out)/etc" ];
doInstallCheck = true; # not cross
# socket path becomes too long otherwise
preInstallCheck = lib.optional stdenv.isDarwin ''
export TMPDIR=$NIX_BUILD_TOP
'';
separateDebugInfo = stdenv.isLinux;
enableParallelBuilding = true;
meta = {
description = "Powerful package manager that makes package management reliable and reproducible";
longDescription = ''
Nix is a powerful package manager for Linux and other Unix systems that
makes package management reliable and reproducible. It provides atomic
upgrades and rollbacks, side-by-side installation of multiple versions of
a package, multi-user package management and easy setup of build
environments.
'';
homepage = "https://nixos.org/";
license = lib.licenses.lgpl2Plus;
maintainers = [ lib.maintainers.eelco ];
platforms = lib.platforms.unix;
outputsToInstall = [ "out" "man" ];
};
passthru = {
perl-bindings = stdenv.mkDerivation {
pname = "nix-perl";
inherit version;
inherit src;
postUnpack = "sourceRoot=$sourceRoot/perl";
# This is not cross-compile safe, don't have time to fix right now
# but noting for future travellers.
nativeBuildInputs =
[ perl pkg-config curl nix libsodium boost autoreconfHook autoconf-archive ];
configureFlags =
[ "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
"--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}"
];
preConfigure = "export NIX_STATE_DIR=$TMPDIR";
preBuild = "unset NIX_INDENT_MAKE";
};
};
};
in nix;
in rec {
nix = nixStable;
nixStable = callPackage common (rec {
name = "nix-2.3.7";
src = fetchurl {
url = "https://nixos.org/releases/nix/${name}/${name}.tar.xz";
sha256 = "dd8f52849414e5a878afe7e797aa4e22bab77c875d9da5a38d5f1bada704e596";
};
inherit storeDir stateDir confDir boehmgc;
} // lib.optionalAttrs stdenv.cc.isClang {
stdenv = llvmPackages_6.stdenv;
});
nixUnstable = lib.lowPrio (callPackage common rec {
name = "nix-2.4${suffix}";
suffix = "pre20200721_ff314f1";
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "ff314f186e3f91d87af6ad96c0ae3b472494b940";
hash = "sha256-QibpLo4/gf2xYGoeQcgjZzH/qy5TBRVH+QCHgqOwur0=";
};
inherit storeDir stateDir confDir boehmgc;
});
nixFlakes = nixUnstable;
}

17
pkgs/nix/upload.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# This post build hook sends the closure of the just built derivation to the
# target machine. In our case this is the MareNostrum4 cluster.
# set -e fails as the profile runs some erroring programs
# We need the profile to load nix in the $PATH
. /etc/profile
set -eu
set -f # disable globbing
export IFS=' '
nixroot=/gpfs/projects/bsc15/nix
store=$nixroot/nix/store
target=ssh://mn
nix copy --to $target $OUT_PATHS

22
pkgs/nixgen/default.nix Normal file
View File

@ -0,0 +1,22 @@
{
stdenv
, lib
}:
stdenv.mkDerivation {
pname = "nixgen";
version = "0.0.1";
src = ./nixgen;
dontUnpack = true;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
cp -a $src $out/bin/nixgen
'';
meta = {
description = "Quickly generate flake.nix from command line";
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl3Plus;
};
}

97
pkgs/nixgen/nixgen Executable file
View File

@ -0,0 +1,97 @@
#!/bin/sh
#
# Copyright (c) 2025, Barcelona Supercomputing Center (BSC)
# SPDX-License-Identifier: GPL-3.0+
# Author: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
function usage() {
echo "USAGE: nixgen [-f] [package [...]] [-b package [...]]" >&2
echo " Generates a flake.nix file with the given packages." >&2
echo " After flake.nix is created, use 'nix develop' to enter the shell." >&2
echo "OPTIONS" >&2
echo " -f Overwrite existing flake.nix (default: no)." >&2
echo " packages... Add these packages to the shell." >&2
echo " -b packages... Add the dependencies needed to build these packages." >&2
echo "EXAMPLE" >&2
echo " $ nixgen ovni bigotes -b nosv tampi" >&2
echo " Adds the packages ovni and bigotes as well as all required dependencies" >&2
echo " to build nosv and tampi." >&2
echo "AUTHOR" >&2
echo " Rodrigo Arias Mallo <rodrigo.arias@bsc.es>" >&2
exit 1
}
mode=package
packages=
inputsFrom=
force=
if [[ $# -eq 0 ]]; then
usage
fi
while [[ $# -gt 0 ]]; do
case $1 in -b)
mode=build
shift
;;
-f)
force=1
shift
;;
-h)
usage
;;
-*|--*)
echo "error: unknown option $1" >&2
exit 1
;;
*)
if [ "$mode" == "package" ]; then
packages+="${packages:+ }$1"
else
inputsFrom+="${inputsFrom:+ }$1"
fi
shift
;;
esac
done
if [ ! "$force" -a -e flake.nix ]; then
echo "error: flake.nix exists, force overwrite with -f" >&2
exit 1
fi
cat > flake.nix <<EOF
{
inputs.jungle.url = "git+https://jungle.bsc.es/git/rarias/jungle";
outputs = { self, jungle }:
let
nixpkgs = jungle.inputs.nixpkgs;
customOverlay = (final: prev: {
# Example overlay, for now empty
});
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [
# Apply jungle overlay to get our BSC custom packages
jungle.outputs.bscOverlay
# And on top apply our local changes to customize for cluster
customOverlay
];
};
in {
devShells.x86_64-linux.default = pkgs.mkShell {
pname = "devshell";
# Include these packages in the shell
packages = with pkgs; [
$packages
];
# The dependencies needed to build these packages will be also included
inputsFrom = with pkgs; [
$inputsFrom
];
};
};
}
EOF

View File

@ -3,7 +3,6 @@
, lib
, fetchFromGitHub
, pkg-config
, perl
, numactl
, hwloc
, boost
@ -11,22 +10,23 @@
, ovni
, nosv
, clangOmpss2
, which
, useGit ? false
, gitUrl ? "ssh://git@gitlab-internal.bsc.es/nos-v/nodes.git"
, gitBranch ? "master"
, gitCommit ? "6002ec9ae6eb876d962cc34366952a3b26599ba6"
, gitCommit ? "511489e71504a44381e0930562e7ac80ac69a848" # version-1.4
}:
with lib;
let
release = rec {
version = "1.3";
version = "1.4";
src = fetchFromGitHub {
owner = "bsc-pm";
repo = "nodes";
rev = "version-${version}";
hash = "sha256-cFb9pxcjtkMmH0CsGgUO9LTdXDNh7MCqicgGWawLrsU=";
hash = "sha256-+lR/R0l3fGZO3XG7whMorFW2y2YZ0ZFnLeOHyQYrAsQ=";
};
};
@ -59,6 +59,7 @@ in
doCheck = false;
nativeCheckInputs = [
clangOmpss2
which
];
# The "bindnow" flags are incompatible with ifunc resolution mechanism. We

View File

@ -13,19 +13,19 @@
, useGit ? false
, gitUrl ? "git@gitlab-internal.bsc.es:nos-v/nos-v.git"
, gitBranch ? "master"
, gitCommit ? "9f47063873c3aa9d6a47482a82c5000a8c813dd8"
, gitCommit ? "1108e4786b58e0feb9a16fa093010b763eb2f8e8" # version 4.0.0
}:
with lib;
let
release = rec {
version = "3.2.0";
version = "4.0.0";
src = fetchFromGitHub {
owner = "bsc-pm";
repo = "nos-v";
rev = "${version}";
hash = "sha256-yaz92426EM8trdkBJlISmAoG9KJCDTvoAW/HKrasvOw=";
hash = "sha256-llaq73bd/YxLVKNlMebnUHKa4z3sdcsuDUoVwUxNuw8=";
};
};

120
pkgs/openmpi/default.nix Normal file
View File

@ -0,0 +1,120 @@
{ stdenv, lib, fetchurl, fetchpatch, gfortran, perl, libnl
, rdma-core, zlib, numactl, libevent, hwloc, targetPackages, symlinkJoin
, libpsm2, libfabric, pmix, pmi2, ucx
# Enable CUDA support
, cudaSupport ? false, cudatoolkit ? null
# Enable the Sun Grid Engine bindings
, enableSGE ? false
# Pass PATH/LD_LIBRARY_PATH to point to current mpirun by default
, enablePrefix ? false
# Enable libfabric support (necessary for Omnipath networks) on x86_64 linux
, fabricSupport ? stdenv.isLinux && stdenv.isx86_64
# Enable mpi_cxx.so
, enableCxx ? false
}:
assert !cudaSupport || cudatoolkit != null;
let
version = "4.0.4";
cudatoolkit_joined = symlinkJoin {
name = "${cudatoolkit.name}-unsplit";
paths = [ cudatoolkit.out cudatoolkit.lib ];
};
in stdenv.mkDerivation rec {
pname = "openmpi";
inherit version;
src = with lib.versions; fetchurl {
url = "https://www.open-mpi.org/software/ompi/v${major version}.${minor version}/downloads/${pname}-${version}.tar.bz2";
sha256 = "1i0slg2dxjdgw513aml1n9dsbdxn2fimi2b5712d5r9z4ar4xqj7";
};
postPatch = ''
patchShebangs ./
# Ensure build is reproducible
ts=`date -d @$SOURCE_DATE_EPOCH`
sed -i 's/OPAL_CONFIGURE_USER=.*/OPAL_CONFIGURE_USER="nixbld"/' configure
sed -i 's/OPAL_CONFIGURE_HOST=.*/OPAL_CONFIGURE_HOST="localhost"/' configure
sed -i "s/OPAL_CONFIGURE_DATE=.*/OPAL_CONFIGURE_DATE=\"$ts\"/" configure
find -name "Makefile.in" -exec sed -i "s/\`date\`/$ts/" \{} \;
'';
buildInputs = with stdenv; [ gfortran zlib ]
++ lib.optionals isLinux [ libnl numactl pmix ucx ]
++ lib.optionals cudaSupport [ cudatoolkit ]
++ [ libevent hwloc ]
++ lib.optional (isLinux || isFreeBSD) rdma-core
++ lib.optional fabricSupport [ libpsm2 libfabric ];
nativeBuildInputs = [ perl ];
configureFlags = with stdenv; lib.optional (!cudaSupport) "--disable-mca-dso"
++ lib.optionals isLinux [
"--with-libnl=${libnl.dev}"
"--with-pmix=${pmix}"
"--with-pmix-libdir=${pmix}/lib"
"--with-pmi=${pmi2}"
"--with-pmi-libdir=${pmi2}/lib"
] ++ lib.optional enableSGE "--with-sge"
++ lib.optional enablePrefix "--enable-mpirun-prefix-by-default"
# TODO: add UCX support, which is recommended to use with cuda for the most robust OpenMPI build
# https://github.com/openucx/ucx
# https://www.open-mpi.org/faq/?category=buildcuda
++ lib.optionals cudaSupport [ "--with-cuda=${cudatoolkit_joined}" "--enable-dlopen" ]
++ lib.optionals fabricSupport [ "--with-psm2=${libpsm2}" "--with-libfabric=${libfabric}" ]
++ lib.optional enableCxx "--enable-mpi-cxx"
;
enableParallelBuilding = true;
hardeningDisable = [ "all" ];
postInstall = ''
rm -f $out/lib/*.la
'';
postFixup = ''
# default compilers should be indentical to the
# compilers at build time
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
$out/share/openmpi/mpicc-wrapper-data.txt
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
$out/share/openmpi/ortecc-wrapper-data.txt
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' \
$out/share/openmpi/mpic++-wrapper-data.txt
sed -i 's:compiler=.*:compiler=${gfortran}/bin/${gfortran.targetPrefix}gfortran:' \
$out/share/openmpi/mpifort-wrapper-data.txt
'';
doCheck = true;
passthru = {
inherit cudaSupport cudatoolkit;
};
meta = with lib; {
homepage = "https://www.open-mpi.org/";
description = "Open source MPI-3 implementation";
longDescription = "The Open MPI Project is an open source MPI-3 implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library available. Open MPI offers advantages for system and software vendors, application developers and computer science researchers.";
maintainers = with maintainers; [ markuskowa ];
license = licenses.bsd3;
platforms = platforms.unix;
# In order to use OpenMPI with Extrae we need to keep the Extrae libraries
# rather than the ones from OpenMPI. This happens with libompitrace.so, so
# we set to a lower priority (higher value) the OpenMPI package.
priority = 10;
};
}

117
pkgs/openmpi/with-slurm.nix Normal file
View File

@ -0,0 +1,117 @@
{ stdenv, lib, fetchurl, fetchpatch, gfortran, perl, libnl
, rdma-core, zlib, numactl, libevent, hwloc, targetPackages, symlinkJoin
, libpsm2, libfabric
# Enable CUDA support
, cudaSupport ? false, cudatoolkit ? null
# Enable the Sun Grid Engine bindings
, enableSGE ? false
# Pass PATH/LD_LIBRARY_PATH to point to current mpirun by default
, enablePrefix ? false
# Enable libfabric support (necessary for Omnipath networks) on x86_64 linux
, fabricSupport ? stdenv.isLinux && stdenv.isx86_64
# Enable mpi_cxx.so
, enableCxx ? false
, slurm
}:
assert !cudaSupport || cudatoolkit != null;
let
version = "4.0.3";
cudatoolkit_joined = symlinkJoin {
name = "${cudatoolkit.name}-unsplit";
paths = [ cudatoolkit.out cudatoolkit.lib ];
};
in stdenv.mkDerivation rec {
pname = "openmpi";
inherit version;
src = with lib.versions; fetchurl {
url = "https://www.open-mpi.org/software/ompi/v${major version}.${minor version}/downloads/${pname}-${version}.tar.bz2";
sha256 = "00zxcw99gr5n693cmcmn4f6a47vx1ywna895p0x7p163v37gw0hl";
};
postPatch = ''
patchShebangs ./
# Ensure build is reproducible
ts=`date -d @$SOURCE_DATE_EPOCH`
sed -i 's/OPAL_CONFIGURE_USER=.*/OPAL_CONFIGURE_USER="nixbld"/' configure
sed -i 's/OPAL_CONFIGURE_HOST=.*/OPAL_CONFIGURE_HOST="localhost"/' configure
sed -i "s/OPAL_CONFIGURE_DATE=.*/OPAL_CONFIGURE_DATE=\"$ts\"/" configure
find -name "Makefile.in" -exec sed -i "s/\`date\`/$ts/" \{} \;
'';
buildInputs = with stdenv; [ gfortran zlib ]
++ lib.optionals isLinux [ libnl numactl ]
++ lib.optionals cudaSupport [ cudatoolkit ]
++ [ libevent hwloc ]
++ lib.optional (isLinux || isFreeBSD) rdma-core
++ lib.optional fabricSupport [ libpsm2 libfabric ]
++ [ slurm ];
nativeBuildInputs = [ perl ];
configureFlags = with stdenv; lib.optional (!cudaSupport) "--disable-mca-dso"
++ lib.optional isLinux "--with-libnl=${libnl.dev}"
++ lib.optional enableSGE "--with-sge"
++ lib.optional enablePrefix "--enable-mpirun-prefix-by-default"
# TODO: add UCX support, which is recommended to use with cuda for the most robust OpenMPI build
# https://github.com/openucx/ucx
# https://www.open-mpi.org/faq/?category=buildcuda
++ lib.optionals cudaSupport [ "--with-cuda=${cudatoolkit_joined}" "--enable-dlopen" ]
++ lib.optionals fabricSupport [ "--with-psm2=${libpsm2}" "--with-libfabric=${libfabric}" ]
++ lib.optional enableCxx "--enable-mpi-cxx"
++ [ "--with-slurm=${slurm}" "--with-pmi" "--enable-static" "--disable-dlopen" ]
;
enableParallelBuilding = true;
postInstall = ''
rm -f $out/lib/*.la
'';
postFixup = ''
# default compilers should be indentical to the
# compilers at build time
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
$out/share/openmpi/mpicc-wrapper-data.txt
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
$out/share/openmpi/ortecc-wrapper-data.txt
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' \
$out/share/openmpi/mpic++-wrapper-data.txt
sed -i 's:compiler=.*:compiler=${gfortran}/bin/${gfortran.targetPrefix}gfortran:' \
$out/share/openmpi/mpifort-wrapper-data.txt
'';
doCheck = true;
passthru = {
inherit cudaSupport cudatoolkit;
};
meta = with lib; {
homepage = "https://www.open-mpi.org/";
description = "Open source MPI-3 implementation";
longDescription = "The Open MPI Project is an open source MPI-3 implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library available. Open MPI offers advantages for system and software vendors, application developers and computer science researchers.";
maintainers = with maintainers; [ markuskowa ];
license = licenses.bsd3;
platforms = platforms.unix;
# In order to use OpenMPI with Extrae we need to keep the Extrae libraries
# rather than the ones from OpenMPI. This happens with libompitrace.so, so
# we set to a lower priority (higher value) the OpenMPI package.
priority = 10;
};
}

View File

@ -32,6 +32,11 @@ stdenv.mkDerivation rec {
"CXX=mpicxx"
];
env = {
MPICH_CC="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
MPICH_CXX="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
};
postInstall = ''
mkdir -p $out/bin
for f in $(find $out -executable -type f); do
@ -44,5 +49,6 @@ stdenv.mkDerivation rec {
homepage = "http://mvapich.cse.ohio-state.edu/benchmarks/";
maintainers = [ ];
platforms = lib.platforms.all;
cross = true;
};
}

17
pkgs/otf/default.nix Normal file
View File

@ -0,0 +1,17 @@
{
stdenv
#, mkDerivation
, fetchurl
}:
stdenv.mkDerivation rec {
version = "1.2.18";
pname = "otf";
src = fetchurl {
url =
"http://paratools01.rrp.net/wp-content/uploads/2016/06/OTF-SRC-${version}.tar.gz";
sha256 = "10k1hyyn6w4lf5kbn1krfacaspvn1xg3qgn4027xal3hjf3kkxap";
};
patches = [ ./printf.patch ];
}

11
pkgs/otf/printf.patch Normal file
View File

@ -0,0 +1,11 @@
--- a/tools/otfconfig/otfconfig.c 2020-11-21 13:55:23.195530435 +0100
+++ b/tools/otfconfig/otfconfig.c 2020-11-21 13:55:53.112402154 +0100
@@ -75,7 +75,7 @@ int main( int argc, char** argv ) {
strcat( tmp, "\n" );
- printf( tmp );
+ printf("%s", tmp );
}
}

View File

@ -7,7 +7,7 @@
, useGit ? false
, gitBranch ? "master"
, gitUrl ? "ssh://git@bscpm04.bsc.es/rarias/ovni.git"
, gitCommit ? "e4f62382076f0cf0b1d08175cf57cc0bc51abc61"
, gitCommit ? "06432668f346c8bdc1006fabc23e94ccb81b0d8b" # version 1.13.0
, enableDebug ? false
# Only enable MPI if the build is native (fails on cross-compilation)
, useMpi ? (stdenv.buildPlatform.canExecute stdenv.hostPlatform)
@ -15,13 +15,13 @@
let
release = rec {
version = "1.12.0";
version = "1.13.0";
src = fetchFromGitHub {
owner = "bsc-pm";
repo = "ovni";
rev = "${version}";
hash = "sha256-H04JvsVKrdqr3ON7JhU0g17jjlg/jzQ7eTfx9vUNd3E=";
} // { shortRev = "a73afcf"; };
hash = "sha256-0l2ryIyWNiZqeYdVlnj/WnQGS3xFCY4ICG8JedX424w=";
} // { shortRev = "0643266"; };
};
git = rec {

84
pkgs/perf/default.nix Normal file
View File

@ -0,0 +1,84 @@
{ lib, stdenv, kernel, elfutils, python2, python3, perl, newt, slang, asciidoc, xmlto, makeWrapper
, docbook_xsl, docbook_xml_dtd_45, libxslt, flex, bison, pkg-config, libunwind, binutils
, libiberty, audit, libbfd, libopcodes, openssl, systemtap, numactl
, zlib, withGtk ? false, gtk2 ? null
, babeltrace
}:
with lib;
assert withGtk -> gtk2 != null;
assert versionAtLeast kernel.version "3.12";
stdenv.mkDerivation {
name = "perf-linux-${kernel.version}";
inherit (kernel) src;
preConfigure = ''
cd tools/perf
substituteInPlace Makefile \
--replace /usr/include/elfutils $elfutils/include/elfutils
for x in util/build-id.c util/dso.c; do
substituteInPlace $x --replace /usr/lib/debug /run/current-system/sw/lib/debug
done
if [ -f bash_completion ]; then
sed -i 's,^have perf,_have perf,' bash_completion
fi
'';
makeFlags = [
"prefix=$(out)"
"WERROR=0"
"LIBBABELTRACE=1"
"LIBBABELTRACE_DIR=${babeltrace}"
] ++ kernel.makeFlags;
hardeningDisable = [ "format" ];
# perf refers both to newt and slang
nativeBuildInputs = [
asciidoc xmlto docbook_xsl docbook_xml_dtd_45 libxslt
flex bison libiberty audit makeWrapper pkg-config python3
];
buildInputs = [
elfutils newt slang libunwind libbfd zlib openssl systemtap.stapBuild numactl
libopcodes python3 perl babeltrace
] ++ lib.optional withGtk gtk2
++ (if (versionAtLeast kernel.version "4.19") then [ python3 ] else [ python2 ]);
# Note: we don't add elfutils to buildInputs, since it provides a
# bad `ld' and other stuff.
NIX_CFLAGS_COMPILE = toString [
"-Wno-error=cpp"
"-Wno-error=bool-compare"
"-Wno-error=deprecated-declarations"
"-DOBJDUMP_PATH=\"${binutils}/bin/objdump\""
"-Wno-error=stringop-truncation"
];
postPatch = ''
patchShebangs scripts/bpf_helpers_doc.py
'';
doCheck = false; # requires "sparse"
doInstallCheck = false; # same
separateDebugInfo = true;
installFlags = [ "install" "install-man" "ASCIIDOC8=1" "prefix=$(out)" ];
preFixup = ''
wrapProgram $out/bin/perf \
--prefix PATH : "${binutils}/bin"
'';
meta = {
homepage = "https://perf.wiki.kernel.org/";
description = "Linux tools to profile with performance counters";
maintainers = with lib.maintainers; [viric];
platforms = with lib.platforms; linux;
};
}

48
pkgs/pmix/pmix2.nix Normal file
View File

@ -0,0 +1,48 @@
{ stdenv, lib, fetchFromGitHub, perl, autoconf, automake
, libtool, flex, libevent, hwloc, munge, zlib
} :
let
version = "2.2.4";
in stdenv.mkDerivation {
pname = "pmix";
inherit version;
src = fetchFromGitHub {
repo = "openpmix";
owner = "openpmix";
rev = "v${version}";
sha256 = "1wc4sbnbg20lp6l6pk1sawrf5wrdajcijd1cmrpp1d6h9nv23ggv";
};
postPatch = ''
patchShebangs ./autogen.pl
patchShebangs ./config
'';
nativeBuildInputs = [ perl autoconf automake libtool flex ];
buildInputs = [ libevent hwloc munge zlib ];
configureFlags = [
"--with-libevent=${libevent.dev}"
"--with-munge=${munge}"
"--with-hwloc=${hwloc.dev}"
];
preConfigure = ''
./autogen.pl
'';
enableParallelBuilding = true;
meta = with lib; {
description = "Process Management Interface for HPC environments";
homepage = "https://openpmix.github.io/";
license = licenses.bsd3;
maintainers = [ maintainers.markuskowa ];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,58 @@
{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, docutils
, pandoc, ethtool, iproute, libnl, udev, python, perl
, makeWrapper
} :
let
version = "31.1";
in stdenv.mkDerivation {
pname = "rdma-core";
inherit version;
src = fetchFromGitHub {
owner = "linux-rdma";
repo = "rdma-core";
rev = "v${version}";
sha256 = "1xkmdix6mgv6kjjj6wi844bfddhl0ybalrp5g8pf5izasc43brg7";
};
nativeBuildInputs = [ cmake pkg-config pandoc docutils makeWrapper ];
buildInputs = [ libnl ethtool iproute udev python perl ];
cmakeFlags = [
"-DCMAKE_INSTALL_RUNDIR=/run"
"-DCMAKE_INSTALL_SHAREDSTATEDIR=/var/lib"
];
postPatch = ''
substituteInPlace srp_daemon/srp_daemon.sh.in \
--replace /bin/rm rm
'';
postInstall = ''
# cmake script is buggy, move file manually
mkdir -p $out/${perl.libPrefix}
mv $out/share/perl5/* $out/${perl.libPrefix}
'';
postFixup = ''
for pls in $out/bin/{ibfindnodesusing.pl,ibidsverify.pl}; do
echo "wrapping $pls"
chmod +x "$pls"
wrapProgram $pls --prefix PERL5LIB : "$out/${perl.libPrefix}"
done
# Remove the binaries as they pull systemd
rm -rf $out/bin
rm -rf $out/sbin
'';
meta = with lib; {
description = "RDMA Core Userspace Libraries and Daemons";
homepage = "https://github.com/linux-rdma/rdma-core";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ markuskowa ];
};
}

View File

@ -35,5 +35,6 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.mit;
cross = true;
};
}

View File

@ -5,23 +5,14 @@
, automake
, autoconf
, libtool
, mpi
, autoreconfHook
, gpi-2
, boost
, numactl
, rdma-core
, gfortran
, symlinkJoin
}:
let
mpiAll = symlinkJoin {
name = "mpi-all";
paths = [ mpi.all ];
};
in
stdenv.mkDerivation rec {
pname = "tagaspi";
enableParallelBuilding = true;
@ -35,16 +26,18 @@ stdenv.mkDerivation rec {
hash = "sha256-RGG/Re2uM293HduZfGzKUWioDtwnSYYdfeG9pVrX9EM=";
};
buildInputs = [
nativeBuildInputs = [
autoreconfHook
automake
autoconf
libtool
gfortran
];
buildInputs = [
boost
numactl
rdma-core
gfortran
mpiAll
];
dontDisableStatic = true;
@ -63,5 +56,6 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl3Plus;
cross = false; # gpi-2 cannot cross
};
}

View File

@ -68,5 +68,6 @@ in stdenv.mkDerivation {
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl3Plus;
cross = true;
};
}

263
pkgs/vite/cmake.patch Normal file
View File

@ -0,0 +1,263 @@
--- a/src/CMakeLists.txt 2020-11-21 14:05:24.912896596 +0100
+++ b/src/CMakeLists.txt 2020-11-21 14:19:30.978284644 +0100
@@ -130,8 +130,7 @@ SET(VITE_HDRS
# Plugin header
plugin/Command_window.hpp
plugin/Plugin_window.hpp
- plugin/Plugin.hpp
- )
+ plugin/Plugin.hpp)
SET(VITE_UIS
interface/info_window.ui
@@ -142,8 +141,7 @@ SET(VITE_UIS
interface/list_of_counter_to_export.ui
interface/node_select.ui
interface/interval_select.ui
- interface/statistics.ui
- )
+ interface/statistics.ui)
SET(VITE_SRCS
# Messages & Errors
@@ -220,29 +218,23 @@ SET(VITE_SRCS
core/Core.cpp
core/getopt.c
# Main
- main.cpp
- )
+ main.cpp)
-SET(VITE_RCCS
- interface/vite.qrc
- )
+SET(VITE_RCCS interface/vite.qrc)
#############################################
# QtColorPicker
#############################################
set(QTCOLORPICKERDIR
- ${CMAKE_SOURCE_DIR}/externals/qtcolorpicker/src
- )
+ ${CMAKE_SOURCE_DIR}/externals/qtcolorpicker/src)
set(VITE_HDRS
${VITE_HDRS}
- ${QTCOLORPICKERDIR}/qtcolorpicker.h
- )
+ ${QTCOLORPICKERDIR}/qtcolorpicker.h)
set(VITE_SRCS
${VITE_SRCS}
- ${QTCOLORPICKERDIR}/qtcolorpicker.cpp
- )
+ ${QTCOLORPICKERDIR}/qtcolorpicker.cpp)
#############################################
# VBO
@@ -252,15 +244,13 @@ IF(VITE_ENABLE_VBO)
${VITE_HDRS}
render/vbo.hpp
render/Shader.hpp
- render/Render_alternate.hpp
- )
+ render/Render_alternate.hpp)
SET(VITE_SRCS
${VITE_SRCS}
render/vbo.cpp
render/Shader.cpp
- render/Render_alternate.cpp
- )
+ render/Render_alternate.cpp)
ENDIF(VITE_ENABLE_VBO)
#############################################
@@ -271,29 +261,25 @@ IF(VITE_ENABLE_OTF)
${VITE_HDRS}
parser/OTFParser/ParserDefinitionOTF.hpp
parser/OTFParser/ParserEventOTF.hpp
- parser/OTFParser/ParserOTF.hpp
- )
+ parser/OTFParser/ParserOTF.hpp)
SET(VITE_SRCS
${VITE_SRCS}
parser/OTFParser/ParserDefinitionOTF.cpp
parser/OTFParser/ParserEventOTF.cpp
- parser/OTFParser/ParserOTF.cpp
- )
+ parser/OTFParser/ParserOTF.cpp)
IF(VITE_ENABLE_MT_PARSERS)
SET(VITE_HDRS
${VITE_HDRS}
parser/OTFParser/mt_ParserEventOTF.hpp
parser/OTFParser/mt_ParserOTF.hpp
- parser/OTFParser/OTFTraceBuilderThread.hpp
- )
+ parser/OTFParser/OTFTraceBuilderThread.hpp)
SET(VITE_SRCS
${VITE_SRCS}
parser/OTFParser/mt_ParserEventOTF.cpp
parser/OTFParser/mt_ParserOTF.cpp
- parser/OTFParser/OTFTraceBuilderThread.cpp
- )
+ parser/OTFParser/OTFTraceBuilderThread.cpp)
ENDIF()
INCLUDE_DIRECTORIES(BEFORE ${OTF_INCLUDE_DIR})
@@ -310,15 +296,13 @@ IF(VITE_ENABLE_OTF2)
${VITE_HDRS}
parser/OTF2Parser/ParserDefinitionOTF2.hpp
parser/OTF2Parser/ParserEventOTF2.hpp
- parser/OTF2Parser/ParserOTF2.hpp
- )
+ parser/OTF2Parser/ParserOTF2.hpp)
SET(VITE_SRCS
${VITE_SRCS}
parser/OTF2Parser/ParserDefinitionOTF2.cpp
parser/OTF2Parser/ParserEventOTF2.cpp
- parser/OTF2Parser/ParserOTF2.cpp
- )
+ parser/OTF2Parser/ParserOTF2.cpp)
INCLUDE_DIRECTORIES(${OTF2_INCLUDE_DIR})
@@ -332,13 +316,11 @@ IF(VITE_ENABLE_TAU)
SET(VITE_HDRS
${VITE_HDRS}
parser/TauParser/ParserTau.hpp
- parser/TauParser/TauStructs.hpp
- )
+ parser/TauParser/TauStructs.hpp)
SET(VITE_SRCS
${VITE_SRCS}
- parser/TauParser/ParserTau.cpp
- )
+ parser/TauParser/ParserTau.cpp)
INCLUDE_DIRECTORIES(${TAU_INCLUDE_DIR})
@@ -357,8 +339,7 @@ IF(VITE_ENABLE_MT_PARSERS)
parser/PajeParser/mt_ParserPaje.hpp
parser/PajeParser/mt_PajeFileManager.hpp
parser/PajeParser/BuilderThread.hpp
- trace/TraceBuilderThread.hpp
- )
+ trace/TraceBuilderThread.hpp)
SET(VITE_SRCS
${VITE_SRCS}
@@ -367,8 +348,7 @@ IF(VITE_ENABLE_MT_PARSERS)
parser/PajeParser/mt_ParserPaje.cpp
parser/PajeParser/mt_PajeFileManager.cpp
parser/PajeParser/BuilderThread.cpp
- trace/TraceBuilderThread.cpp
- )
+ trace/TraceBuilderThread.cpp)
ENDIF()
@@ -385,16 +365,14 @@ IF(VITE_ENABLE_SERIALIZATION)
parser/ParserSplitted.hpp
trace/IntervalOfContainer.hpp
trace/SerializerWriter.hpp
- trace/SerializerDispatcher.hpp
- )
+ trace/SerializerDispatcher.hpp)
SET(VITE_SRCS
${VITE_SRCS}
parser/ParserSplitted.cpp
trace/IntervalOfContainer.cpp
trace/SerializerWriter.cpp
- trace/SerializerDispatcher.cpp
- )
+ trace/SerializerDispatcher.cpp)
ENDIF(VITE_ENABLE_SERIALIZATION)
@@ -421,24 +399,22 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}/common
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
- ${QTCOLORPICKERDIR}
- )
+ ${QTCOLORPICKERDIR})
#ADD_LIBRARY(vite2 SHARED ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS})
-IF( VITE_ENABLE_OTF )
- LINK_DIRECTORIES( ${OTF_LIBRARY_DIR} )
-ENDIF( VITE_ENABLE_OTF )
+IF(VITE_ENABLE_OTF)
+ LINK_DIRECTORIES(${OTF_LIBRARY_DIR})
+ENDIF(VITE_ENABLE_OTF)
IF(VITE_ENABLE_OTF2)
- LINK_DIRECTORIES(${OTF2_LIBRARY_DIR} )
+ LINK_DIRECTORIES(${OTF2_LIBRARY_DIR})
ENDIF(VITE_ENABLE_OTF2)
#resource
IF(WIN32)
set(VITE_RES
"${PROJECT_SOURCE_DIR}/src/interface/icon/logo.ico"
- "${PROJECT_SOURCE_DIR}/src/interface/windows_icon.rc"
- )
+ "${PROJECT_SOURCE_DIR}/src/interface/windows_icon.rc")
ENDIF(WIN32)
if( APPLE )
@@ -456,7 +432,11 @@ if( APPLE )
MACOSX_BUNDLE_COPYRIGHT "INRIA 2006-2012"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/vite-info.plist.in)
else( APPLE )
- ADD_EXECUTABLE(vite ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS} ${VITE_RES})
+ message("VITE_SRCS" ${VITE_SRCS} "END")
+ message("VITE_MOC" ${VITE_MOC} "END")
+ message("VITE_RCC_SRCS" ${VITE_RCC_SRCS} "END")
+ message("VITE_RES" ${VITE_RES} "END")
+ ADD_EXECUTABLE(vite ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS})
endif( APPLE )
#############################################
@@ -470,31 +450,22 @@ TARGET_LINK_LIBRARIES(vite
${QT_LIBRARIES}
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
- ${Boost_LIBRARIES}
- )
+ ${Boost_LIBRARIES})
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- TARGET_LINK_LIBRARIES(vite
- rt
- )
+ TARGET_LINK_LIBRARIES(vite rt)
#ADD_DEFINITIONS("-DBOOST_GZIP")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF(VITE_ENABLE_VBO)
- TARGET_LINK_LIBRARIES(vite
- ${GLEW_LIBRARY}
- )
+ TARGET_LINK_LIBRARIES(vite ${GLEW_LIBRARY})
ENDIF(VITE_ENABLE_VBO)
IF(VITE_ENABLE_OTF)
- TARGET_LINK_LIBRARIES(vite
- ${OTF_LIBRARY}
- )
+ TARGET_LINK_LIBRARIES(vite ${OTF_LIBRARY})
# if OTF is compiled with zlib support we need to add it
IF(WIN32)
- TARGET_LINK_LIBRARIES(vite
- ${ZLIB_LIBRARY}
- )
+ TARGET_LINK_LIBRARIES(vite ${ZLIB_LIBRARY})
ENDIF(WIN32)
ENDIF(VITE_ENABLE_OTF)

83
pkgs/vite/default.nix Normal file
View File

@ -0,0 +1,83 @@
{
fetchgit
, stdenv
, cmake
, qtbase
, qttools
, qtcharts
, libGLU
, libGL
, glm
, glew
, wrapQtAppsHook
, otf ? null
}:
with lib;
# ViTE 1.1 has several bugs, so use the SVN version.
let
#rev = "1543";
#externals = fetchsvn {
# url = "svn://scm.gforge.inria.fr/svn/vite/externals";
# sha256 = "1a422n3dp72v4visq5b1i21cf8sj12903sgg5v2hah3sgk02dnyz";
# inherit rev;
#};
in
stdenv.mkDerivation rec {
version = "c6c0ce7";
pname = "vite";
#dontStrip = true;
#enableDebugging = true;
preferLocalBuild = true;
#src = ./../../vite-c6c0ce7;
src = fetchgit {
url = "https://gitlab.inria.fr/solverstack/vite.git";
sha256 = "17h57jjcdynnjd6s19hs6zdgvr9j7hj1rf6a62d9qky8wzb78y37";
#rev = "373d4a8ebe86aa9ed07c9a8eb5e5e7f1602baef9";
rev = "c6c0ce7a75324f03b24243397dfaa0d3bcd5bd1b";
};
#patches = [ ./cmake.patch ];
#preConfigure = ''
# rm -rv externals
# ln -sv "${externals}" externals
#'';
buildInputs = [
cmake qtbase qttools qtcharts
libGLU libGL glm glew wrapQtAppsHook
] ++ optional (otf != null) otf;
#NIX_LDFLAGS = "-lGLU";
cmakeFlags = [
# "-DCMAKE_BUILD_TYPE=Debug"
#"-DVITE_ENABLE_OTF2=True"
#"-DVITE_ENABLE_TAU=True"
]
++ optionals (otf != null)
[
"-DVITE_ENABLE_OTF=True"
"-DOTF_LIBRARY_DIR=${otf}/lib"
"-DOTF_INCLUDE_DIR=${otf}/include"
];
meta = {
description = "Visual Trace Explorer (ViTE), a tool to visualize execution traces";
longDescription = ''
ViTE is a trace explorer. It is a tool to visualize execution
traces in Pajé or OTF format for debugging and profiling
parallel or distributed applications.
'';
homepage = "http://vite.gforge.inria.fr/";
license = lib.licenses.cecill20;
maintainers = with lib.maintainers; [ ];
platforms = lib.platforms.linux;
};
}

77
pkgs/vtk/default.nix Normal file
View File

@ -0,0 +1,77 @@
{
stdenv
, lib
, fetchurl
, cmake
, libGLU
, libGL
, libX11
, xorgproto
, libXt
, libtiff
, qtLib ? null
, enablePython ? false, python ? null
, mpi ? null
}:
with lib;
let
os = lib.optionalString;
majorVersion = "8.2";
minorVersion = "0";
version = "${majorVersion}.${minorVersion}";
in
stdenv.mkDerivation rec {
name = "vtk-${os (qtLib != null) "qvtk-"}${version}";
src = fetchurl {
url = "${meta.homepage}files/release/${majorVersion}/VTK-${version}.tar.gz";
sha256 = "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ libtiff ]
++ optionals (qtLib != null) (with qtLib; [ qtbase qtx11extras qttools ])
++ optional (qtLib != null) (with qtLib; [ qtbase qtx11extras qttools ])
++ optionals stdenv.isLinux [ libGLU libGL libX11 xorgproto libXt ]
++ optional enablePython [ python ]
++ optional (mpi != null) [ mpi ];
preBuild = ''
export LD_LIBRARY_PATH="$(pwd)/lib";
'';
# Shared libraries don't work, because of rpath troubles with the current
# nixpkgs cmake approach. It wants to call a binary at build time, just
# built and requiring one of the shared objects.
# At least, we use -fPIC for other packages to be able to use this in shared
# objects.
cmakeFlags = [
"-DCMAKE_C_FLAGS=-fPIC"
"-DCMAKE_CXX_FLAGS=-fPIC"
"-DVTK_USE_SYSTEM_TIFF=1"
"-DVTK_Group_MPI=ON"
"-DBUILD_SHARED_LIBS=ON"
"-DOPENGL_INCLUDE_DIR=${libGL}/include"
]
++ optional (mpi != null) [
"-DVTK_Group_MPI=ON" ]
++ optional (qtLib != null) [
"-DVTK_Group_Qt:BOOL=ON" ]
++ optional stdenv.isDarwin [
"-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks" ]
++ optional enablePython [
"-DVTK_WRAP_PYTHON:BOOL=ON" ];
enableParallelBuilding = true;
meta = {
description = "Open source libraries for 3D computer graphics, image processing and visualization";
homepage = "https://www.vtk.org/";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ knedlsepp ];
platforms = with lib.platforms; unix;
};
}