feat(nix): set up flake-compat
This commit is contained in:
parent
4d035126a5
commit
6c7ce91a48
|
@ -0,0 +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
|
|
@ -18,7 +18,9 @@
|
||||||
},
|
},
|
||||||
"crane": {
|
"crane": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": [
|
||||||
|
"flake-compat"
|
||||||
|
],
|
||||||
"flake-utils": [
|
"flake-utils": [
|
||||||
"flake-utils"
|
"flake-utils"
|
||||||
],
|
],
|
||||||
|
@ -94,6 +96,7 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"advisory-db": "advisory-db",
|
"advisory-db": "advisory-db",
|
||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
|
|
114
flake.nix
114
flake.nix
|
@ -2,10 +2,12 @@
|
||||||
description = "text-editor";
|
description = "text-editor";
|
||||||
|
|
||||||
inputs = {
|
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";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
rust-overlay = {
|
rust-overlay = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
inputs = {
|
inputs = {
|
||||||
|
@ -13,71 +15,81 @@
|
||||||
flake-utils.follows = "flake-utils";
|
flake-utils.follows = "flake-utils";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
crane = {
|
crane = {
|
||||||
url = "github:ipetkov/crane";
|
url = "github:ipetkov/crane";
|
||||||
inputs = {
|
inputs = {
|
||||||
flake-utils.follows = "flake-utils";
|
flake-utils.follows = "flake-utils";
|
||||||
|
flake-compat.follows = "flake-compat";
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixpkgs";
|
||||||
rust-overlay.follows = "rust-overlay";
|
rust-overlay.follows = "rust-overlay";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
advisory-db = {
|
advisory-db = {
|
||||||
url = "github:rustsec/advisory-db";
|
url = "github:rustsec/advisory-db";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs = {
|
||||||
{ self, nixpkgs, crane, flake-utils, advisory-db, rust-overlay, ... }:
|
self,
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
nixpkgs,
|
||||||
let
|
crane,
|
||||||
pkgs = import nixpkgs {
|
flake-utils,
|
||||||
inherit system;
|
advisory-db,
|
||||||
overlays = [ (import rust-overlay) ];
|
rust-overlay,
|
||||||
};
|
...
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [(import rust-overlay)];
|
||||||
|
};
|
||||||
|
|
||||||
rustStable =
|
rustStable =
|
||||||
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
|
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
|
||||||
src = ./.;
|
src = ./.;
|
||||||
cargoArtifacts = craneLib.buildDepsOnly { inherit src buildInputs; };
|
cargoArtifacts = craneLib.buildDepsOnly {inherit src buildInputs;};
|
||||||
buildInputs = [ ];
|
buildInputs = [];
|
||||||
|
|
||||||
text-editor = craneLib.buildPackage {
|
text-editor = craneLib.buildPackage {
|
||||||
inherit src;
|
inherit src;
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
};
|
};
|
||||||
text-editor-clippy = craneLib.cargoClippy {
|
text-editor-clippy = craneLib.cargoClippy {
|
||||||
inherit cargoArtifacts src buildInputs;
|
inherit cargoArtifacts src buildInputs;
|
||||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||||
};
|
};
|
||||||
text-editor-fmt = craneLib.cargoFmt { inherit src; };
|
text-editor-fmt = craneLib.cargoFmt {inherit src;};
|
||||||
text-editor-audit = craneLib.cargoAudit { inherit src advisory-db; };
|
text-editor-audit = craneLib.cargoAudit {inherit src advisory-db;};
|
||||||
text-editor-nextest = craneLib.cargoNextest {
|
text-editor-nextest = craneLib.cargoNextest {
|
||||||
inherit cargoArtifacts src buildInputs;
|
inherit cargoArtifacts src buildInputs;
|
||||||
partitions = 1;
|
partitions = 1;
|
||||||
partitionType = "count";
|
partitionType = "count";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
checks = {
|
checks = {
|
||||||
inherit text-editor text-editor-audit text-editor-clippy
|
inherit
|
||||||
text-editor-fmt text-editor-nextest;
|
text-editor
|
||||||
};
|
text-editor-audit
|
||||||
|
text-editor-clippy
|
||||||
|
text-editor-fmt
|
||||||
|
text-editor-nextest
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
packages.default = text-editor;
|
packages.default = text-editor;
|
||||||
|
|
||||||
apps.default = flake-utils.lib.mkApp { drv = text-editor; };
|
apps.default = flake-utils.lib.mkApp {drv = text-editor;};
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
inputsFrom = builtins.attrValues self.checks;
|
inputsFrom = builtins.attrValues self.checks;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
cargo-nextest
|
cargo-nextest
|
||||||
cargo-release
|
cargo-release
|
||||||
rustStable
|
rustStable
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +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
|
Loading…
Reference in New Issue