Files
cyper-nix/flake.nix

155 lines
3.6 KiB
Nix

{
description = "DerGrumpfs Nix Configuration";
inputs = {
# monorepo w/ recipes ("derivations")
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# declarative Configs
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative Hyprland
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland";
};
hyprcursor = {
url = "github:hyprwm/hyprcursor";
inputs.nixpkgs.follows = "nixpkgs";
};
# system-level software and settings (macOS)
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative homebrew management
nix-homebrew = {
url = "github:zhaofengli/nix-homebrew";
};
# declarative Neovim
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative Discord
nixcord = {
url = "github:kaylorben/nixcord";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative Spotify
spicetify-nix = {
url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative Encryption
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative Catppuccin
catppuccin = {
url = "github:catppuccin/nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
home-manager,
darwin,
nix-homebrew,
nixvim,
hyprland,
sops-nix,
...
}@inputs:
let
primaryUser = "phil";
mkSystem =
{
hostName,
system,
isDarwin ? false,
isServer ? false,
}:
let
systemFunc = if isDarwin then darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem;
platformModuleSet = if isDarwin then "darwinModules" else "nixosModules";
sharedSpecialArgs = {
inherit
inputs
primaryUser
self
hostName
isDarwin
isServer
;
};
sharedModules = [
{ networking.hostName = hostName; }
./hosts/${hostName}/configuration.nix
inputs.sops-nix.${platformModuleSet}.sops
inputs.home-manager.${platformModuleSet}.home-manager
{
home-manager.extraSpecialArgs = sharedSpecialArgs;
home-manager.users.${primaryUser} = import ./home;
}
];
platformModules =
let
nixosBase = [
{ nixpkgs.hostPlatform = system; }
./nixos
];
in
if isDarwin then
[
./darwin
inputs.nix-homebrew.darwinModules.nix-homebrew
]
else
nixosBase ++ (if isServer then [ ./nixos/server ] else [ ]);
in
systemFunc {
inherit system;
modules = sharedModules ++ platformModules;
specialArgs = sharedSpecialArgs;
};
in
{
nixosConfigurations = {
"cyper-desktop" = mkSystem {
hostName = "cyper-desktop";
system = "x86_64-linux";
};
};
darwinConfigurations."cyper-mac" = mkSystem {
hostName = "cyper-mac";
system = "x86_64-darwin";
isDarwin = true;
};
};
}