-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
88 lines (79 loc) · 2.27 KB
/
flake.nix
File metadata and controls
88 lines (79 loc) · 2.27 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
{
description = "noctoggle - automatic topbar toggle for Noctalia Shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
git-hooks-nix = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.treefmt-nix.flakeModule
inputs.git-hooks-nix.flakeModule
];
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = { config, self', pkgs, ... }: {
treefmt = {
programs = {
nixpkgs-fmt.enable = true;
rustfmt.enable = true;
deadnix.enable = true;
statix.enable = true;
};
};
pre-commit.settings = {
settings = {
rust = {
cargoManifestPath = "./Cargo.toml";
check.cargoDeps = pkgs.rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
};
};
hooks = {
treefmt.enable = true;
clippy.enable = true;
};
};
packages = rec {
noctoggle = pkgs.rustPlatform.buildRustPackage {
pname = "noctoggle";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
meta.mainProgram = "noctoggle";
};
default = noctoggle;
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self'.packages.default ];
nativeBuildInputs = with pkgs; [
rust-analyzer
clippy
];
shellHook = config.pre-commit.installationScript;
};
};
flake =
let
inherit (inputs.nixpkgs) lib;
in
{
nixosModules = rec {
noctoggle = { pkgs, ... }: {
imports = [ ./nix/module.nix ];
options.services.noctoggle.package = lib.mkOption {
type = lib.types.package;
description = "The noctoggle package to use.";
default = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.noctoggle;
};
};
default = noctoggle;
};
};
};
}