refactored dev flake to rust overlay, added deno to flake

This commit is contained in:
Wyatt J. Miller 2024-09-21 23:57:23 -04:00
parent 6653f7d982
commit 13a40353e5
2 changed files with 75 additions and 68 deletions

View File

@ -1,21 +1,17 @@
{ {
"nodes": { "nodes": {
"flake-utils": { "flake-schemas": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1721999734,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=",
"owner": "numtide", "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982",
"repo": "flake-utils", "revCount": 75,
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "tarball",
"type": "github" "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz"
}, },
"original": { "original": {
"owner": "numtide", "type": "tarball",
"repo": "flake-utils", "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
"type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
@ -32,41 +28,30 @@
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz" "url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
} }
}, },
"nixpkgs-unstable": {
"locked": {
"lastModified": 1725103162,
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-schemas": "flake-schemas",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable" "rust-overlay": "rust-overlay"
} }
}, },
"systems": { "rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1726799228,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-wn1leQyMAc/TrLRKcPc0GX6YtoziKQpc/MtZjPNiJ2Q=",
"owner": "nix-systems", "owner": "oxalica",
"repo": "default", "repo": "rust-overlay",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "rev": "ab150c7412db7bea5879ce2776718f53fba37aa2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-systems", "owner": "oxalica",
"repo": "default", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
} }

View File

@ -1,49 +1,71 @@
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.10) # This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.10)
{ {
description = "My personal website version 2.0"; # A helpful description of your flake
description = "A Gitea command line application";
# Flake inputs
inputs = { inputs = {
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz"; nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
# Flake outputs that other flakes can use
outputs = outputs =
{ self { self
, flake-schemas
, nixpkgs , nixpkgs
, nixpkgs-unstable , rust-overlay
, flake-utils
, ,
}: }:
flake-utils.lib.eachDefaultSystem (
system:
let let
pkgs = import nixpkgs { # Nixpkgs overlays
inherit system;
overlays = [ overlays = [
rust-overlay.overlays.default
(final: prev: { (final: prev: {
deno = nixpkgs-unstable.legacyPackages.${system}.deno; 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 in
{ {
devShells.default = pkgs.mkShell { # Schemas tell Nix about the structure of your flake's outputs
buildInputs = with pkgs; [ schemas = flake-schemas.schemas;
deno
rustc # Development environments
cargo devShells = forEachSupportedSystem ({ pkgs }: {
cargo-edit default = pkgs.mkShell {
cargo-watch # Pinned packages available in the environment
cargo-vet packages = with pkgs; [
sqlx-cli rustToolchain
rust-analyzer
curl curl
git git
jq jq
wget wget
nixpkgs-fmt nixpkgs-fmt
openssl
deno
]; ];
# Environment variables
env = {
RUST_BACKTRACE = "1";
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
};
};
});
}; };
}
);
} }