From 58292b7c0c52d7bd90435cdcfdaa8e821085019b Mon Sep 17 00:00:00 2001 From: Zebreus Date: Tue, 11 Jun 2024 14:51:50 +0200 Subject: [PATCH] Add nix flake --- flake.lock | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 66 ++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000000000..83cd7a7397c3db --- /dev/null +++ b/flake.lock @@ -0,0 +1,117 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1699942952, + "narHash": "sha256-ll8hFcTDhCvCfaKJwe7F3Ohh8YYHHSAtQTO0K7FBHgk=", + "owner": "nix-community", + "repo": "fenix", + "rev": "1b820065cefcdbe5af6829eb7d3d1b20e98ec960", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1698242985, + "narHash": "sha256-FvFP1cjTJK55aggv39WAL4YFETXvC3kV8lIo3VkxCQ4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fce7a4cccacd628ab9963bdfca40eb78addbaa53", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "refs/heads/master", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-asciidoc": { + "locked": { + "lastModified": 1686065153, + "narHash": "sha256-0Dqszmgln0a9sNokD47eVseSaP4wQ95iISUQcsZCH+s=", + "owner": "zebreus", + "repo": "nixpkgs", + "rev": "f1a3be7a1160cc4810c0274ab76f0fac813eb4d6", + "type": "github" + }, + "original": { + "owner": "zebreus", + "ref": "f1a3be7a1160cc4810c0274ab76f0fac813eb4d6", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nixpkgs-asciidoc": "nixpkgs-asciidoc" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1699808862, + "narHash": "sha256-gjMqmlCvLVlptL35HHvALrOKrFyxjg5hryXbbpVyoeY=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "416e9c856a792ce2214c449677ca0a1f38965248", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "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", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000000000..1e9c8e6088f609 --- /dev/null +++ b/flake.nix @@ -0,0 +1,66 @@ +{ + description = "High-performance computing projects"; + + inputs = { + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixpkgs.url = "github:nixos/nixpkgs?ref=refs/heads/master"; + nixpkgs-asciidoc.url = "github:zebreus/nixpkgs?ref=f1a3be7a1160cc4810c0274ab76f0fac813eb4d6"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + nixpkgs-asciidoc, + fenix, + }: + flake-utils.lib.eachDefaultSystem ( + system: + with nixpkgs.legacyPackages.${system}; + let + pkgs-with-asciidoc = import nixpkgs-asciidoc { inherit system; }; + pkgs-fenix = fenix.packages.${system}; + in + rec { + + name = "high-performance-computing"; + packages.default = llvmPackages_16.stdenv.mkDerivation { + name = name; + src = ./.; + + buildInputs = [ + llvmPackages_16.openmp + gcc12 + clang_16 + + openmpi + gnumake + zlib + sshfs + + clang-tools_16 + lldb + nil + + (pkgs-fenix.complete.withComponents [ + "cargo" + "clippy" + "rust-src" + "rustc" + "rustfmt" + ]) + pkgs-fenix.rust-analyzer + python3 + gnumake + cmake + protobuf + ]; + }; + } + ); +}