nixos/flake.nix
2023-09-07 09:22:22 +01:00

149 lines
4.6 KiB
Nix

{
description = "Evie's machine configurations";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
anyrun = {
url = "github:Kirottu/anyrun";
inputs.nixpkgs.follows = "nixpkgs";
};
wallpapers.url = "git+https://git.xenia.me.uk/xenia/wallpapers.git";
catppuccin-alacritty = {
url = "github:catppuccin/alacritty";
flake = false;
};
catppuccin-bat = {
url = "github:catppuccin/bat";
flake = false;
};
catppuccin-fish = {
url = "github:catppuccin/fish";
flake = false;
};
catppuccin-gitui = {
url = "github:catppuccin/gitui";
flake = false;
};
catppuccin-hyprland = {
url = "github:catppuccin/hyprland";
flake = false;
};
catppuccin-zathura = {
url = "github:catppuccin/zathura";
flake = false;
};
catppuccin-zsh = {
url = "github:catppuccin/zsh-syntax-highlighting";
flake = false;
};
};
outputs =
inputs@{ self, nixpkgs, home-manager, hyprland, anyrun, wallpapers, ... }:
let
catppuccin-themes = with inputs; {
alacritty = "${catppuccin-alacritty}/catppuccin-mocha.yml";
bat = "${catppuccin-bat}/Catppuccin-mocha.tmTheme";
fish = "${catppuccin-fish}/themes/Catppuccin Mocha.theme";
gitui = "${catppuccin-gitui}/theme/mocha.ron";
hyprland = "${catppuccin-hyprland}/themes/mocha.conf";
zathura = "${catppuccin-zathura}/src/catppuccin-mocha";
zsh =
"${catppuccin-zsh}/themes/catppuccin_mocha-zsh-syntax-highlighting.zsh";
};
systemConfig =
{ hostName, user ? "xenia", system ? "x86_64-linux", shell ? "zsh" }:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
(final: prev: {
waybar = prev.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
});
})
];
};
in nixpkgs.lib.nixosSystem {
inherit pkgs;
specialArgs = { inherit hostName user shell hyprland; };
modules = [
./hosts/${hostName}/configuration.nix
./services/${hostName}.nix
{
networking = { inherit hostName; };
users.users.${user} = {
isNormalUser = true;
description = "Evie Litherland-Smith";
group = "users";
extraGroups = [ "networkmanager" "wheel" "video" ];
shell = pkgs.${shell};
openssh.authorizedKeys.keys = import ./auth/authorized_keys.nix;
};
}
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit hostName user shell hyprland anyrun wallpapers
catppuccin-themes;
shellConfig = ./home/shell/${shell}.nix;
};
users.${user} = import ./hosts/${hostName}/home.nix;
};
}
];
};
homeConfig = { hostName, user, system ? "x86_64-linux", shell ? "zsh" }:
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {
inherit hostName user shell hyprland anyrun wallpapers
catppuccin-themes;
shellConfig = ./home/shell/${shell}.nix;
};
modules = [ ./hosts/${hostName}/home.nix ];
};
in {
nixosConfigurations = {
Legion = systemConfig {
hostName = "Legion";
user = "xenia";
system = "x86_64-linux";
shell = "zsh";
};
Ronin = systemConfig {
hostName = "Ronin";
user = "elitherl";
system = "x86_64-linux";
shell = "zsh";
};
Vanguard = systemConfig {
hostName = "Vanguard";
user = "xenia";
system = "x86_64-linux";
shell = "zsh";
};
};
homeConfigurations = {
"tux@Monarch" = homeConfig {
hostName = "Monarch";
user = "tux";
system = "aarch64-darwin";
shell = "zsh";
};
};
};
}