362KVUHOHSVFC3VD27AUKHFH23FKLO6VYGEIEKEGSAPVVVEBMGMQC
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1618217525,
"narHash": "sha256-WGrhVczjXTiswQaoxQ+0PTfbLNeOQM6M36zvLn78AYg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c6169a2772643c4a93a0b5ac1c61e296cba68544",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1618068541,
"narHash": "sha256-enxg0QB53Zis0VJWfJsrX7zCjurpi7lW78EKXbJdzpQ=",
"owner": "nmattia",
"repo": "naersk",
"rev": "b3b099d669fc8b18d361c249091c9fe95d57ebbb",
"type": "github"
},
"original": {
"owner": "nmattia",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1618306168,
"narHash": "sha256-/IOtgzdEaiEqRVn6OhpekuYhRHfCm299Bqts5QqQVko=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4c87cb87a2db6b9eb43541c1cf83f2a2f725fa25",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixpkgs-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"naersk": "naersk",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "Gemini projects";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nmattia/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
};
outputs = { self, flake-utils, naersk, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
naersk-lib = naersk.lib.${system};
libs = [ "gemini" ];
apps = [
"setka"
# "sputnik"
"vostok"
];
crates = libs ++ apps;
build = f: crates:
pkgs.lib.foldr (crate: set: set // { "${crate}" = f crate; }) { }
crates;
in with pkgs; rec {
packages = build (crate:
naersk-lib.buildPackage {
pname = crate;
root = ./.;
src = ./. + "/${crate}";
}) crates;
defaultPackage = packages.gemini;
apps = build (crate: flake-utils.lib.mkApp { drv = packages.${crate}; })
apps;
defaultApp = apps.vostok;
devShell = mkShell {
nativeBuildInputs = [
rustc
cargo
rustfmt
rust-analyzer
cargo-edit
cargo-watch
];
RUST_BACKTRACE = 1;
RUST_LOG = "vostok=trace";
};
});
}
RUN_CMD := run --bin vostok localhost
.PHONY: watch
watch:
cargo watch -x "${RUN_CMD}"
.PHONY: run
run:
cargo ${RUN_CMD}