From 2a275d17fbbe18c5ca74ee5c2ff2fb07a6fb84e2 Mon Sep 17 00:00:00 2001 From: Joris Date: Fri, 12 Nov 2021 17:37:03 +0100 Subject: Use nix flakes --- README.md | 2 +- flake.lock | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 32 ++++++++++++++++++++++++++++++ shell.nix | 29 --------------------------- 4 files changed, 99 insertions(+), 30 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 2a62359..d346bd3 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ # Getting started -1. Use `nix-shell` to download dependencies. +1. Use `nix develop` to download dependencies. 2. Initialize the database with `bin/db init`. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d557ed5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,66 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1634851050, + "narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c91f3de5adaf1de973b797ef7485e441a65b8935", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1636730720, + "narHash": "sha256-JuZ9Zjy3Z/dChL6szbAVCstQoNzI1TKJaWIPlMmTkqA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "860795fd7e65502728c96e54f251e2a733a771e7", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1636683315, + "narHash": "sha256-udsMHw5gzZPvvFIhopoGicLK/LaYyDN3iAa1PEpP7uM=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "e87b7ea329fc78c5e5775c983193f630458c317f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..15ec82b --- /dev/null +++ b/flake.nix @@ -0,0 +1,32 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay.url = "github:oxalica/rust-overlay"; + rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; + rust-overlay.inputs.flake-utils.follows = "flake-utils"; + }; + + outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + in + with pkgs; + { + devShell = mkShell { + buildInputs = [ + ((rustChannelOf { channel = "1.56.1"; }).rust) + cargo-watch + lld + openssl + pkgconfig + sqlite + ]; + }; + } + ); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 043940c..0000000 --- a/shell.nix +++ /dev/null @@ -1,29 +0,0 @@ -with import (builtins.fetchGit { - name = "nixos-21.05-2021-10-09"; - url = "https://github.com/nixos/nixpkgs/"; - ref = "refs/heads/nixos-21.05"; - rev = "ce7a1190a0fa4ba3465b5f5471b08567060ca14c"; -}) {}; - -let nixpkgs-mozilla = fetchFromGitHub { - owner = "mozilla"; - repo = "nixpkgs-mozilla"; - # commit from 2021-07-17 - rev = "0510159186dd2ef46e5464484fbdf119393afa58"; - sha256 = "1zybp62zz0h077zm2zmqs2wcg3whg6jqaah9hcl1gv4x8af4zhs6"; -}; in - -with import "${nixpkgs-mozilla.out}/rust-overlay.nix" pkgs pkgs; - -pkgs.mkShell { - - buildInputs = [ - ((rustChannelOf { channel = "1.55.0"; }).rust) - cargo-watch - lld - openssl - pkgconfig - sqlite - ]; - -} -- cgit v1.2.3