chore: reformat Nix files with `alejandra`

This commit is contained in:
Harsh Shandilya 2023-02-22 18:25:02 +00:00
parent ca04c4696a
commit 80df0b0108
3 changed files with 70 additions and 60 deletions

View File

@ -1,6 +1,8 @@
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
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;
}) { src = ./.; }).defaultNix
(import (let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
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;
}) {src = ./.;})
.defaultNix

102
flake.nix
View File

@ -2,9 +2,9 @@
description = "twt";
inputs = {
nixpkgs = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
nixpkgs = {url = "github:NixOS/nixpkgs/nixpkgs-unstable";};
flake-utils = { url = "github:numtide/flake-utils"; };
flake-utils = {url = "github:numtide/flake-utils";};
flake-compat = {
url = "github:edolstra/flake-compat";
@ -35,56 +35,62 @@
};
};
outputs =
{ self, nixpkgs, crane, flake-utils, advisory-db, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
outputs = {
self,
nixpkgs,
crane,
flake-utils,
advisory-db,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
rustStable =
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
src = ./.;
cargoArtifacts = craneLib.buildDepsOnly { inherit src buildInputs; };
buildInputs = [ ];
rustStable =
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
src = ./.;
cargoArtifacts = craneLib.buildDepsOnly {inherit src buildInputs;};
buildInputs = [];
twt = craneLib.buildPackage {
inherit src;
doCheck = false;
};
twt-clippy = craneLib.cargoClippy {
inherit cargoArtifacts src buildInputs;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
};
twt-fmt = craneLib.cargoFmt { inherit src; };
twt-audit = craneLib.cargoAudit { inherit src advisory-db; };
twt-nextest = craneLib.cargoNextest {
inherit cargoArtifacts src buildInputs;
partitions = 1;
partitionType = "count";
};
in {
checks = {
# TODO: Switch to cargo-audit and re-enable this
# twt-audit
inherit twt twt-clippy twt-fmt twt-nextest;
};
twt = craneLib.buildPackage {
inherit src;
doCheck = false;
};
twt-clippy = craneLib.cargoClippy {
inherit cargoArtifacts src buildInputs;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
};
twt-fmt = craneLib.cargoFmt {inherit src;};
twt-audit = craneLib.cargoAudit {inherit src advisory-db;};
twt-nextest = craneLib.cargoNextest {
inherit cargoArtifacts src buildInputs;
partitions = 1;
partitionType = "count";
};
in {
checks = {
# TODO: Switch to cargo-audit and re-enable this
# twt-audit
inherit twt twt-clippy twt-fmt twt-nextest;
};
packages.default = twt;
packages.default = twt;
apps.default = flake-utils.lib.mkApp { drv = twt; };
apps.default = flake-utils.lib.mkApp {drv = twt;};
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks;
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks;
nativeBuildInputs = with pkgs; [
cargo-nextest
cargo-release
rustStable
];
};
});
nativeBuildInputs = with pkgs; [
cargo-nextest
cargo-release
rustStable
];
};
});
}

View File

@ -1,6 +1,8 @@
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
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;
}) { src = ./.; }).shellNix
(import (let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
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;
}) {src = ./.;})
.shellNix