nixos-configs/flake.nix

283 lines
7.8 KiB
Nix
Raw Normal View History

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
2025-05-01 22:19:50 +02:00
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-11-24 18:10:44 +01:00
#keep-sorted start block=yes
2026-04-26 19:07:12 +02:00
flake-parts = {
url = "github:hercules-ci/flake-parts";
#inputs.nixpkgs.follows = "nixpkgs";
};
2025-11-15 14:13:00 +01:00
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.3";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
2025-03-16 10:25:59 +01:00
niri = {
url = "github:sodiboo/niri-flake";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
};
2025-03-16 10:25:59 +01:00
};
nix-filter.url = "github:numtide/nix-filter";
2025-10-12 15:16:44 +02:00
nix-vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
2026-01-03 18:45:55 +01:00
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
2026-04-26 19:07:12 +02:00
nixos-raspberrypi = {
url = "github:nvmd/nixos-raspberrypi/main";
};
nova-shell = {
url = "git+https://git.berlin.ccc.de/vinzenz/nova-shell";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
nur = {
url = "github:nix-community/NUR";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
};
};
2025-05-10 13:24:08 +02:00
servicepoint-cli = {
url = "git+https://git.berlin.ccc.de/servicepoint/servicepoint-cli.git";
inputs = {
nixpkgs.follows = "nixpkgs";
naersk.follows = "naersk";
nix-filter.follows = "nix-filter";
treefmt-nix.follows = "treefmt-nix";
};
2025-05-10 13:24:08 +02:00
};
servicepoint-simulator = {
url = "git+https://git.berlin.ccc.de/servicepoint/servicepoint-simulator.git";
inputs = {
# TODO: update flake to 25.11
# nixpkgs.follows = "nixpkgs";
naersk.follows = "naersk";
nix-filter.follows = "nix-filter";
};
2025-05-10 13:24:08 +02:00
};
2025-10-12 15:16:44 +02:00
servicepoint-tanks = {
url = "git+https://git.berlin.ccc.de/vinzenz/servicepoint-tanks.git?ref=service-improvements";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:nix-community/stylix/release-25.11";
inputs = {
nixpkgs.follows = "nixpkgs";
nur.follows = "nur";
flake-parts.follows = "flake-parts";
};
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
zerforschen-plus = {
url = "git+https://git.berlin.ccc.de/vinzenz/zerforschen.plus";
inputs.nixpkgs.follows = "nixpkgs";
};
#keep-sorted end
};
2024-10-27 12:33:35 +01:00
outputs =
2025-12-11 22:13:32 +01:00
inputs@{
2025-03-17 19:17:16 +01:00
self,
2024-10-27 12:33:35 +01:00
nixpkgs,
home-manager,
# keep-sorted start
2025-11-15 14:13:00 +01:00
lanzaboote,
2025-03-16 10:25:59 +01:00
niri,
2025-10-12 15:16:44 +02:00
nix-vscode-extensions,
2026-01-03 18:45:55 +01:00
nixos-generators,
2026-04-26 19:07:12 +02:00
nixos-raspberrypi,
nixpkgs-unstable,
2025-05-10 13:24:08 +02:00
servicepoint-cli,
servicepoint-simulator,
2025-10-12 15:16:44 +02:00
servicepoint-tanks,
stylix,
treefmt-nix,
zerforschen-plus,
# keep-sorted end
...
2024-10-27 12:33:35 +01:00
}:
let
devices = {
2026-04-26 19:07:12 +02:00
# keep-sorted start block=yes
aur0ra = {
system = "aarch64-linux";
nixosSystem = nixos-raspberrypi.lib.nixosSystem;
};
aur0ra-installer = {
# build with nix build .\#nixosConfigurations.aur0ra-installer.config.system.build.sdImage
system = "aarch64-linux";
nixosSystem = nixos-raspberrypi.lib.nixosInstaller;
};
damocles = {
system = "x86_64-linux";
2026-05-01 21:17:51 +02:00
distributedBuilds.maxJobs = 0;
2026-04-26 19:07:12 +02:00
};
2026-04-29 21:38:40 +02:00
damocles-lab = {
system = "x86_64-linux";
2026-05-01 21:17:51 +02:00
distributedBuilds.maxJobs = 0;
2026-04-29 21:38:40 +02:00
};
2026-04-26 19:07:12 +02:00
epimetheus = {
system = "aarch64-linux";
};
forgejo-runner-1 = {
system = "aarch64-linux";
};
hetzner-vpn2 = {
system = "aarch64-linux";
};
2026-02-01 12:23:07 +01:00
muede-lpt2 = {
system = "x86_64-linux";
home-manager-users = {
2026-02-01 12:23:07 +01:00
inherit (self.homeConfigurations) muede;
};
2026-05-01 21:17:51 +02:00
distributedBuilds.isBuilder = true;
};
2026-02-01 12:23:07 +01:00
muede-pc2 = {
system = "x86_64-linux";
home-manager-users = {
2026-02-01 12:23:07 +01:00
inherit (self.homeConfigurations) muede;
};
2026-05-01 21:17:51 +02:00
distributedBuilds = {
isBuilder = true;
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKAbojdhb3PfazSRmudvo381Y+zUFVLMa7AbWbfK/Zp2 muede-pc2-nix-builds";
};
};
ronja-pc = {
system = "x86_64-linux";
home-manager-users = {
inherit (self.homeConfigurations) ronja;
};
};
2026-04-26 19:07:12 +02:00
# keep-sorted end
};
inherit (nixpkgs) lib;
forDevice = f: lib.mapAttrs (device: value: f (value // { inherit device; })) devices;
supported-systems = lib.attrsets.mapAttrsToList (k: v: v.system) devices;
treefmt-config = {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
jsonfmt.enable = true;
prettier.enable = true;
keep-sorted.enable = true;
};
};
forAllSystems =
f:
2025-09-13 17:49:17 +02:00
lib.genAttrs supported-systems (
system:
f rec {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
treefmt-eval = treefmt-nix.lib.evalModule pkgs treefmt-config;
}
);
2025-09-15 23:30:28 +02:00
importModuleDir =
directory:
nixpkgs.lib.packagesFromDirectoryRecursive {
inherit directory;
callPackage = path: _args: path;
};
in
2025-09-14 12:37:29 +02:00
{
overlays = {
unstable-packages = final: prev: {
unstable = import nixpkgs-unstable {
2026-04-13 10:21:13 +02:00
localSystem = prev.stdenv.hostPlatform;
inherit (prev) config;
};
};
};
2025-09-15 23:30:28 +02:00
nixosModules = (importModuleDir ./nixosModules) // {
2025-11-02 01:19:27 +01:00
niri =
{ pkgs, ... }:
{
imports = [ niri.nixosModules.niri ];
nixpkgs.overlays = [ niri.overlays.niri ];
programs.niri = {
enable = true;
#package = pkgs.niri-stable;
};
};
pkgs-unstable = {
nixpkgs.overlays = [ self.overlays.unstable-packages ];
};
pkgs-vscode-extensions = {
nixpkgs.overlays = [ nix-vscode-extensions.overlays.default ];
};
# required modules to use other modules, should not do anything on their own
default = {
imports = [ self.nixosModules.allowed-unfree-list ];
};
};
2025-09-15 23:30:28 +02:00
homeModules = importModuleDir ./homeModules;
homeConfigurations = {
2026-02-01 12:23:07 +01:00
muede = ./homeConfigurations/muede;
2025-09-15 23:30:28 +02:00
ronja = ./homeConfigurations/ronja;
};
nixosConfigurations = forDevice (
{
device,
system,
home-manager-users ? { },
2026-04-29 23:58:15 +02:00
nixosSystem ? nixpkgs.lib.nixosSystem,
2026-05-01 21:17:51 +02:00
...
}:
2025-05-10 13:24:08 +02:00
let
2025-12-11 22:13:32 +01:00
specialArgs = inputs // {
2026-05-01 21:17:51 +02:00
inherit device home-manager-users devices;
2025-05-10 13:24:08 +02:00
};
in
2026-04-26 19:07:12 +02:00
nixosSystem {
2026-04-13 10:21:13 +02:00
inherit specialArgs;
2025-09-06 19:16:13 +02:00
modules = [
2025-09-13 15:25:54 +02:00
{
2025-12-11 22:13:32 +01:00
imports = [
2026-04-29 23:58:15 +02:00
./nixosConfigurations/${device}
2025-12-11 22:13:32 +01:00
self.nixosModules.global-settings
]
++ (lib.optionals (home-manager-users != { }) [
self.nixosModules.global-settings-desktop
]);
2025-09-14 14:01:42 +02:00
nixpkgs = {
hostPlatform = lib.mkDefault system;
};
2025-09-13 15:25:54 +02:00
}
2025-12-11 22:13:32 +01:00
];
}
);
formatter = forAllSystems ({ treefmt-eval, ... }: treefmt-eval.config.build.wrapper);
checks = forAllSystems (
{ treefmt-eval, ... }:
{
formatting = treefmt-eval.config.build.check self;
}
);
};
}