chore: direnv with lorri

This commit is contained in:
Jeremy Wall 2025-07-21 18:24:47 -04:00
parent 5ae4b91004
commit 608cb22e1d
4 changed files with 84 additions and 47 deletions

7
.envrc Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
if has lorri; then
eval "$(lorri direnv)"
elif has nix; then
use flake
fi

98
flake.lock generated
View File

@ -1,13 +1,35 @@
{ {
"nodes": { "nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"naersk",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1752475459,
"narHash": "sha256-z6QEu4ZFuHiqdOPbYss4/Q8B0BFhacR8ts6jO/F/aOU=",
"owner": "nix-community",
"repo": "fenix",
"rev": "bf0d6f70f4c9a9cf8845f992105652173f4b617f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1650374568, "lastModified": 1747046372,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8", "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -17,30 +39,15 @@
} }
}, },
"flake-utils": { "flake-utils": {
"locked": {
"lastModified": 1652372896,
"narHash": "sha256-lURGussfF3mGrFPQT3zgW7+RC0pBhbHzco0C7I+ilow=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "0d347c56f6f41de822a4f4c7ff5072f3382db121",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1705309234, "lastModified": 1731533236,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -51,14 +58,15 @@
}, },
"naersk": { "naersk": {
"inputs": { "inputs": {
"fenix": "fenix",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1698420672, "lastModified": 1752689277,
"narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=", "narHash": "sha256-uldUBFkZe/E7qbvxa3mH1ItrWZyT6w1dBKJQF/3ZSsc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "naersk", "repo": "naersk",
"rev": "aeb58d5e8faead8980a807c840232697982d47b9", "rev": "0e72363d0938b0208d6c646d10649164c43f4d64",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -69,25 +77,27 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1708501555, "lastModified": 1752077645,
"narHash": "sha256-zJaF0RkdIPbh8LTmnpW/E7tZYpqIE+MePzlWwUNob4c=", "narHash": "sha256-HM791ZQtXV93xtCY+ZxG1REzhQenSQO020cu6rHtAPk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b50a77c03d640716296021ad58950b1bb0345799", "rev": "be9e214982e20b8310878ac2baa063a961c1bdf6",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"type": "indirect" "ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1708542344, "lastModified": 1753135609,
"narHash": "sha256-IXJJMaRv1RlaXPsJlohwiQKM5775g+dujrPqtg5PhmQ=", "narHash": "sha256-//xMo8MwSw1HoTnIk455J7NIJpsDqwVyD69MOXb7gZM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7394735942afb1f0f826ac9aa29f419339c85b22", "rev": "5d9316e7fb2d6395818d506ef997530eba1545b7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -105,19 +115,35 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
}, },
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1752428706,
"narHash": "sha256-EJcdxw3aXfP8Ex1Nm3s0awyH9egQvB2Gu+QEnJn2Sfg=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "591e3b7624be97e4443ea7b5542c191311aa141d",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1708481452, "lastModified": 1753066249,
"narHash": "sha256-s07K6pwJtnB7Z/3wbkf4iaYXj+H5CuDD94I8hohm3Ig=", "narHash": "sha256-j2UBrfDRIePGx3532Bbb9UeosNX2F73hfOAHtmACfnM=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "3d6647bf9d1f8e537b0d026c51ea25c0cdd92055", "rev": "0751b65633a1785743ca44fd7c14a633c54c1f91",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -10,17 +10,17 @@
}; };
naersk.url = "github:nix-community/naersk"; naersk.url = "github:nix-community/naersk";
flake-compat = { flake-compat = {
url = github:edolstra/flake-compat; url = "github:edolstra/flake-compat";
flake = false; flake = false;
}; };
}; };
outputs = {self, nixpkgs, flake-utils, rust-overlay, naersk, flake-compat}: outputs = {nixpkgs, flake-utils, rust-overlay, naersk, ...}:
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
overlays = [ rust-overlay.overlays.default ]; overlays = [ rust-overlay.overlays.default ];
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
rust-bin = pkgs.rust-bin.stable."1.70.0".default.override { rust-bin = pkgs.rust-bin.stable."1.87.0".default.override {
extensions = [ "rust-src" ]; extensions = [ "rust-src" ];
# Add wasm32 as an extra target besides the native target. # Add wasm32 as an extra target besides the native target.
targets = [ "wasm32-unknown-unknown" ]; targets = [ "wasm32-unknown-unknown" ];
@ -29,13 +29,12 @@
rustc = rust-bin; rustc = rust-bin;
cargo = rust-bin; cargo = rust-bin;
}; };
ucg = with pkgs; ucg = naersk-lib.buildPackage rec {
naersk-lib.buildPackage rec { pname = "ucg";
pname = "ucg"; version = "0.7.3";
version = "0.7.3"; src = ./.;
src = ./.; cargoBuildOptions = opts: opts ++ ["-p" "${pname}" ];
cargoBuildOptions = opts: opts ++ ["-p" "${pname}" ]; };
};
in in
{ {
packages = { packages = {
@ -46,5 +45,9 @@
type = "app"; type = "app";
program = "${ucg}/bin/ucg"; program = "${ucg}/bin/ucg";
}; };
devShells.default = pkgs.mkShell {
buildInputs = [ rust-bin pkgs.rust-analyzer pkgs.cargo-tarpaulin ];
packages = with pkgs; [ gnumake ];
};
}); });
} }

1
result Symbolic link
View File

@ -0,0 +1 @@
/nix/store/38y7vjmqjcdbygjfv30csnbhr6p435dm-ucg-0.7.3