Switch to flakes

main
Elnu 9 months ago
parent 90a2c6d4a4
commit f1d2e59b89

@ -1 +1 @@
use nix
use flake

1
.gitignore vendored

@ -1 +1,2 @@
/target
.direnv

@ -0,0 +1,129 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1691472822,
"narHash": "sha256-XVfYZ2oB3lNPVq6sHCY9WkdQ8lHoIDzzbpg8bB6oBxA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "41c7605718399dcfa53dd7083793b6ae3bc969ff",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"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": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1691591308,
"narHash": "sha256-eeErUrPWCQwFHESL3vpNwkl8oyJPV6SRrVS9cPTEvYI=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "094512d7a7573ae2cb6db1a5ce4745a69b16fa46",
"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"
}
},
"systems_2": {
"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
}

@ -0,0 +1,44 @@
{
description = "Miscellaneous utility APIs hosted on jichan.org";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit overlays;
system = "x86_64-linux";
};
rustSettings = with pkgs; {
src = ./.;
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
cargoHash = nixpkgs.lib.fakeHash;
};
in
with pkgs; rec {
devShells.x86_64-linux.default = mkShell {
packages = [ bacon ];
inputsFrom = [
packages.x86_64-linux.tatoeba
packages.x86_64-linux.images
];
};
packages.x86_64-linux.tatoeba = rustPlatform.buildRustPackage (rustSettings // {
pname = "tatoeba";
version = "0.1.0";
buildAndTestSubdir = "tatoeba";
cargoHash = "sha256-74Jq3saaUyPvNm/0croVOBuMtpN8xT3S4z37nutJdw4=";
});
packages.x86_64-linux.images = rustPlatform.buildRustPackage (rustSettings // {
pname = "images";
version = "0.1.0";
buildAndTestSubdir = "images";
cargoHash = "sha256-fKmTZTcJj/eYCQE9cjiXB/Pt6BdJNZ/e5cSRgbuPIJs=";
});
};
}

@ -1,21 +0,0 @@
# <shell.nix>
{ pkgs ? import <nixpkgs> {}}:
let
rust_overlay = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz");
pkgs = import <nixpkgs> { overlays = [ rust_overlay ]; };
ruststable = (pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
];
});
in
pkgs.mkShell {
buildInputs = with pkgs; [
ruststable
rust-analyzer
bacon
pkg-config
openssl
];
}
Loading…
Cancel
Save