puter/flake.nix

105 lines
2.2 KiB
Nix
Raw Normal View History

2024-02-04 20:51:11 +00:00
{
description = "My NixOS configuration";
inputs = {
2024-03-08 21:46:46 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2024-12-14 07:42:24 +00:00
2024-03-08 21:46:46 +00:00
flake-parts.url = "github:hercules-ci/flake-parts";
2024-12-14 07:42:24 +00:00
# Pre-commit
2024-12-01 16:43:53 +00:00
git-hooks.url = "github:cachix/git-hooks.nix";
2024-12-14 07:42:24 +00:00
# Formatting
2024-12-01 16:43:53 +00:00
treefmt.url = "github:numtide/treefmt-nix";
2024-12-14 07:42:24 +00:00
# Hardware support
2024-02-04 20:51:11 +00:00
hardware.url = "github:NixOS/nixos-hardware";
2024-12-14 07:42:24 +00:00
# Agenix
2024-02-04 20:51:11 +00:00
agenix.url = "github:ryantm/agenix";
2024-12-14 07:42:24 +00:00
# Helix
2024-12-01 04:03:34 +00:00
hxwrap.url = "github:lukaswrz/hxwrap";
2024-12-14 07:42:24 +00:00
# COSMIC
nixos-cosmic.url = "github:lilyinstarlight/nixos-cosmic";
nixpkgs.follows = "nixos-cosmic/nixpkgs";
2024-02-04 20:51:11 +00:00
};
2024-03-08 21:46:46 +00:00
outputs = {
2024-12-01 16:52:52 +00:00
self,
2024-03-08 21:46:46 +00:00
nixpkgs,
flake-parts,
2024-12-01 16:43:53 +00:00
treefmt,
2024-03-08 21:46:46 +00:00
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
2024-12-01 16:43:53 +00:00
imports = [
inputs.git-hooks.flakeModule
inputs.treefmt.flakeModule
];
2024-03-08 21:46:46 +00:00
systems = ["x86_64-linux" "aarch64-linux"];
2024-12-01 16:52:52 +00:00
flake = {
2024-12-01 03:05:16 +00:00
lib = nixpkgs.lib.extend (import ./lib.nix);
2024-12-14 07:42:24 +00:00
nixosConfigurations = self.lib.genNixosConfigurations {inherit inputs;};
2024-02-04 20:51:11 +00:00
};
2024-03-08 21:46:46 +00:00
perSystem = {
2024-12-01 16:43:53 +00:00
config,
2024-03-08 21:46:46 +00:00
pkgs,
2024-12-01 16:43:53 +00:00
inputs',
2024-03-08 21:46:46 +00:00
...
}: {
2024-12-01 16:43:53 +00:00
treefmt = ./treefmt.nix;
pre-commit = {
check.enable = true;
settings = {
hooks = {
treefmt.enable = true;
deadnix.enable = true;
statix.enable = true;
shellcheck = {
enable = true;
excludes = [
"^\.envrc$"
];
};
flake-checker.enable = true;
};
};
2024-03-08 21:46:46 +00:00
};
2024-02-04 20:51:11 +00:00
2024-12-01 16:43:53 +00:00
devShells.default = pkgs.mkShellNoCC {
inherit (config.pre-commit.devShell) shellHook;
inputsFrom = [
config.pre-commit.devShell
config.treefmt.build.devShell
];
packages = [
inputs'.agenix.packages.agenix
];
};
2024-04-21 17:55:29 +00:00
packages.disk = pkgs.writeShellApplication {
name = "disk";
runtimeInputs = with pkgs; [
util-linux
jq
2024-07-01 22:06:05 +00:00
e2fsprogs
2024-04-21 17:55:29 +00:00
dosfstools
];
2024-12-14 10:59:14 +00:00
text = builtins.readFile ./disk.bash;
2024-04-21 17:55:29 +00:00
};
2024-02-04 20:51:11 +00:00
};
2024-03-08 21:46:46 +00:00
};
2024-02-04 20:51:11 +00:00
}