flake.nix: use flake-parts
All checks were successful
Check flake / build-amd64-linux (push) Successful in 1m28s
All checks were successful
Check flake / build-amd64-linux (push) Successful in 1m28s
This commit is contained in:
185
flake.nix
185
flake.nix
@@ -2,54 +2,80 @@
|
||||
description = "NixOS system configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-25.05";
|
||||
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
|
||||
# nixpkgs-master.url = "nixpkgs";
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
agenix = {
|
||||
url = "github:ryantm/agenix";
|
||||
inputs.home-manager.follows = "nixpkgs";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
deploy-rs.url = "github:serokell/deploy-rs";
|
||||
|
||||
disko = {
|
||||
url = "github:nix-community/disko";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-25.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
hyprland.url = "github:hyprwm/Hyprland";
|
||||
|
||||
hyprland-plugins = {
|
||||
url = "github:hyprwm/hyprland-plugins";
|
||||
inputs.hyprland.follows = "hyprland";
|
||||
};
|
||||
|
||||
firefox-gnome-theme = {
|
||||
url = "github:rafaelmardojai/firefox-gnome-theme";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
git-hooks-nix.url = "github:cachix/git-hooks.nix";
|
||||
|
||||
gitea-github-theme = {
|
||||
url = "git+ssh://git@git.vimium.com/jordan/gitea-github-theme.git?ref=main";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
impermanence.url = "github:nix-community/impermanence";
|
||||
|
||||
kvlibadwaita = {
|
||||
url = "github:GabePoel/KvLibadwaita";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
|
||||
nixos-mailserver = {
|
||||
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-25.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixpkgs.url = "nixpkgs/nixos-25.05";
|
||||
|
||||
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
|
||||
|
||||
# nixpkgs-master.url = "nixpkgs";
|
||||
|
||||
nixvim = {
|
||||
url = "github:nix-community/nixvim/nixos-25.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
pre-commit-hooks = {
|
||||
url = "github:cachix/git-hooks.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
secrets = {
|
||||
url = "git+ssh://git@git.vimium.com/jordan/nix-secrets.git";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
thunderbird-gnome-theme = {
|
||||
url = "github:rafaelmardojai/thunderbird-gnome-theme";
|
||||
flake = false;
|
||||
@@ -57,114 +83,61 @@
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ self, nixpkgs, ... }:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
inputs@{
|
||||
nixpkgs,
|
||||
flake-parts,
|
||||
...
|
||||
}:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
inputs.git-hooks-nix.flakeModule
|
||||
./nix/hosts.nix
|
||||
];
|
||||
|
||||
domain = "mesh.vimium.net";
|
||||
forEachSystem = lib.genAttrs [
|
||||
"x86_64-linux"
|
||||
flake = {
|
||||
overlays = nixpkgs.lib.packagesFromDirectoryRecursive {
|
||||
callPackage = path: overrides: import path;
|
||||
directory = ./overlays;
|
||||
};
|
||||
};
|
||||
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
];
|
||||
mkDeployNode = hostName: {
|
||||
hostname = "${hostName}.${domain}";
|
||||
|
||||
profiles.system = {
|
||||
user = "root";
|
||||
path =
|
||||
inputs.deploy-rs.lib.${
|
||||
self.nixosConfigurations.${hostName}.config.system.build.toplevel.system
|
||||
}.activate.nixos
|
||||
self.nixosConfigurations.${hostName};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
overlays = lib.packagesFromDirectoryRecursive {
|
||||
callPackage = path: overrides: import path;
|
||||
directory = ./overlays;
|
||||
};
|
||||
|
||||
legacyPackages = forEachSystem (
|
||||
system:
|
||||
lib.packagesFromDirectoryRecursive {
|
||||
callPackage = nixpkgs.legacyPackages.${system}.callPackage;
|
||||
directory = ./pkgs;
|
||||
}
|
||||
);
|
||||
|
||||
nixosConfigurations = lib.pipe ./hosts [
|
||||
builtins.readDir
|
||||
(lib.filterAttrs (name: value: value == "directory"))
|
||||
(lib.mapAttrs (
|
||||
name: value:
|
||||
lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
|
||||
modules = [
|
||||
{
|
||||
networking = {
|
||||
inherit domain;
|
||||
hostName = name;
|
||||
};
|
||||
}
|
||||
./hosts/${name}
|
||||
];
|
||||
}
|
||||
))
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
checks =
|
||||
builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib
|
||||
// (forEachSystem (system: {
|
||||
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
check-case-conflicts.enable = true;
|
||||
check-executables-have-shebangs.enable = true;
|
||||
check-merge-conflicts.enable = true;
|
||||
deadnix = {
|
||||
enable = true;
|
||||
settings = {
|
||||
noLambdaArg = true;
|
||||
};
|
||||
};
|
||||
detect-private-keys.enable = true;
|
||||
end-of-file-fixer.enable = true;
|
||||
fix-byte-order-marker.enable = true;
|
||||
mixed-line-endings.enable = true;
|
||||
nixfmt-rfc-style.enable = true;
|
||||
trim-trailing-whitespace.enable = true;
|
||||
};
|
||||
excludes = [ "pkgs/libcamera-rpi/libcamera-rpi-ipa-priv-key.pem" ];
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
|
||||
legacyPackages = pkgs.lib.packagesFromDirectoryRecursive {
|
||||
callPackage = pkgs.callPackage;
|
||||
directory = ./pkgs;
|
||||
};
|
||||
}));
|
||||
|
||||
formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
|
||||
|
||||
devShells = forEachSystem (system: {
|
||||
default = nixpkgs.legacyPackages.${system}.mkShell {
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
buildInputs = [
|
||||
inputs.agenix.packages.${system}.agenix
|
||||
inputs.deploy-rs.packages.${system}.deploy-rs
|
||||
]
|
||||
++ self.checks.${system}.pre-commit-check.enabledPackages;
|
||||
pre-commit = {
|
||||
settings = {
|
||||
excludes = [ "pkgs/libcamera-rpi/libcamera-rpi-ipa-priv-key.pem" ];
|
||||
hooks = {
|
||||
check-case-conflicts.enable = true;
|
||||
check-executables-have-shebangs.enable = true;
|
||||
check-merge-conflicts.enable = true;
|
||||
deadnix = {
|
||||
enable = true;
|
||||
settings = {
|
||||
noLambdaArg = true;
|
||||
};
|
||||
};
|
||||
detect-private-keys.enable = true;
|
||||
end-of-file-fixer.enable = true;
|
||||
fix-byte-order-marker.enable = true;
|
||||
mixed-line-endings.enable = true;
|
||||
nixfmt-rfc-style.enable = true;
|
||||
trim-trailing-whitespace.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
deploy = {
|
||||
magicRollback = true;
|
||||
autoRollback = true;
|
||||
sshUser = "root";
|
||||
nodes = lib.genAttrs [
|
||||
"artemis"
|
||||
"mail"
|
||||
"pi"
|
||||
"skycam"
|
||||
"vps1"
|
||||
"vps2"
|
||||
] mkDeployNode;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user