NixOSConfig/flake.nix

62 lines
1.7 KiB
Nix
Raw Normal View History

2023-12-01 11:29:39 +00:00
{
2024-05-01 12:00:39 +00:00
description = "NixOS Machine Configurations by manuth";
2023-12-01 11:29:39 +00:00
2024-05-01 12:00:39 +00:00
inputs = {
nixpkgs.url = "nixpkgs/38c01297e7ec11f7b9e3f2cae7d6fcec6cc767ec";
2024-05-01 16:14:25 +00:00
flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a";
2024-05-01 12:00:39 +00:00
};
2023-12-01 11:29:39 +00:00
2024-05-01 17:13:25 +00:00
outputs = { self, nixpkgs, flake-utils }: (
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShellNoCC (
with pkgs;
{
packages = [
nixos-rebuild
];
});
}
) // {
nixosConfigurations =
2024-05-01 16:14:25 +00:00
let
2024-05-01 17:13:25 +00:00
systems = [
2024-05-01 16:14:25 +00:00
{
2024-05-01 17:13:25 +00:00
name = "nixos";
}
];
in
builtins.listToAttrs (
2024-05-01 16:58:39 +00:00
builtins.map (
2024-05-01 17:13:25 +00:00
{ name, system ? "x86_64-linux", ... }@config: {
inherit name;
2024-05-01 16:58:39 +00:00
2024-05-01 17:13:25 +00:00
value = nixpkgs.lib.nixosSystem {
inherit system;
2024-05-01 16:58:39 +00:00
2024-05-01 17:13:25 +00:00
modules = [
({ ... }: { config._module.args = { machineConfig = config; }; })
./lib/configuration.nix
2024-05-01 16:58:39 +00:00
2024-05-01 17:13:25 +00:00
(
let
configCandidate = ./lib/machines/${name}.nix;
machineConfigPath =
if builtins.pathExists configCandidate
then
configCandidate
else
./lib/hardware/base.nix;
in
machineConfigPath)
];
};
})
2024-05-01 16:58:39 +00:00
systems);
2024-05-01 17:13:25 +00:00
});
2023-12-01 11:29:39 +00:00
}