nixos-configs/flake.nix

166 lines
4.4 KiB
Nix
Raw Normal View History

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
2024-11-24 18:10:44 +01:00
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.05";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-11-24 18:10:44 +01:00
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
2025-03-16 10:25:59 +01:00
niri = {
url = "github:sodiboo/niri-flake";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
zerforschen-plus = {
url = "git+https://git.berlin.ccc.de/vinzenz/zerforschen.plus";
inputs.nixpkgs.follows = "nixpkgs";
};
2025-05-10 13:24:08 +02:00
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
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";
};
2025-05-10 13:24:08 +02:00
};
servicepoint-simulator = {
url = "git+https://git.berlin.ccc.de/servicepoint/servicepoint-simulator.git";
inputs = {
nixpkgs.follows = "nixpkgs";
naersk.follows = "naersk";
nix-filter.follows = "nix-filter";
};
2025-05-10 13:24:08 +02:00
};
nix-vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
# this is used to pin transitive dependencies to the same version
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
};
2024-10-27 12:33:35 +01:00
outputs =
inputs@{
2025-03-17 19:17:16 +01:00
self,
2024-10-27 12:33:35 +01:00
nixpkgs,
home-manager,
lix-module,
2025-03-16 10:25:59 +01:00
niri,
zerforschen-plus,
2025-05-01 22:19:50 +02:00
nixpkgs-unstable,
2025-05-10 13:24:08 +02:00
servicepoint-cli,
servicepoint-simulator,
naersk,
nix-vscode-extensions,
...
2024-10-27 12:33:35 +01:00
}:
let
devices = {
vinzenz-lpt2 = "x86_64-linux";
vinzenz-pc2 = "x86_64-linux";
2025-04-13 21:40:52 +02:00
ronja-pc = "x86_64-linux";
hetzner-vpn2 = "aarch64-linux";
forgejo-runner-1 = "aarch64-linux";
};
2025-03-16 10:25:59 +01:00
homeDevices = [
"vinzenz-lpt2"
"vinzenz-pc2"
2025-04-13 21:40:52 +02:00
"ronja-pc"
2025-03-16 10:25:59 +01:00
];
forDevice = f: nixpkgs.lib.mapAttrs f devices;
in
2025-05-01 22:19:50 +02:00
rec {
nixosConfigurations = forDevice (
device: system:
2025-05-10 13:24:08 +02:00
let
specialArgs = {
inherit inputs device;
};
in
nixpkgs.lib.nixosSystem {
2025-05-01 22:19:50 +02:00
inherit system specialArgs;
2025-03-16 10:25:59 +01:00
modules =
[
lix-module.nixosModules.default
{ networking.hostName = device; }
./modules/globalinstalls.nix
./modules/networking.nix
./modules/nixpkgs.nix
2025-03-16 10:25:59 +01:00
./hosts/${device}/hardware.nix
./hosts/${device}/imports.nix
./hosts/${device}/configuration.nix
2025-05-01 22:19:50 +02:00
2025-05-10 13:24:08 +02:00
{
nixpkgs.overlays = [
overlays.unstable-packages
];
}
2025-03-16 10:25:59 +01:00
]
++ (nixpkgs.lib.optionals (builtins.elem device homeDevices) [
home-manager.nixosModules.home-manager
2025-05-01 22:19:50 +02:00
{ home-manager.extraSpecialArgs = specialArgs; }
2025-03-16 10:25:59 +01:00
./modules/home-manager.nix
2025-03-16 10:25:59 +01:00
./modules/i18n.nix
2025-03-16 10:25:59 +01:00
niri.nixosModules.niri
2025-05-10 13:24:08 +02:00
{
nixpkgs.overlays = [
niri.overlays.niri
overlays.servicepoint-packages
nix-vscode-extensions.overlays.default
2025-05-10 13:24:08 +02:00
];
}
2025-03-16 10:25:59 +01:00
]);
}
);
2024-10-27 12:33:35 +01:00
2025-05-01 22:19:50 +02:00
overlays = {
unstable-packages = final: prev: {
unstable = import nixpkgs-unstable {
system = prev.system;
config = prev.config;
};
};
2025-05-10 13:24:08 +02:00
servicepoint-packages = final: prev: {
servicepoint-cli = servicepoint-cli.legacyPackages."${prev.system}".servicepoint-cli;
servicepoint-simulator =
servicepoint-simulator.legacyPackages."${prev.system}".servicepoint-simulator;
};
2025-05-01 22:19:50 +02:00
};
2024-10-27 12:33:35 +01:00
formatter = {
x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.nixfmt-rfc-style;
2024-10-26 14:59:00 +02:00
};
};
}