aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorAkshay <[email protected]>2023-04-11 18:10:24 +0100
committerAkshay <[email protected]>2023-04-11 18:10:24 +0100
commit9ccdaee79cdbcc76c8b855a0d50b5a5309ba8bb8 (patch)
treea6e97f9c0a0af6f08669b9596b05f4df13259bbc /flake.nix
parentd315cce8e99ec6d96695bea708ae315028f3db66 (diff)
add build steps
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix43
1 files changed, 40 insertions, 3 deletions
diff --git a/flake.nix b/flake.nix
index a615408..8a9d489 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,22 +1,59 @@
1{ 1{
2 description = "A very basic flake"; 2 description = "A very basic flake";
3 3
4 outputs = { self, nixpkgs }: 4 inputs = {
5 en = {
6 url = "https://www.gutenberg.org/cache/epub/29765/pg29765.txt";
7 flake = false;
8 };
9 };
10
11 outputs = { self, en, nixpkgs }:
5 let 12 let
6 supportedSystems = [ "x86_64-linux" ]; 13 supportedSystems = [ "x86_64-linux" ];
7 forAllSystems = nixpkgs.lib.genAttrs supportedSystems; 14 forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
8 nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); 15 nixpkgsFor = forAllSystems (system: import nixpkgs {
16 inherit system;
17 overlays = [ self.overlays.default ];
18 });
9 in 19 in
10 { 20 {
11 21
22 overlays.default = final: prev: {
23 dict =
24 let
25 pname = "dict";
26 packageMeta = (final.lib.importTOML ./Cargo.toml).package;
27 in
28 final.rustPlatform.buildRustPackage {
29 inherit pname;
30 inherit (packageMeta) version;
31 preUnpack = ''
32 mkdir assets
33 sed "1,27d;973899,$ d" ${en} > assets/en.txt
34 ${final.dos2unix}/bin/dos2unix assets/en.txt
35 ls -alh assets/en.txt
36 '';
37 src = self;
38 cargoLock.lockFile = ./Cargo.lock;
39 };
40 };
41
42 packages = forAllSystems (system: {
43 inherit (nixpkgsFor."${system}") dict;
44 });
45
46 defaultPackage = forAllSystems (system: self.packages."${system}".dict);
47
12 devShell = forAllSystems (system: 48 devShell = forAllSystems (system:
13 let 49 let
14 pkgs = nixpkgsFor."${system}"; 50 pkgs = nixpkgsFor."${ system}";
15 in 51 in
16 pkgs.mkShell { 52 pkgs.mkShell {
17 nativeBuildInputs = [ 53 nativeBuildInputs = [
18 pkgs.rustc 54 pkgs.rustc
19 pkgs.cargo 55 pkgs.cargo
56 pkgs.rustfmt
20 pkgs.rust-analyzer 57 pkgs.rust-analyzer
21 pkgs.cargo-watch 58 pkgs.cargo-watch
22 ]; 59 ];