nixos-configs/flake.nix

282 lines
8.3 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
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,
nixpkgs-unstable,
nova-shell,
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
2026-05-01 22:04:11 +02:00
devices = import ./devices.nix { inherit self; };
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 = final: prev: {
unstable = import nixpkgs-unstable {
2026-04-13 10:21:13 +02:00
localSystem = prev.stdenv.hostPlatform;
inherit (prev) config;
};
};
vscodeExtensions = nix-vscode-extensions.overlays.default;
niri = niri.overlays.niri;
};
nixosModules = importModuleDir ./nixosModules;
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 = [
./nixosConfigurations/${device}
self.nixosModules.default
# keep-sorted start
home-manager.nixosModules.home-manager
lanzaboote.nixosModules.lanzaboote
nova-shell.nixosModules.default
servicepoint-cli.nixosModules.default
servicepoint-simulator.nixosModules.default
servicepoint-tanks.nixosModules.default
stylix.nixosModules.stylix
zerforschen-plus.nixosModules.default
# keep-sorted end
# Base config (replaces global-settings.nix)
2025-09-13 15:25:54 +02:00
{
nixpkgs.hostPlatform = lib.mkDefault system;
networking.hostName = device;
system = {
stateVersion = "22.11";
autoUpgrade.flake = "git+https://git.berlin.ccc.de/vinzenz/nixos-configuration.git";
2025-09-14 14:01:42 +02:00
};
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
documentation = {
info.enable = false;
doc.enable = false;
};
my = {
autoupdate.enable = true;
distributedBuilds.enable = true;
overlays.unstable.enable = true;
overlays.vscodeExtensions.enable = true;
extraCaches.enable = true;
globalinstalls.enable = true;
lixIsNix.enable = true;
openssh.enable = true;
# prometheusNode.enable = true;
systemdBoot.enable = true;
tailscale.enable = true;
};
}
]
++ lib.optionals (home-manager-users != { }) [
# Desktop config (replaces global-settings-desktop.nix)
{
home-manager = {
extraSpecialArgs = specialArgs;
useGlobalPkgs = true;
useUserPackages = true;
users = home-manager-users;
sharedModules = [
{ home.stateVersion = "22.11"; }
# keep-sorted start
self.homeModules.git
self.homeModules.gnome-extensions
self.homeModules.nano
self.homeModules.templates
self.homeModules.zsh-basics
# keep-sorted end
];
};
time.timeZone = "Europe/Berlin";
# on desktops, keep the device useable interactively during expensive builds
nix = {
daemonCPUSchedPolicy = "idle";
daemonIOSchedClass = "idle";
};
my = {
enDe.enable = true;
firmwareUpdates.enable = true;
gnome.enable = true;
kdeconnect.enable = true;
modernDesktop.enable = true;
nixLd.enable = true;
quietBoot.enable = true;
stylix.enable = true;
};
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;
}
);
};
}