From fb18dcebcf611375ef4887041bc3b79008246178 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Tue, 26 Dec 2023 18:39:42 -0700 Subject: [PATCH] nix: shell -> flake Signed-off-by: Sumner Evans --- .envrc | 6 +++++- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 33 +++++++++++++++++++++++++++++ shell.nix | 20 ------------------ 4 files changed, 99 insertions(+), 21 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/.envrc b/.envrc index 9d49e6ca..4520fd18 100644 --- a/.envrc +++ b/.envrc @@ -1,4 +1,8 @@ if [[ $(uname -s) == "Linux" && $(uname --kernel-version | grep "NixOS") ]]; then echo "The best OS (NixOS) has been detected. Using nice tools." - use nix + if ! has nix_direnv_version || ! nix_direnv_version 3.0.0; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.0/direnvrc" "sha256-21TMnI2xWX7HkSTjFFri2UaohXVj854mgvWapWrxRXg=" + fi + + use flake fi diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..80c53416 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1703255338, + "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "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 00000000..cbb2b616 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "mautrix-signal development environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + (flake-utils.lib.eachDefaultSystem (system: + let pkgs = import nixpkgs { inherit system; }; + in { + devShells.default = pkgs.mkShell { + LIBCLANG_PATH = "${pkgs.llvmPackages_11.libclang.lib}/lib"; + + buildInputs = with pkgs; [ + clang + cmake + gnumake + protobuf + rust-cbindgen + rustup + olm + + go_1_20 + go-tools + gotools + + pre-commit + ]; + }; + })); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 3326dac0..00000000 --- a/shell.nix +++ /dev/null @@ -1,20 +0,0 @@ -with import { }; -let -in -mkShell rec { - buildInputs = [ - clang - cmake - gnumake - protobuf - rust-cbindgen - rustup - olm - - go_1_20 - - pre-commit - ]; - - LIBCLANG_PATH = "${pkgs.llvmPackages_11.libclang.lib}/lib"; -}