diff options
| author | Fuwn <[email protected]> | 2024-09-14 09:17:44 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-09-14 09:17:44 +0000 |
| commit | 0870052b3f854e7d275b722c5eafb3b23324eadb (patch) | |
| tree | 94a02b76971bfcf800b6e641e90e64cc53b85a87 | |
| parent | fix(html): selection and highlighting borders (diff) | |
| download | september-0870052b3f854e7d275b722c5eafb3b23324eadb.tar.xz september-0870052b3f854e7d275b722c5eafb3b23324eadb.zip | |
chore(nix): flake-based development shell
| -rw-r--r-- | .envrc | 10 | ||||
| -rw-r--r-- | flake.lock | 82 | ||||
| -rw-r--r-- | flake.nix | 46 |
3 files changed, 138 insertions, 0 deletions
@@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +if type -P lorri &>/dev/null; then + eval "$(lorri direnv)" +else + echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]' + + use nix +fi + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6d4ee0d --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1726206720, + "narHash": "sha256-tI7141IHDABMNgz4iXDo8agCp0SeTLbaIZ2DRndwcmk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "673d99f1406cb09b8eb6feab4743ebdf70046557", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726280639, + "narHash": "sha256-YfLRPlFZWrT2oRLNAoqf7G3+NnUTDdlIJk6tmBU7kXM=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "e9f8641c92f26fd1e076e705edb12147c384171d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "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..493b0fc --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + nixpkgs, + flake-utils, + rust-overlay, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; + in + { + devShell = + with pkgs; + mkShell.override + { + stdenv = stdenvAdapters.useMoldLinker clangStdenv; + } + { + nativeBuildInputs = [ + rust-bin.stable.latest.default + cargo-make + openssl + pkg-config + cargo-watch + ]; + + # https://discourse.nixos.org/t/rust-src-not-found-and-other-misadventures-of-developing-rust-on-nixos/11570/5?u=fuwn + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + }; + } + ); +} |