nix/flake.nix
2024-08-21 22:57:05 +09:00

134 lines
7.3 KiB
Nix

{
description = "NixOS System Config";
inputs = {
# Stable Packages
nixpkgs.url = "nixpkgs/nixos-24.05";
# Unstable Packages
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
# home-manager - Dotfile mnagement - add /master at the end to pull from master
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Nix colorizer / themer
stylix.url = "github:danth/stylix/release-24.05";
# nixvim - neovim configuration management in nix
nixvim.url = "github:nix-community/nixvim/nixos-24.05";
# lanzaboote - Secureboot Configuration
lanzaboote.url = "github:nix-community/lanzaboote";
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
# nixpkgs-wayland - Wayland-specific packages not in nixpkgs
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
# nur - Nix User Repository - user-submitted / maintained packages
nur.url = "github:nix-community/NUR";
# sops-nix - Secret Management with SOPS using GPG Keys
sops-nix.url = "github:Mic92/sops-nix";
# nixos-hardware - Hardware Configurations
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# nixos-generators - Automated Image / ISO Creation
nixos-generators.url = "github:nix-community/nixos-generators";
nixos-generators.inputs.nixpkgs.follows = "nixpkgs";
# disko - Declarative Disk Partitioning
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
# Firefox theme, for "Gradience" GTK Theming
# firefox-gnome-theme.url = "github:rafaelmardojai/firefox-gnome-theme";
# firefox-gnome-theme.flake = false;
# deploy-rs, declarative NixOS deployments
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
# Steam Deck configs for NixOS
jovian.url = "github:Jovian-Experiments/Jovian-NixOS";
# Manage Plasma desktop with Nix
plasma-manager.url = "github:pjones/plasma-manager";
plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
# Gnome / KDE-like overview
Hyprspace.url = "github:KZDKM/Hyprspace";
Hyprspace.inputs.hyprland.follows = "nixpkgs";
};
outputs = { self, nixpkgs, sops-nix, deploy-rs, ... } @inputs:
let
inherit (self) outputs;
stateVersion = "23.11";
hmStateVersion = "23.11";
libx = import ./lib/default.nix { inherit self inputs outputs stateVersion hmStateVersion; };
in {
nixosConfigurations = {
# Linode VMs
osaka-linode-01 = libx.mkHost { hostname = "osaka-linode-01"; type = "small";};
milan-linode-01 = libx.mkHost { hostname = "milan-linode-01"; type = "small";};
frankfurt-linode-01 = libx.mkHost { hostname = "frankfurt-linode-01"; type = "small";};
# Servers
framework-server = libx.mkHost { hostname = "framework-server"; };
warsaw-ovh-01 = libx.mkHost { hostname = "warsaw-ovh-01"; };
nuc-server = libx.mkHost { hostname = "nuc-server"; };
# User Machines
nixos-desktop = libx.mkHost { hostname = "nixos-desktop"; unfree = true; desktop = "plasma6"; };
nixos-framework = libx.mkHost { hostname = "nixos-framework"; unfree = true; desktop = "hyprland"; theme = "gruvbox"; };
steamdeck = libx.mkDeck { hostname = "steamdeck"; desktop = "plasma6"; };
# Raspberry Pi's
backups-rpi4 = libx.mkHost { hostname = "backups-rpi4"; system = "aarch64-linux"; type = "small"; };
piaware-rpi4 = libx.mkHost { hostname = "piaware-rpi4"; system = "aarch64-linux"; type = "small"; };
quitman-rpi4 = libx.mkHost { hostname = "quitman-rpi4"; system = "aarch64-linux"; type = "small"; };
bakersfield-rpi4 = libx.mkHost { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; type = "small"; };
};
homeConfigurations = {
# Linode VMs
"albert@osaka-linode-01" = libx.mkHome { hostname = "osaka-linode-01"; type = "small"; };
"albert@milan-linode-01" = libx.mkHome { hostname = "milan-linode-01"; type = "small"; };
"albert@frankfurt-linode-01" = libx.mkHome { hostname = "frankfurt-linode-01"; type = "small"; };
# Servers
"albert@framework-server" = libx.mkHome { hostname = "framework-server"; };
"albert@warsaw-ovh-01" = libx.mkHome { hostname = "warsaw-ovh-01"; };
"albert@nuc-server" = libx.mkHome { hostname = "nuc-server"; };
# User Machines
"albert@nixos-desktop" = libx.mkHome { hostname = "nixos-desktop"; desktop = "plasma6"; };
"albert@nixos-framework" = libx.mkHome { hostname = "nixos-framework"; desktop = "hyprland"; theme = "gruvbox"; };
"albert@steamdeck" = libx.mkHome { hostname = "steamdeck"; desktop = "plasma6"; };
# Raspberry Pi's
"albert@backups-rpi4" = libx.mkHome { hostname = "backups-rpi4"; system = "aarch64-linux"; type = "small"; };
"albert@piaware-rpi4" = libx.mkHome { hostname = "piaware-rpi4"; system = "aarch64-linux"; type = "small"; };
"albert@quitman-rpi4" = libx.mkHome { hostname = "quitman-rpi4"; system = "aarch64-linux"; type = "small"; };
"albert@bakersfield-rpi4" = libx.mkHome { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; type = "small"; };
# Containers
"albert@rdesktop" = libx.mkHome { hostname = "rdesktop"; desktop = "plasma6"; };
};
deploy.nodes = {
# Linode VMs
osaka-linode-01 = libx.deploy { hostname = "osaka-linode-01"; };
milan-linode-01 = libx.deploy { hostname = "milan-linode-01"; };
frankfurt-linode-01 = libx.deploy { hostname = "frankfurt-linode-01"; };
# Servers
framework-server = libx.deploy { hostname = "framework-server"; };
warsaw-ovh-01 = libx.deploy { hostname = "warsaw-ovh-01"; };
# nuc-server = libx.deploy { hostname = "nuc-server"; };
# Raspberry Pi's
backups-rpi4 = libx.deploy { hostname = "backups-rpi4"; system = "aarch64-linux"; };
piaware-rpi4 = libx.deploy { hostname = "piaware-rpi4"; system = "aarch64-linux"; };
bakersfield-rpi4 = libx.deploy { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; };
# quitman-rpi4 = libx.deploy { hostname = "quitman-rpi4"; system = "aarch64-linux"; };
};
imageConfigurations = {
nixos-linode-img = libx.mkMinImage { hostname = "nixos-linode-img"; format = "linode"; };
nixos-rpi4-img = libx.mkImage { hostname = "nixos-rpi4-img"; format = "sd-aarch64"; system = "aarch64-linux"; };
nixos-iso-console = libx.mkImage { hostname = "nixos-iso-console"; format = "iso"; };
nixos-iso-desktop = libx.mkImage { hostname = "nixos-iso-desktop"; format = "iso"; desktop = "plasma6"; unfree = true; };
};
# Checks for deploy-rs - Makes deploy-rs fail when system evaluations fail
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
# Devshell for bootstrapping; acessible via 'nix develop'
devShells = libx.forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./shell.nix { inherit pkgs sops-nix deploy-rs system; }
);
};
}