2023-10-22 17:12:42 +02:00
|
|
|
{
|
|
|
|
description = "Dala's unified NixOS configuration";
|
|
|
|
inputs = {
|
|
|
|
# As we have machine using the unstable channel, and other machines using the stable one,
|
|
|
|
# we import both, and we will select for each machine which one to use.
|
|
|
|
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2024-06-04 20:47:23 +02:00
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
2023-10-22 17:12:42 +02:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
|
|
|
|
# Home-manager isn't used for anything except my workstations, which all use the unstable channel.
|
|
|
|
home-manager = {
|
|
|
|
url = "github:nix-community/home-manager";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
|
|
|
};
|
|
|
|
|
|
|
|
# For sops-nix, we keep the unstable nixpkgs, as it shouldn't break anything.
|
|
|
|
# This input is made to manage secrets on this repository.
|
|
|
|
sops-nix = {
|
|
|
|
url = "github:Mic92/sops-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
|
|
|
};
|
2023-11-19 17:00:09 +01:00
|
|
|
|
2024-07-15 10:13:33 +02:00
|
|
|
# Use Lix instead of Nix
|
|
|
|
lix-module-unstable = {
|
|
|
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
|
|
|
};
|
|
|
|
|
|
|
|
lix-module-stable = {
|
|
|
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-stable";
|
|
|
|
};
|
|
|
|
|
2024-07-28 11:15:10 +02:00
|
|
|
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
|
|
|
|
|
2024-07-27 16:10:56 +02:00
|
|
|
extra-config.url = "git+ssh://forgejo@git.dalaran.fr/dala/nixos-config-extra.git";
|
2023-10-22 17:12:42 +02:00
|
|
|
};
|
|
|
|
|
2024-04-11 20:15:47 +02:00
|
|
|
outputs =
|
|
|
|
{
|
|
|
|
self,
|
|
|
|
nixpkgs-unstable,
|
|
|
|
nixpkgs-stable,
|
|
|
|
home-manager,
|
|
|
|
sops-nix,
|
|
|
|
flake-utils,
|
|
|
|
extra-config,
|
2024-07-15 10:13:33 +02:00
|
|
|
lix-module-unstable,
|
|
|
|
lix-module-stable,
|
2024-07-28 11:15:10 +02:00
|
|
|
lanzaboote,
|
2024-04-11 20:15:47 +02:00
|
|
|
}:
|
2023-10-22 17:12:42 +02:00
|
|
|
let
|
|
|
|
machines = import ./machines.nix;
|
|
|
|
in
|
|
|
|
{
|
2024-04-11 20:15:47 +02:00
|
|
|
nixosConfigurations = builtins.mapAttrs (
|
|
|
|
name: value:
|
|
|
|
let
|
|
|
|
nixpkgs = if value.nixpkgsUnstable then nixpkgs-unstable else nixpkgs-stable;
|
2024-07-15 10:13:33 +02:00
|
|
|
lix-module = if value.nixpkgsUnstable then lix-module-unstable else lix-module-stable;
|
2024-04-11 20:15:47 +02:00
|
|
|
in
|
|
|
|
nixpkgs.lib.nixosSystem {
|
|
|
|
system = value.system;
|
2023-10-22 17:12:42 +02:00
|
|
|
|
2024-04-11 20:15:47 +02:00
|
|
|
specialArgs = {
|
|
|
|
machineInfos = {
|
|
|
|
hostname = name;
|
|
|
|
} // value;
|
2023-10-22 17:12:42 +02:00
|
|
|
|
2024-04-11 20:15:47 +02:00
|
|
|
sopsHmModule = sops-nix.homeManagerModules.sops;
|
2023-11-20 21:37:14 +01:00
|
|
|
|
2024-04-11 20:15:47 +02:00
|
|
|
extraInfo = extra-config.extraSecrets;
|
|
|
|
};
|
2023-10-22 17:12:42 +02:00
|
|
|
|
2024-04-11 20:15:47 +02:00
|
|
|
modules = [
|
|
|
|
./configurations/${name}
|
|
|
|
./modules/common
|
|
|
|
(if (value.machineType == "workstation") then ./modules/workstation else ./modules/server)
|
|
|
|
(
|
|
|
|
if (value.machineType == "workstation" && value.enableHomeManager) then
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
else
|
|
|
|
{ }
|
|
|
|
)
|
|
|
|
sops-nix.nixosModules.sops
|
2024-07-15 10:13:33 +02:00
|
|
|
lix-module.nixosModules.default
|
2024-07-28 11:15:10 +02:00
|
|
|
lanzaboote.nixosModules.lanzaboote
|
2024-04-11 20:15:47 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
) machines;
|
2023-10-22 17:12:42 +02:00
|
|
|
|
2024-04-11 20:15:47 +02:00
|
|
|
formatter = builtins.listToAttrs (
|
|
|
|
map (system: {
|
|
|
|
name = system;
|
|
|
|
value = nixpkgs-unstable.legacyPackages.${system}.nixfmt-rfc-style;
|
|
|
|
}) flake-utils.lib.defaultSystems
|
|
|
|
);
|
2023-11-15 18:05:25 +01:00
|
|
|
|
|
|
|
hydraJobs = {
|
|
|
|
nixos = builtins.mapAttrs (_: cfg: cfg.config.system.build.toplevel) self.nixosConfigurations;
|
|
|
|
};
|
2023-10-22 17:12:42 +02:00
|
|
|
};
|
|
|
|
}
|