feat(nix): align Flakes setup with other repositories

This commit is contained in:
Harsh Shandilya 2023-07-01 13:05:32 +05:30
parent f8daba4de4
commit 6a9d08388b
No known key found for this signature in database
3 changed files with 89 additions and 55 deletions

View File

@ -43,6 +43,29 @@
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1687944744,
"narHash": "sha256-4ZtRVG/5yWHPZpkit1Ak5Mo1DDnkx1AG1HpNu/P+n5U=",
"owner": "numtide",
"repo": "devshell",
"rev": "3864857b2754ab0e16c7c7c626f0e5a1d4e42f38",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
@ -67,15 +90,15 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"lastModified": 1688025799,
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
"type": "github"
},
"original": {
"owner": "edolstra",
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
@ -115,10 +138,12 @@
"inputs": {
"advisory-db": "advisory-db",
"crane": "crane",
"devshell": "devshell",
"fenix": "fenix",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"rust-analyzer-src": {
@ -162,6 +187,21 @@
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1687694171,
"narHash": "sha256-m4E0xN69qKj/oKOj8OtiZcSFpFlO8paI6E3Wo5oXDJc=",
"owner": "msfjarvis",
"repo": "flake-systems",
"rev": "7876462a5f60841e8b2712ad20dc18470f448e8d",
"type": "github"
},
"original": {
"owner": "msfjarvis",
"repo": "flake-systems",
"type": "github"
}
}
},
"root": "root",

View File

@ -1,53 +1,50 @@
{
description = "text-editor";
inputs = {
nixpkgs = {url = "github:NixOS/nixpkgs/nixpkgs-unstable";};
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
inputs.systems.url = "github:msfjarvis/flake-systems";
flake-utils = {url = "github:numtide/flake-utils";};
inputs.advisory-db.url = "github:rustsec/advisory-db";
inputs.advisory-db.flake = false;
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
inputs.crane.url = "github:ipetkov/crane";
inputs.crane.inputs.flake-compat.follows = "flake-compat";
inputs.crane.inputs.flake-utils.follows = "flake-utils";
inputs.crane.inputs.nixpkgs.follows = "nixpkgs";
crane = {
url = "github:ipetkov/crane";
inputs = {
flake-compat.follows = "flake-compat";
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
inputs.devshell.url = "github:numtide/devshell";
inputs.devshell.inputs.nixpkgs.follows = "nixpkgs";
inputs.devshell.inputs.systems.follows = "systems";
advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
};
};
inputs.fenix.url = "github:nix-community/fenix";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.inputs.systems.follows = "systems";
inputs.flake-compat.url = "github:nix-community/flake-compat";
inputs.flake-compat.flake = false;
outputs = {
self,
nixpkgs,
fenix,
crane,
flake-utils,
advisory-db,
crane,
devshell,
fenix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
pkgs = import nixpkgs {
inherit system;
overlays = [devshell.overlays.default];
};
rustStable = (import fenix {inherit pkgs;}).fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-eMJethw5ZLrJHmoN2/l0bIyQjoTX1NsvalWSscTixpI=";
sha256 = "sha256-gdYqng0y9iHYzYPAdkC/ka3DRny3La/S5G8ASj0Ayyc=";
};
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
@ -66,32 +63,29 @@
});
text-editor-fmt = craneLib.cargoFmt (commonArgs // {});
text-editor-audit = craneLib.cargoAudit (commonArgs // {inherit advisory-db;});
text-editor-nextest = craneLib.cargoNextest (commonArgs
// {
inherit cargoArtifacts;
src = ./.;
partitions = 1;
partitionType = "count";
});
in {
checks = {
inherit text-editor text-editor-audit text-editor-clippy text-editor-fmt text-editor-nextest;
inherit text-editor text-editor-audit text-editor-clippy text-editor-fmt;
};
packages.default = text-editor;
apps.default = flake-utils.lib.mkApp {drv = text-editor;};
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks;
devShells.default = pkgs.devshell.mkShell {
bash = {interactive = "";};
nativeBuildInputs = with pkgs; [
cargo-nextest
cargo-release
rustStable
env = [
{
name = "DEVSHELL_NO_MOTD";
value = 1;
}
];
CARGO_REGISTRIES_CRATES_IO_PROTOCOL = "sparse";
packages = with pkgs; [
cargo-nextest
rustStable
];
};
});
}

View File

@ -1,5 +1,5 @@
[toolchain]
channel = "stable"
components = [ "clippy", "rustfmt", "rust-src" ]
targets = [ "x86_64-unknown-linux-gnu" ]
channel = "1.70.0"
components = ["clippy", "rustfmt", "rust-src"]
targets = ["x86_64-unknown-linux-gnu"]
profile = "minimal"