aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2022-12-01 16:51:20 +0000
committerAlex <alex@adnab.me>2022-12-01 16:51:20 +0000
commitf306e8dc8d0e93478353ce39b6064e8c06a8bca6 (patch)
tree2f7ee2b28a161dc0d5268a6c053c6a8126f64e68 /flake.nix
parent862e8ce8768338ccdb190055fd05dc7f8e0a01cd (diff)
parentf8431271d9021bfd4bfb85d8c3ba331d5dff9dac (diff)
downloaddiplonat-f306e8dc8d0e93478353ce39b6064e8c06a8bca6.tar.gz
diplonat-f306e8dc8d0e93478353ce39b6064e8c06a8bca6.zip
Merge pull request 'Make repoa Nix flake' (#16) from nix-flake into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/diplonat/pulls/16
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..e7781d1
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,36 @@
+{
+ description = "A very basic flake";
+
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/a3073c49bc0163fea6a121c276f526837672b555";
+ inputs.cargo2nix = {
+ # As of 2022-10-18: two small patches over unstable branch, one for clippy and one to fix feature detection
+ url = "github:Alexis211/cargo2nix/a7a61179b66054904ef6a195d8da736eaaa06c36";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ outputs = { self, nixpkgs, cargo2nix }:
+ let
+ pkgs = import nixpkgs {
+ system = "x86_64-linux";
+ overlays = [ cargo2nix.overlays.default ];
+ };
+ packageFun = import ./Cargo.nix;
+ rustVersion = "1.63.0";
+
+ compile = args: compileMode:
+ let
+ packageSet = pkgs.rustBuilder.makePackageSet ({
+ inherit packageFun rustVersion;
+ } // args);
+ in
+ packageSet.workspace.diplonat {
+ inherit compileMode;
+ };
+ in
+ {
+ test.x86_64-linux.diplonat = compile { release = false; } "test";
+ debug.x86_64-linux.diplonat = compile { release = false; } "build";
+ packages.x86_64-linux.diplonat = compile { release = true; } "build";
+ packages.x86_64-linux.default = self.packages.x86_64-linux.diplonat;
+ };
+}