blob: 8a9d48995e469dc85d0ea0501cef6a3d1e315e99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{
description = "A very basic flake";
inputs = {
en = {
url = "https://www.gutenberg.org/cache/epub/29765/pg29765.txt";
flake = false;
};
};
outputs = { self, en, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
});
in
{
overlays.default = final: prev: {
dict =
let
pname = "dict";
packageMeta = (final.lib.importTOML ./Cargo.toml).package;
in
final.rustPlatform.buildRustPackage {
inherit pname;
inherit (packageMeta) version;
preUnpack = ''
mkdir assets
sed "1,27d;973899,$ d" ${en} > assets/en.txt
${final.dos2unix}/bin/dos2unix assets/en.txt
ls -alh assets/en.txt
'';
src = self;
cargoLock.lockFile = ./Cargo.lock;
};
};
packages = forAllSystems (system: {
inherit (nixpkgsFor."${system}") dict;
});
defaultPackage = forAllSystems (system: self.packages."${system}".dict);
devShell = forAllSystems (system:
let
pkgs = nixpkgsFor."${ system}";
in
pkgs.mkShell {
nativeBuildInputs = [
pkgs.rustc
pkgs.cargo
pkgs.rustfmt
pkgs.rust-analyzer
pkgs.cargo-watch
];
RUST_BACKTRACE = 1;
}
);
};
}
|