clan-infra/flake.nix

71 lines
2.7 KiB
Nix
Raw Normal View History

2023-07-04 14:43:31 +00:00
{
description = "Dependencies to deploy a clan";
2023-07-05 15:27:07 +00:00
nixConfig = {
extra-substituters = [ "https://cache.clan.lol" ];
2023-10-04 18:37:59 +00:00
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";
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";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
2023-07-05 15:19:22 +00:00
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "";
2023-07-04 14:43:31 +00:00
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
2023-09-19 11:49:18 +00:00
clan-core.url = "git+https://git.clan.lol/clan/clan-core";
2023-10-04 18:37:59 +00:00
#clan-core.url = "git+file:///home/joerg/work/clan/clan-core?ref=kvm-fix";
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";
flake.lock: Update Flake lock file updates: • Updated input 'clan-core': 'git+https://git.clan.lol/clan/clan-core?ref=refs/heads/main&rev=f626c6e81577509b72469a7312054cd3c55fa8f1' (2023-08-11) → 'git+https://git.clan.lol/clan/clan-core?ref=refs/heads/main&rev=7365df338bb75782703be633976ca6add6002e88' (2023-08-23) • Updated input 'clan-core/disko': 'github:nix-community/disko/241c878d4b542fea7c61ed4421e9224af054ff56' (2023-08-11) → 'github:nix-community/disko/4eed2457b053c4bbad7d90d2b3a1d539c2c9009c' (2023-08-16) • Added input 'clan-core/sops-nix': 'github:Mic92/sops-nix/1b7b3a32d65dbcd69c217d7735fdf0a6b2184f45' (2023-08-22) • Added input 'clan-core/sops-nix/nixpkgs': follows 'clan-core/sops-nix' • Added input 'clan-core/sops-nix/nixpkgs-stable': follows 'clan-core' • Updated input 'disko': 'github:nix-community/disko/241c878d4b542fea7c61ed4421e9224af054ff56' (2023-08-11) → 'github:nix-community/disko/4eed2457b053c4bbad7d90d2b3a1d539c2c9009c' (2023-08-16) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/0b07d4957ee1bd7fd3bdfd12db5f361bd70175a6' (2023-08-20) → 'github:NixOS/nixpkgs/9d757ec498666cc1dcc6f2be26db4fd3e1e9ab37' (2023-08-22) • Updated input 'sops-nix': 'github:Mic92/sops-nix/c36df4fe4bf4bb87759b1891cab21e7a05219500' (2023-07-24) → 'github:Mic92/sops-nix/1b7b3a32d65dbcd69c217d7735fdf0a6b2184f45' (2023-08-22) • Updated input 'srvos': 'github:numtide/srvos/b7407c2dc143402de6f140575398020175f3ae1a' (2023-08-10) → 'github:numtide/srvos/1fdce805f65f8d44856b5af1340de0fd6d0811a9' (2023-08-22) • Updated input 'treefmt-nix': 'github:numtide/treefmt-nix/7b380d3cce8271b37394790b521ec2f7a6b248ad' (2023-08-08) → 'github:numtide/treefmt-nix/e2761d701581d8dcc4e0e88aecfde317ddf6f0cd' (2023-08-20)
2023-08-23 12:05:10 +00:00
clan-core.inputs.sops-nix.follows = "sops-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.hcl.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
}