-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add `flake.nix` (and friends) to help Nix user develop, compile and use this project. You can read more about Nix Flakes: https://www.tweag.io/blog/2020-05-25-flakes/
- Loading branch information
1 parent
9dcf29c
commit 595c94c
Showing
4 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
description = "Scalable push server for XMPP"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
crane = { | ||
url = "github:ipetkov/crane"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, crane }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
}; | ||
craneLib = crane.lib.${system}; | ||
|
||
commonArgs = { | ||
src = craneLib.cleanCargoSource ./.; | ||
|
||
buildInputs = [ | ||
pkgs.openssl | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
pkgs.pkg-config | ||
]; | ||
}; | ||
in | ||
{ | ||
packages.default = craneLib.buildPackage ({ | ||
meta = { mainProgram = "fpush"; }; | ||
} // commonArgs); | ||
|
||
devShells = { | ||
default = pkgs.mkShell { | ||
|
||
buildInputs = [ ] ++ commonArgs.buildInputs; | ||
nativeBuildInputs = builtins.attrValues | ||
{ | ||
inherit (pkgs) cargo rustc nixpkgs-fmt shellcheck rnix-lsp; | ||
} ++ [ | ||
# This is required to prevent a mangled bash shell in nix develop | ||
# see: https://discourse.nixos.org/t/interactive-bash-with-nix-develop-flake/15486 | ||
(pkgs.hiPrio pkgs.bashInteractive) | ||
|
||
] ++ commonArgs.nativeBuildInputs; | ||
}; | ||
}; | ||
} | ||
); | ||
} |