aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/sources/lf-make-map/flake.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-20 16:10:21 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-20 16:14:26 +0200
commit368cb6b0d25db2ae23be42ad51584de059997e51 (patch)
tree3282e45d3ebced63c8498a47e83a255c35de620b /pkgs/sources/lf-make-map/flake.nix
parentrefactor(hm): Rename to `modules/home` (diff)
downloadnixos-config-368cb6b0d25db2ae23be42ad51584de059997e51.zip
refactor(sys): Modularize and move to `modules/system` or `pkgs`
Diffstat (limited to 'pkgs/sources/lf-make-map/flake.nix')
-rw-r--r--pkgs/sources/lf-make-map/flake.nix125
1 files changed, 125 insertions, 0 deletions
diff --git a/pkgs/sources/lf-make-map/flake.nix b/pkgs/sources/lf-make-map/flake.nix
new file mode 100644
index 00000000..dc8c24cc
--- /dev/null
+++ b/pkgs/sources/lf-make-map/flake.nix
@@ -0,0 +1,125 @@
+{
+ description = "An automatic lf cd mapping generator";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+ treefmt-nix = {
+ url = "github:numtide/treefmt-nix";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ crane = {
+ url = "github:ipetkov/crane";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ };
+ };
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ flake-utils.follows = "flake-utils";
+ };
+ };
+
+ # inputs for following
+ systems = {
+ url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
+ };
+ flake-compat = {
+ url = "github:edolstra/flake-compat";
+ flake = false;
+ };
+ flake-utils = {
+ url = "github:numtide/flake-utils";
+ inputs = {
+ systems.follows = "systems";
+ };
+ };
+ };
+
+ outputs = {
+ self,
+ nixpkgs,
+ flake-utils,
+ treefmt-nix,
+ crane,
+ rust-overlay,
+ ...
+ }:
+ flake-utils.lib.eachDefaultSystem (system: let
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [(import rust-overlay)];
+ };
+
+ nightly = false;
+ rust_minimal =
+ if nightly
+ then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal)
+ else pkgs.rust-bin.stable.latest.minimal;
+ rust_default =
+ if nightly
+ then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)
+ else pkgs.rust-bin.stable.latest.default;
+
+ cargo_toml = craneLib.cleanCargoToml {cargoToml = ./Cargo.toml;};
+ pname = cargo_toml.package.name;
+
+ craneLib = (crane.mkLib pkgs).overrideToolchain rust_minimal;
+ craneBuild = craneLib.buildPackage {
+ src = craneLib.cleanCargoSource ./.;
+
+ doCheck = true;
+ };
+
+ manual = pkgs.stdenv.mkDerivation {
+ name = "${pname}-manual";
+ inherit (cargo_toml.package) version;
+
+ src = ./docs;
+ nativeBuildInputs = with pkgs; [pandoc];
+
+ buildPhase = ''
+ mkdir --parents $out/docs;
+
+ pandoc "./${pname}.1.md" -s -t man > $out/docs/${pname}.1
+ '';
+
+ installPhase = ''
+ install -D $out/docs/${pname}.1 $out/share/man/man1/${pname};
+ '';
+ };
+
+ treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
+ in {
+ packages.default = pkgs.symlinkJoin {
+ inherit (cargo_toml.package) name;
+
+ paths = [manual craneBuild];
+ };
+
+ checks = {
+ inherit craneBuild;
+ formatting = treefmtEval.config.build.check self;
+ };
+
+ formatter = treefmtEval.config.build.wrapper;
+
+ devShells.default = pkgs.mkShell {
+ packages = with pkgs; [
+ cocogitto
+
+ rust_default
+ cargo-edit
+
+ licensure
+ ];
+ };
+ });
+}
+# vim: ts=2
+