swap flake-utils for flake-parts + add treemft and pre-commit-hooks

This commit is contained in:
Laureηt 2023-12-15 16:09:44 +01:00
parent 4b7f71ff80
commit e77c7fd1d4
Signed by: Laurent
SSH key fingerprint: SHA256:kZEpW8cMJ54PDeCvOhzreNr4FSh6R13CMGH/POoO8DI

View file

@ -1,7 +1,6 @@
{ {
description = "Laureηt's infrastructure"; description = "Laureηt's infrastructure";
# TODO: setup flake-parts à la place de flake-utils
# TODO: setup le formatter comme sioodmy # TODO: setup le formatter comme sioodmy
# TODO: rekey les secrets + changer la key de hydrogen # TODO: rekey les secrets + changer la key de hydrogen
# TODO: luks encrypt hydrogen (dropbear ?) # TODO: luks encrypt hydrogen (dropbear ?)
@ -21,59 +20,96 @@
agenix = { agenix = {
url = "github:yaxitech/ragenix"; url = "github:yaxitech/ragenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
}; };
flake-utils.url = "github:numtide/flake-utils"; flake-parts.url = "github:hercules-ci/flake-parts";
lanzaboote.url = "github:nix-community/lanzaboote"; lanzaboote.url = "github:nix-community/lanzaboote";
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland";
nixos-hardware.url = "github:nixos/nixos-hardware"; nixos-hardware.url = "github:nixos/nixos-hardware";
disko.url = "github:nix-community/disko"; disko.url = "github:nix-community/disko";
nixos-anywhere.url = "github:nix-community/nixos-anywhere"; nixos-anywhere.url = "github:nix-community/nixos-anywhere";
# atuin.url = "github:atuinsh/atuin";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
treefmt-nix.url = "github:numtide/treefmt-nix";
resume.url = "git+https://git.fainsin.bzh/Laurent/resume"; resume.url = "git+https://git.fainsin.bzh/Laurent/resume";
projet-intelligence-artificielle-multimedia.url = projet-intelligence-artificielle-multimedia.url = "git+https://git.fainsin.bzh/ENSEEIHT/projet-intelligence-artificielle-multimedia";
"git+https://git.fainsin.bzh/ENSEEIHT/projet-intelligence-artificielle-multimedia"; projet-audionumerique.url = "git+https://git.fainsin.bzh/ENSEEIHT/projet-audionumerique";
projet-audionumerique.url = projet-oral-japonais.url = "git+https://git.fainsin.bzh/ENSEEIHT/projet-oral-japonais";
"git+https://git.fainsin.bzh/ENSEEIHT/projet-audionumerique"; projet-oral-anglais.url = "git+https://git.fainsin.bzh/ENSEEIHT/projet-oral-anglais";
projet-oral-japonais.url = TP-calcul-parallele.url = "git+https://git.fainsin.bzh/ENSEEIHT/TP-calcul-parallele";
"git+https://git.fainsin.bzh/ENSEEIHT/projet-oral-japonais";
projet-oral-anglais.url =
"git+https://git.fainsin.bzh/ENSEEIHT/projet-oral-anglais";
TP-calcul-parallele.url =
"git+https://git.fainsin.bzh/ENSEEIHT/TP-calcul-parallele";
}; };
nixConfig = { nixConfig = {
extra-substituters = [ extra-substituters = [
#
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
"https://pre-commit-hooks.cachix.org"
"https://hyprland.cachix.org" "https://hyprland.cachix.org"
]; ];
extra-trusted-public-keys = [ extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
]; ];
}; };
outputs = { nixpkgs, flake-utils, lanzaboote, agenix, home-manager outputs = {
, nixos-hardware, disko, ... }@inputs: nixpkgs,
agenix,
flake-parts,
lanzaboote,
home-manager,
nixos-hardware,
disko,
pre-commit-hooks,
treefmt-nix,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux"];
imports = [
flake-parts.flakeModules.easyOverlay
pre-commit-hooks.flakeModule
treefmt-nix.flakeModule
];
perSystem = {
pkgs,
system,
...
}: rec {
formatter = pkgs.alejandra;
treefmt = {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
deadnix.enable = true;
};
};
pre-commit = {
settings.excludes = ["flake.lock"];
settings.hooks = {
alejandra.enable = true;
deadnix.enable = true;
};
};
(flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = [ packages = [
pkgs.nixfmt # formatting formatter # defined above
pkgs.git # version control pkgs.git # version control
pkgs.update-nix-fetchgit # auto update fetchs pkgs.update-nix-fetchgit # auto update fetchs
agenix.packages.${system}.ragenix # secrets agenix.packages.${system}.ragenix # secrets
pkgs.sbctl # secure boot pkgs.sbctl # secure boot
]; ];
}; };
})) // { };
flake.nixosConfigurations = {
# neodymium laptop # neodymium laptop
nixosConfigurations.neodymium = nixpkgs.lib.nixosSystem { neodymium = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = inputs; specialArgs = inputs;
modules = [ modules = [
@ -89,7 +125,7 @@
}; };
# hydrogen vps # hydrogen vps
nixosConfigurations.hydrogen = nixpkgs.lib.nixosSystem rec { hydrogen = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
@ -104,4 +140,5 @@
]; ];
}; };
}; };
};
} }