-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
95 lines (85 loc) · 2.56 KB
/
flake.nix
File metadata and controls
95 lines (85 loc) · 2.56 KB
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
# SPDX-FileCopyrightText: (C) 2025 chris montgomery <chmont@protonmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{
description = "Tuners";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
crane.url = "github:ipetkov/crane";
};
outputs =
inputs@{
flake-parts,
nixpkgs,
...
}:
let
systems = import inputs.systems;
# For details on these options, See
# https://github.com/oxalica/rust-overlay?tab=readme-ov-file#cheat-sheet-common-usage-of-rust-bin
#
# Channel of the Rust toolchain (stable or beta).
rustChannel = "stable";
# Version (latest or specific date/semantic version)
rustVersion = "latest";
# Profile (default or minimal)
rustProfile = "default";
in
flake-parts.lib.mkFlake { inherit inputs; } {
inherit systems;
imports = [
inputs.flake-parts.flakeModules.modules
inputs.flake-parts.flakeModules.partitions
];
perSystem =
{ system, pkgs, ... }:
let
commonArgs = {
inherit
src
rustChannel
rustProfile
rustVersion
;
};
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain (
pkgs: pkgs.rust-bin.${rustChannel}.${rustVersion}.${rustProfile}
);
# Depending on your code base, you may have to customize the
# source filtering to include non-standard files during the build.
# https://crane.dev/source-filtering.html?highlight=source#source-filtering
src = craneLib.cleanCargoSource (craneLib.path ./.);
in
{
_module.args = {
inherit commonArgs craneLib;
pkgs = import nixpkgs {
inherit system;
overlays = [ inputs.rust-overlay.overlays.default ];
};
};
formatter = pkgs.nixfmt-rfc-style;
};
partitions.dev = {
extraInputsFlake = ./.config;
module =
{ inputs, ... }:
{
imports = [
inputs.git-hooks.flakeModule
inputs.treefmt-nix.flakeModule
./.config/devshells
./.config/git-hooks.nix
./.config/treefmt.nix
];
};
};
partitionedAttrs = {
checks = "dev";
devShells = "dev";
};
};
}