add flake

This commit is contained in:
mehbark 2026-07-08 00:10:28 -04:00
parent 37ffabc867
commit a443b3bc5d
5 changed files with 89 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
perf.data perf.data
perf.data.old perf.data.old
flamegraph.svg flamegraph.svg
.direnv

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1783224372,
"narHash": "sha256-8i/87eeoqiGE4yOTjwSA3Eh/ziJRQEmd/unYU+K27sk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d407951447dcd00442e97087bf374aad70c04cea",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

25
flake.nix Normal file
View file

@ -0,0 +1,25 @@
{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [];
};
packages.default = pkgs.rustPlatform.buildRustPackage (finalAttrs: {
pname = "dynamic-pangramming";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
});
}
);
}

View file

@ -47,6 +47,7 @@ fn solve(dictionary: &mut [(String, LetterSet)], target: LetterSet) -> Option<(u
let mut path = vec![start]; let mut path = vec![start];
let mut done = LetterSet::from(start); let mut done = LetterSet::from(start);
// this fails sometimes with non-full targets
while let (_, Some(word)) = bests[done.to_index()] { while let (_, Some(word)) = bests[done.to_index()] {
path.push(word); path.push(word);
done = done.union(LetterSet::from(word)); done = done.union(LetterSet::from(word));