clan-infra/flake.nix

68 lines
2.6 KiB
Nix
Raw Normal View History

2023-07-04 14:43:31 +00:00
{
description = "Dependencies to deploy a clan";
2024-04-12 13:40:27 +00:00
#nixConfig = {
# extra-substituters = [ "https://cache.clan.lol" ];
# extra-trusted-public-keys = [ "cache.clan.lol-1:3KztgSAB5R1M+Dz7vzkBGzXdodizbgLXGXKXlcQLA28=" ];
#};
2023-07-05 15:27:07 +00:00
2023-07-04 14:43:31 +00:00
inputs = {
2023-08-22 11:18:39 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2024-05-28 15:03:34 +00:00
2023-07-04 14:43:31 +00:00
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
srvos.url = "github:numtide/srvos";
# Use the version of nixpkgs that has been tested to work with SrvOS
srvos.inputs.nixpkgs.follows = "nixpkgs";
2023-07-26 16:29:57 +00:00
2024-05-28 15:03:34 +00:00
clan-core.url = "https://git.clan.lol/clan/clan-core/archive/main.tar.gz";
2023-07-26 16:29:57 +00:00
clan-core.inputs.flake-parts.follows = "flake-parts";
clan-core.inputs.nixpkgs.follows = "nixpkgs";
clan-core.inputs.treefmt-nix.follows = "treefmt-nix";
2024-04-30 11:17:19 +00:00
2024-05-03 11:02:36 +00:00
buildbot-nix.url = "github:Mic92/buildbot-nix";
2024-04-30 11:17:19 +00:00
buildbot-nix.inputs.nixpkgs.follows = "nixpkgs";
buildbot-nix.inputs.flake-parts.follows = "flake-parts";
buildbot-nix.inputs.treefmt-nix.follows = "treefmt-nix";
2023-07-04 14:43:31 +00:00
};
outputs = inputs@{ flake-parts, ... }:
2023-09-19 11:49:18 +00:00
flake-parts.lib.mkFlake { inherit inputs; } ({ self, ... }: {
2023-07-13 09:29:07 +00:00
systems = [
"x86_64-linux"
"aarch64-linux"
];
2023-07-04 14:43:31 +00:00
imports = [
inputs.treefmt-nix.flakeModule
2023-08-03 14:13:22 +00:00
./devShells/flake-module.nix
2023-07-04 14:43:31 +00:00
./targets/flake-module.nix
./modules/flake-module.nix
./pkgs/flake-module.nix
2023-07-04 14:43:31 +00:00
];
2023-09-19 11:49:18 +00:00
perSystem = ({ lib, self', system, ... }: {
2023-07-04 14:43:31 +00:00
treefmt = {
2023-08-30 15:25:20 +00:00
projectRootFile = ".git/config";
2023-11-03 09:35:35 +00:00
programs.hclfmt.enable = true;
2023-07-04 14:43:31 +00:00
programs.nixpkgs-fmt.enable = true;
2023-07-14 13:42:38 +00:00
settings.formatter.nixpkgs-fmt.excludes = [
# generated files
"node-env.nix"
"node-packages.nix"
"composition.nix"
];
2023-07-04 14:43:31 +00:00
};
2023-09-19 11:49:10 +00:00
checks =
let
nixosMachines = lib.mapAttrs' (name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
homeConfigurations = lib.mapAttrs' (name: config: lib.nameValuePair "home-manager-${name}" config.activation-script) (self'.legacyPackages.homeConfigurations or { });
in
nixosMachines // packages // devShells // homeConfigurations;
});
2023-09-19 11:49:18 +00:00
});
2023-07-04 14:43:31 +00:00
}