nix autoformat etc

This commit is contained in:
Sridhar Ratnakumar 2021-04-08 21:27:32 -04:00
parent d58930a9ad
commit 4ff4c07906
4 changed files with 47 additions and 39 deletions

View file

@ -1,5 +1,6 @@
{
"recommendations": [
"matklad.rust-analyzer"
"matklad.rust-analyzer",
"jnoortheen.nix-ide"
]
}

View file

@ -1,3 +1,4 @@
{
"nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix"
"nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix",
"editor.formatOnSave": true
}

View file

@ -1,12 +1,13 @@
# This file exists for legacy Nix installs (nix-build & nix-env)
# https://nixos.wiki/wiki/Flakes#Using_flakes_project_from_a_legacy_Nix
# You generally do *not* have to modify this ever.
(import (
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}).defaultNix
}).defaultNix

View file

@ -21,7 +21,8 @@
outputs = { self, nixpkgs, utils, rust-overlay, crate2nix, ... }:
let
name = "bouncy";
in utils.lib.eachDefaultSystem
in
utils.lib.eachDefaultSystem
(system:
let
# Imports
@ -42,10 +43,12 @@
generatedCargoNix;
# Create the cargo2nix project
project = pkgs.callPackage (generatedCargoNix {
project = pkgs.callPackage
(generatedCargoNix {
inherit name;
src = ./.;
}) {
})
{
# Individual crate overrides go here
# Example: https://github.com/balsoft/simple-osd-daemons/blob/6f85144934c0c1382c7a4d3a2bbb80106776e270/flake.nix#L28-L50
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
@ -59,11 +62,12 @@
# Configuration for the non-Rust dependencies
buildInputs = with pkgs; [ openssl.dev ];
nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig ];
nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig nixpkgs-fmt ];
buildEnvVars = {
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
};
in rec {
in
rec {
packages.${name} = project.rootCrate.build;
# `nix build`
@ -77,7 +81,8 @@
defaultApp = apps.${name};
# `nix develop`
devShell = pkgs.mkShell {
devShell = pkgs.mkShell
{
inherit buildInputs nativeBuildInputs;
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
} // buildEnvVars;