puter/flake.nix

96 lines
2.1 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";
flake-parts.url = "github:hercules-ci/flake-parts";
2024-12-01 16:43:53 +00:00
git-hooks.url = "github:cachix/git-hooks.nix";
treefmt.url = "github:numtide/treefmt-nix";
2024-02-04 20:51:11 +00:00
hardware.url = "github:NixOS/nixos-hardware";
agenix.url = "github:ryantm/agenix";
2024-12-01 04:03:34 +00:00
hxwrap.url = "github:lukaswrz/hxwrap";
2024-02-04 20:51:11 +00:00
};
2024-03-08 21:46:46 +00:00
outputs = {
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 03:05:16 +00:00
flake = let
lib = nixpkgs.lib.extend (import ./lib.nix);
in {
inherit lib;
nixosConfigurations = lib.genNixosConfigurations {
inherit inputs;
extraModules = [
inputs.agenix.nixosModules.default
2024-08-20 19:46:27 +00:00
];
2024-12-01 03:05:16 +00:00
};
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-04-21 17:56:53 +00:00
text = builtins.readFile ./disk.sh;
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
}