flake: setup flake.nix

This commit is contained in:
Antoine Martin 2021-04-10 03:24:44 +02:00
parent 18a540b7e2
commit 5a15c0e9e7
3 changed files with 119 additions and 0 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/target
/result

60
flake.lock Normal file
View file

@ -0,0 +1,60 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1606424373,
"narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1617631617,
"narHash": "sha256-PARRCz55qN3gy07VJZIlFeOX420d0nGF0RzGI/9hVlw=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b2c27d1a81b0dc266270fa8aeecebbd1807fc610",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1617929752,
"narHash": "sha256-ji0nqJUZp2bfHvO0sKxD24cW6Nk7LyjbPPMxjbJHji0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6fc2b7ecc2a167ce6a6902d5417daf1fa5cac777",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

58
flake.nix Normal file
View file

@ -0,0 +1,58 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
defaultPackage = pkgs.rustPlatform.buildRustPackage {
pname = "bad-news";
version = "0.1.0";
src = ./.;
cargoSha256 = "sha256-nWEWOY1F0TsVW5DHm2p8eOABF97Wku7Grw0Vsd79syU=";
meta = with pkgs.lib; {
description = "A Matrix bot, bringer of bad news";
homepage = "https://github.com/alarsyo/bad-news";
license = with licenses; [ mit asl20 ];
platforms = platforms.unix;
};
nativeBuildInputs = with pkgs; [ pkg-config cmake ];
buildInputs = with pkgs; [ systemd openssl ];
};
defaultApp = flake-utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
cargo
clippy
nixpkgs-fmt
rustPackages.clippy
rustc
rustfmt
pkg-config
cmake
systemd
openssl
];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
};
});
}