From 80dabd9cc10e6a4242a763764f49b4469f846308 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Tue, 9 Apr 2024 15:01:07 +0200 Subject: [PATCH] fix Nix code and flakes --- default.nix | 31 +------------------------------ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 18 ++++++++++++++++++ package.nix | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 30 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 package.nix diff --git a/default.nix b/default.nix index d786514..dda6674 100644 --- a/default.nix +++ b/default.nix @@ -3,33 +3,4 @@ let version = "dev"; pkgs = import {}; -in with pkgs; stdenv.mkDerivation { - pname = "qdng"; - inherit version; - - src = builtins.filterSource (path: type: path != ".git" && path != "result" && path != "build") ./.; - - configureFlags = [ - "--enable-openmp" - "--with-blas=-lblas" - "--with-lapack=-llapack" - "--disable-gccopt" - ]; - - enableParallelBuilding = true; - - preConfigure = '' - ./genbs - ''; - - buildInputs = [ fftw protobuf blas lapack - bzip2 zlib libxml2 flex bison ]; - nativeBuildInputs = [ automake autoconf libtool gfortran ]; - - meta = with lib; { - description = "Quantum dynamics program package"; - platforms = platforms.linux; - maintainer = [ maintainers.markuskowa ]; - license = licenses.unfree; - }; -} +in pkgs.callPackage ./package.nix { protobuf = pkgs.protobuf3_21; } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4a071a3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1712588820, + "narHash": "sha256-y31s5idk3jMJMAVE4Ud9AdI7HT3CgTAeMTJ0StqKN7Y=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d272ca50d1f7424fbfcd1e6f1c9e01d92f6da167", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..bd6a3a3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Quantum dynamics program package"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11"; + }; + + outputs = { self, nixpkgs }: { + + packages.x86_64-linux = let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + inherit (pkgs) lib callPackage; + in { + qdng = callPackage ./package.nix { protobuf = pkgs.protobuf3_21; }; + default = self.packages.x86_64-linux.qdng; + }; + }; +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..e5aacaa --- /dev/null +++ b/package.nix @@ -0,0 +1,36 @@ +{ lib, stdenv, fetchurl, requireFile, gfortran, fftw, protobuf +, blas, lapack +, automake, autoconf, libtool, zlib, bzip2, libxml2, flex, bison +} : + +stdenv.mkDerivation rec { + pname = "qdng"; + version = "1.0.0"; + + src = builtins.filterSource (path: type: path != ".git" && path != "result" && path != "build") ./.; + + configureFlags = [ + "--enable-openmp" + "--with-blas=-lblas" + "--with-lapack=-llapack" + "--disable-gccopt" + ]; + + enableParallelBuilding = true; + + preConfigure = '' + ./genbs + ''; + + buildInputs = [ fftw protobuf blas lapack + bzip2 zlib libxml2 flex bison ]; + nativeBuildInputs = [ automake autoconf libtool gfortran ]; + + meta = with lib; { + description = "Quantum dynamics program package"; + platforms = platforms.linux; + maintainer = [ maintainers.markuskowa ]; + license = licenses.gpl3Only; + }; +} +