nixos/flake.nix

90 lines
2.3 KiB
Nix
Raw Normal View History

2024-08-04 23:45:01 +05:30
{
description = "My homebrew NixOS configurations";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = github:nix-community/nixvim;
inputs.nixpkgs.follows = "nixpkgs";
};
plasma-manager = {
url = github:nix-community/plasma-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
nur = {
url = github:nix-community/NUR;
};
2024-08-04 23:45:01 +05:30
nethack = {
url = git+https://git.psf.lt/xezo360hye/nethack?shallow=1;
};
};
outputs = { self, nixpkgs, home-manager, nixvim, nethack, plasma-manager, nur, ... } @ inputs:
2024-08-04 23:45:01 +05:30
let
inherit (self) outputs;
inherit (nixpkgs) lib;
2024-08-04 23:45:01 +05:30
username = "andrey";
hostnames = [ "tokishiko" "maidena" ];
stateVersion = "24.05";
2024-08-04 23:45:01 +05:30
makeSystem = hostname: {
2024-08-04 23:45:01 +05:30
"${hostname}" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
nur.nixosModules.nur
./system/common.nix
2024-08-04 23:45:01 +05:30
./system/${hostname}.nix
./hardware/${hostname}.nix
{
system.stateVersion = stateVersion;
networking.hostName = hostname;
}
2024-08-04 23:45:01 +05:30
];
};
};
extractModule = { homeManagerModules, ... }: homeManagerModules."${lib.head (lib.attrNames homeManagerModules)}";
homeManagerModules = map extractModule [ nixvim nethack plasma-manager ];
makeHome = hostname: {
2024-08-04 23:45:01 +05:30
"${username}@${hostname}" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "x86_64-linux";
2024-08-13 00:54:07 +05:30
config.allowUnfree = true;
overlays = [ nur.overlay ];
};
extraSpecialArgs = { inherit inputs; };
modules = homeManagerModules ++ [
nur.hmModules.nur
2024-08-04 23:45:01 +05:30
./home/${hostname}.nix
./home/common.nix
{
news.display = "show";
home.username = username;
home.homeDirectory = "/home/${username}";
home.stateVersion = stateVersion;
}
2024-08-04 23:45:01 +05:30
];
};
};
forEachHost = fn: lib.fold lib.mergeAttrs {} (map fn hostnames);
2024-08-04 23:45:01 +05:30
in {
nixosConfigurations = forEachHost makeSystem;
homeConfigurations = forEachHost makeHome;
2024-08-04 23:45:01 +05:30
};
}