From db681d419d46fa111da209e2e75af087377ae554 Mon Sep 17 00:00:00 2001 From: James Brock Date: Mon, 19 Feb 2024 17:25:53 +0900 Subject: [PATCH] flake.nix instead of shell.nix --- README.md | 4 ++-- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 27 ++++++++++++++++++++++++ shell.nix | 26 ----------------------- 4 files changed, 90 insertions(+), 28 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/README.md b/README.md index 0235f8a..dca7e49 100644 --- a/README.md +++ b/README.md @@ -549,11 +549,11 @@ for various parts of the library. ### Nix -The file `shell.nix` declares a *Nix* shell environment which provides all +The file `flake.nix` declares a *Nix* shell development environment which provides all dependencies for every target in the `Makefile`, including *Doxygen*. Enter the *Nix* shell by [installing *Nix*](https://nixos.org/download.html) -and then running `nix-shell` in this directory. From the `nix-shell` prompt, +and then running `nix develop` in this directory. From the `nix develop` prompt, you will be able to build all `Makefile` targets. ### Pull Requests diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..77bbcc4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1708161998, + "narHash": "sha256-6KnemmUorCvlcAvGziFosAVkrlWZGIc6UNT9GUYr0jQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "84d981bae8b5e783b3b548de505b22880559515f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "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", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8a8c42a --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "hffix"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, ... }@inputs: + inputs.flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ doxygen stack gmp zlib ]; + buildInputs = with pkgs; [ boost ]; + LC_ALL = "C.UTF-8"; + shellHook = '' + echo "" + echo ' hffix Development Environment' + echo ' To run the test suite: make test' + echo "" + ''; + }; + }); +} \ No newline at end of file diff --git a/shell.nix b/shell.nix deleted file mode 100644 index f2c3d3b..0000000 --- a/shell.nix +++ /dev/null @@ -1,26 +0,0 @@ -# In the nix-shell environment, this derivation should provide everything -# needed for all of the Makefile targets - -{ pkgs ? import (builtins.fetchGit { - # https://github.com/NixOS/nixpkgs/releases/tag/21.11 - url = "https://github.com/nixos/nixpkgs/"; - ref = "refs/tags/21.11"; - rev = "a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31"; - }) {} -}: - -pkgs.stdenv.mkDerivation { -# clangStdenv.mkDerivation { -- TODO clang - name = "hffix"; - src = ./.; - - buildInputs = with pkgs; [ boost doxygen stack gmp zlib ]; -# buildInputs = [ boost doxygen stack gmp zlib clang]; -- TODO clang - shellHook = '' - export LANG=C.UTF-8 - echo "" - echo ' hffix Development Environment' - echo ' To run the test suite: make test' - echo "" - ''; -}