mirror of
https://github.com/msfjarvis/gitice
synced 2025-08-14 22:07:00 +05:30
feat: migrate to Nix Flakes
This commit is contained in:
parent
92237372c7
commit
a4855b834f
4 changed files with 249 additions and 17 deletions
8
default.nix
Normal file
8
default.nix
Normal file
|
@ -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
|
131
flake.lock
generated
Normal file
131
flake.lock
generated
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"advisory-db": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676378311,
|
||||||
|
"narHash": "sha256-PVHBALbhX3fSOeOTXQA+VIqLuuZefVIK5jnnGFQmaaM=",
|
||||||
|
"owner": "rustsec",
|
||||||
|
"repo": "advisory-db",
|
||||||
|
"rev": "0e63414bd16551677ee717de97dbd8df97caf732",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rustsec",
|
||||||
|
"repo": "advisory-db",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crane": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": [
|
||||||
|
"flake-compat"
|
||||||
|
],
|
||||||
|
"flake-utils": [
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-overlay": [
|
||||||
|
"rust-overlay"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676515499,
|
||||||
|
"narHash": "sha256-Qk9kVSAT/Iz2AwrtnOfCih6KB2Odu4mN8fBvRjiMdZ0=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "cfb6efcfc706e21c84682171581168e591b265d9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673956053,
|
||||||
|
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676283394,
|
||||||
|
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676487294,
|
||||||
|
"narHash": "sha256-fbD0tVsowxAUXwfw2C9EdEAH8UEJNsCm0zJcfkJy3Pg=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "63b5955814db30d2e2ff7157aaa5665b502ed2f4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"advisory-db": "advisory-db",
|
||||||
|
"crane": "crane",
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": [
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676514619,
|
||||||
|
"narHash": "sha256-/zVNJdETe/7txiP8NVjAjrAPudLIvjKJWgztuTi75Qw=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "3bab7ae4a80de02377005d611dc4b0a13082aa7c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
102
flake.nix
Normal file
102
flake.nix
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
{
|
||||||
|
description = "gitice";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs = {url = "github:NixOS/nixpkgs/nixpkgs-unstable";};
|
||||||
|
|
||||||
|
flake-utils = {url = "github:numtide/flake-utils";};
|
||||||
|
|
||||||
|
flake-compat = {
|
||||||
|
url = "github:edolstra/flake-compat";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
rust-overlay = {
|
||||||
|
url = "github:oxalica/rust-overlay";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.follows = "nixpkgs";
|
||||||
|
flake-utils.follows = "flake-utils";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
crane = {
|
||||||
|
url = "github:ipetkov/crane";
|
||||||
|
inputs = {
|
||||||
|
flake-compat.follows = "flake-compat";
|
||||||
|
flake-utils.follows = "flake-utils";
|
||||||
|
nixpkgs.follows = "nixpkgs";
|
||||||
|
rust-overlay.follows = "rust-overlay";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
advisory-db = {
|
||||||
|
url = "github:rustsec/advisory-db";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = ./.;
|
||||||
|
nativeBuildInputs = with pkgs;
|
||||||
|
[
|
||||||
|
perl
|
||||||
|
pkg-config
|
||||||
|
openssl
|
||||||
|
];
|
||||||
|
buildInputs = [pkgs.openssl] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin
|
||||||
|
[pkgs.darwin.apple_sdk.frameworks.Security];
|
||||||
|
cargoArtifacts = craneLib.buildDepsOnly {inherit src buildInputs nativeBuildInputs;};
|
||||||
|
|
||||||
|
gitice = craneLib.buildPackage {
|
||||||
|
inherit src buildInputs nativeBuildInputs;
|
||||||
|
doCheck = false;
|
||||||
|
};
|
||||||
|
gitice-clippy = craneLib.cargoClippy {
|
||||||
|
inherit cargoArtifacts src buildInputs nativeBuildInputs;
|
||||||
|
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||||
|
};
|
||||||
|
gitice-fmt = craneLib.cargoFmt {inherit src;};
|
||||||
|
gitice-audit =
|
||||||
|
craneLib.cargoAudit {inherit src advisory-db;};
|
||||||
|
gitice-nextest = craneLib.cargoNextest {
|
||||||
|
inherit cargoArtifacts src buildInputs nativeBuildInputs;
|
||||||
|
partitions = 1;
|
||||||
|
partitionType = "count";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
checks = {
|
||||||
|
inherit gitice gitice-audit gitice-clippy gitice-fmt gitice-nextest;
|
||||||
|
};
|
||||||
|
|
||||||
|
packages.default = gitice;
|
||||||
|
|
||||||
|
apps.default = flake-utils.lib.mkApp {drv = gitice;};
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
inputsFrom = builtins.attrValues self.checks;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cargo-nextest
|
||||||
|
cargo-release
|
||||||
|
rustStable
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
25
shell.nix
25
shell.nix
|
@ -1,17 +1,8 @@
|
||||||
with import <nixpkgs> { overlays = [ (import <rust-overlay>) ]; };
|
(import (let
|
||||||
mkShell {
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
buildInputs = [
|
in
|
||||||
(rust-bin.stable.latest.default.override {
|
fetchTarball {
|
||||||
extensions =
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
[ "rust-src" "rustc-dev" "rustfmt-preview" "llvm-tools-preview" ];
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
targets =
|
}) {src = ./.;})
|
||||||
pkgs.lib.optionals pkgs.stdenv.isDarwin [ "aarch64-apple-darwin" ]
|
.shellNix
|
||||||
++ pkgs.lib.optionals pkgs.stdenv.isLinux
|
|
||||||
[ "x86_64-unknown-linux-gnu" ];
|
|
||||||
})
|
|
||||||
pkg-config
|
|
||||||
openssl
|
|
||||||
clang_13
|
|
||||||
] ++ lib.optionals stdenv.isDarwin
|
|
||||||
[ pkgs.darwin.apple_sdk.frameworks.Security ];
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue