Initial commit
This commit is contained in:
116
flake.nix
Normal file
116
flake.nix
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
description = "Fxnet system configurations";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
photocatalog = {
|
||||
url = "github:derfenix/photocatalog";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# disko = {
|
||||
# url = "github:nix-community/disko/latest";
|
||||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
# };
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-stable,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
timeZone = "Europe/Moscow";
|
||||
stateVersion = "25.05";
|
||||
|
||||
hmModules = builtins.map (name: ./modules/hm + "/${name}") (
|
||||
builtins.attrNames (builtins.readDir ./modules/hm)
|
||||
);
|
||||
sysModules = builtins.map (name: ./modules/sys + "/${name}") (
|
||||
builtins.attrNames (builtins.readDir ./modules/sys)
|
||||
);
|
||||
pkgsSettings = (
|
||||
system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
}
|
||||
);
|
||||
pkgsStableSettings =
|
||||
system:
|
||||
import nixpkgs-stable {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
hosts = import ./hosts.nix;
|
||||
hostNames = builtins.attrNames hosts;
|
||||
|
||||
commonModules = [
|
||||
(
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
system.stateVersion = stateVersion;
|
||||
time.timeZone = lib.mkDefault timeZone;
|
||||
home-manager = {
|
||||
backupFileExtension = ".bak";
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
sharedModules = hmModules ++ [
|
||||
(
|
||||
{ osConfig, ... }:
|
||||
{
|
||||
home.stateVersion = osConfig.system.stateVersion;
|
||||
}
|
||||
)
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
inherit inputs;
|
||||
pkgsStable = pkgsStableSettings pkgs.system;
|
||||
hosts = hosts;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.photocatalog.nixosModules.photocatalog
|
||||
./options.nix
|
||||
./nix.nix
|
||||
]
|
||||
++ sysModules;
|
||||
in
|
||||
{
|
||||
nixosConfigurations = lib.genAttrs hostNames (
|
||||
name:
|
||||
let
|
||||
host = hosts.${name};
|
||||
in
|
||||
if host ? system then
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
system = host.system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
pkgsStable = pkgsStableSettings host.system;
|
||||
hosts = hosts;
|
||||
ip = host.ip;
|
||||
};
|
||||
pkgs = pkgsSettings host.system;
|
||||
modules = commonModules ++ [
|
||||
./hosts/${name}
|
||||
./hosts/${name}/hardware-configuration.nix
|
||||
./roles/${host.role}.nix
|
||||
];
|
||||
}
|
||||
else
|
||||
{ }
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user