blob: b0028cbffc306e14be5c55b48ca67475d1b11137 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
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
|