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": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"flake-schemas": {
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
"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": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
"type": "tarball",
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
}
},
"nixpkgs": {
@ -32,41 +28,30 @@
"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": {
"inputs": {
"flake-utils": "flake-utils",
"flake-schemas": "flake-schemas",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
"rust-overlay": "rust-overlay"
}
},
"systems": {
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"lastModified": 1726799228,
"narHash": "sha256-wn1leQyMAc/TrLRKcPc0GX6YtoziKQpc/MtZjPNiJ2Q=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "ab150c7412db7bea5879ce2776718f53fba37aa2",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}

View File

@ -1,49 +1,71 @@
# 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 = {
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.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 =
{ self
, flake-schemas
, nixpkgs
, nixpkgs-unstable
, flake-utils
, rust-overlay
,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
deno = nixpkgs-unstable.legacyPackages.${system}.deno;
})
];
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
deno
rustc
cargo
cargo-edit
cargo-watch
cargo-vet
sqlx-cli
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
deno
];
# Environment variables
env = {
RUST_BACKTRACE = "1";
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
};
};
}
);
});
};
}