nibylandia/flake.nix

199 lines
5.4 KiB
Nix
Raw Normal View History

2023-09-03 11:35:16 +00:00
{
description = "Nibylandia configurations";
inputs = {
2023-10-09 12:37:47 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2023-09-03 11:35:16 +00:00
home-manager.url = "github:nix-community/home-manager";
nix-colors.url = "github:misterio77/nix-colors";
nix-formatter-pack.url = "github:Gerschtli/nix-formatter-pack";
nix-index-database.url = "github:Mic92/nix-index-database";
deploy-rs.url = "github:serokell/deploy-rs";
2023-10-09 12:37:47 +00:00
microvm.url = "github:astro/microvm.nix";
2023-09-03 11:35:16 +00:00
agenix = {
url = "github:ryantm/agenix";
inputs.darwin.follows = "";
};
lanzaboote = {
url = "github:nix-community/lanzaboote";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-09-03 11:35:16 +00:00
};
outputs = { self, nixpkgs, nix-formatter-pack, nix-index-database, deploy-rs
2023-10-09 12:37:47 +00:00
, agenix, lanzaboote, microvm, ... }:
2023-10-08 23:21:05 +00:00
let
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
pkgsForDeploy =
forAllSystems (system: import nixpkgs { inherit system; });
deployPkgs = forAllSystems (system:
let pkgs = pkgsForDeploy.${system};
in import nixpkgs {
inherit system;
overlays = [
deploy-rs.overlay
(self: super: {
deploy-rs = {
inherit (pkgs) deploy-rs;
inherit (super.deploy-rs) lib;
};
})
];
});
2023-09-03 11:35:16 +00:00
in {
formatter = forAllSystems (system:
nix-formatter-pack.lib.mkFormatter {
inherit nixpkgs system;
config = {
tools = {
deadnix = {
enable = true;
noLambdaPatternNames = true;
noLambdaArg = true;
};
statix.enable = true;
nixfmt.enable = true;
};
};
});
nixosModules = with self.nixosModules; {
nibylandia-boot.imports = [ ./modules/boot.nix ];
nibylandia-secureboot.imports = [
lanzaboote.nixosModules.lanzaboote
({ config, lib, ... }: {
age.secrets = {
secureboot-cert.file = ./secrets/secureboot-cert.age;
secureboot-key.file = ./secrets/secureboot-key.age;
};
boot.lanzaboote = {
enable = true;
publicKeyFile = config.age.secrets.secureboot-cert.path;
privateKeyFile = config.age.secrets.secureboot-key.path;
};
nibylandia-boot.uefi.enable = lib.mkForce false;
})
];
nibylandia-common.imports = [
nix-index-database.nixosModules.nix-index
agenix.nixosModules.default
2023-10-09 12:37:47 +00:00
microvm.nixosModules.host
nibylandia-boot
2023-10-08 23:21:05 +00:00
({ pkgs, ... }: {
environment.systemPackages =
[ agenix.packages.${pkgs.system}.default ];
})
./modules/common.nix
];
nibylandia-graphical.imports = [
nibylandia-common
./modules/graphical.nix
];
nibylandia-laptop.imports = [ ./modules/laptop.nix ];
nibylandia-gaming.imports = [ ./modules/gaming.nix ];
};
nixosConfigurations = with self.nixosModules; {
2023-10-11 21:36:59 +00:00
ciTest = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nibylandia-common
{
nibylandia-boot.uefi.enable = true;
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = [ "defaults" "size=8G" "mode=755" ];
};
}
];
};
2023-09-03 11:35:16 +00:00
scylla = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
nibylandia-common
./nixos/scylla
];
};
khas = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nibylandia-graphical
nibylandia-laptop
nibylandia-secureboot
nibylandia-gaming
./nixos/khas
2023-09-03 11:35:16 +00:00
];
};
2023-10-08 22:07:57 +00:00
microlith = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nibylandia-graphical
nibylandia-gaming
2023-10-09 01:21:12 +00:00
nibylandia-secureboot
2023-10-08 22:07:57 +00:00
./nixos/microlith
];
};
2023-09-03 11:35:16 +00:00
};
deploy.nodes.scylla = {
fastConnection = false;
remoteBuild = true;
hostname = "i.am-a.cat";
profiles.system = {
user = "root";
sshUser = "root";
2023-10-08 23:21:05 +00:00
path = deployPkgs.aarch64-linux.deploy-rs.lib.activate.nixos
2023-09-03 11:35:16 +00:00
self.nixosConfigurations.scylla;
};
};
deploy.nodes.khas = {
fastConnection = false;
remoteBuild = true;
hostname = "khas";
profiles.system = {
user = "root";
sshUser = "root";
2023-10-08 23:21:05 +00:00
path = deployPkgs.x86_64-linux.deploy-rs.lib.activate.nixos
self.nixosConfigurations.khas;
};
};
2023-10-08 22:07:57 +00:00
deploy.nodes.microlith = {
fastConnection = false;
remoteBuild = true;
2023-10-09 00:56:55 +00:00
hostname = "microlith.nibylandia.lan";
2023-10-08 22:07:57 +00:00
profiles.system = {
user = "root";
sshUser = "root";
2023-10-08 23:21:05 +00:00
path = deployPkgs.x86_64-linux.deploy-rs.lib.activate.nixos
2023-10-08 22:07:57 +00:00
self.nixosConfigurations.microlith;
};
};
2023-09-03 11:35:16 +00:00
checks = builtins.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}