From 888fd3a8bd6700d22904b27be0840a484cd8e759 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sun, 25 Aug 2024 10:04:32 -0500 Subject: [PATCH] add flakes and direnv files --- .envrc | 1 + flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 61 ++++++++++++++++++++++++++++++++++++++++++++++ rust-analyzer.json | 7 ++++++ 4 files changed, 130 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 rust-analyzer.json diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..58dcec8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-schemas": { + "locked": { + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1722372011, + "narHash": "sha256-B2xRiC3NEJy/82ugtareBkRqEkPGpMyjaLxaR8LBxNs=", + "rev": "cf05eeada35e122770c5c14add958790fcfcbef5", + "revCount": 633614, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2405.633614%2Brev-cf05eeada35e122770c5c14add958790fcfcbef5/01910e77-e048-77f4-b2d4-a69cacb697db/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz" + } + }, + "root": { + "inputs": { + "flake-schemas": "flake-schemas", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722548948, + "narHash": "sha256-ddR/6wbOzRXijcOAEgeaIlbskky51eJdZhYPwoErs3s=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "0b973d3e54e497e518515c05a6e99ec6c03be2ce", + "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..92df820 --- /dev/null +++ b/flake.nix @@ -0,0 +1,61 @@ +# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.10) +{ + # A helpful description of your flake + description = "A Gitea command line application"; + + # Flake inputs + inputs = { + flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz"; + + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz"; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + # Flake outputs that other flakes can use + outputs = { self, flake-schemas, nixpkgs, rust-overlay }: + let + # Nixpkgs overlays + overlays = [ + rust-overlay.overlays.default + (final: prev: { + rustToolchain = final.rust-bin.stable.latest.default.override { extensions = [ "rust-src"]; }; + }) + ]; + + # Helpers for producing system-specific outputs + supportedSystems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit overlays system; }; + }); + in { + # Schemas tell Nix about the structure of your flake's outputs + schemas = flake-schemas.schemas; + + # Development environments + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell { + # Pinned packages available in the environment + packages = with pkgs; [ + rustToolchain + rust-analyzer + curl + git + jq + wget + nixpkgs-fmt + openssl + ]; + + # Environment variables + env = { + RUST_BACKTRACE = "1"; + RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library"; + }; + }; + }); + }; +} diff --git a/rust-analyzer.json b/rust-analyzer.json new file mode 100644 index 0000000..7bd1691 --- /dev/null +++ b/rust-analyzer.json @@ -0,0 +1,7 @@ +{ + "rust-analyzer": { + "files": { + "excludeDirs": [".direnv"] + } + } +}