try to configure using nixosModules

doesn't seem like there's that much benefit?
This commit is contained in:
Noah Masur 2023-07-10 17:56:15 -06:00
parent 9b3d2e39c9
commit b0b9827a2e
8 changed files with 128 additions and 135 deletions

View File

@ -110,10 +110,20 @@
}; };
outputs = { nixpkgs, ... }@inputs: outputs = { self, nixpkgs, ... }@inputs:
let let
# Common overlays to always use
overlays = [
inputs.nur.overlay
inputs.nix2vim.overlay
(import ./overlays/neovim-plugins.nix inputs)
(import ./overlays/calibre-web.nix)
(import ./overlays/disko.nix inputs)
(import ./overlays/tree-sitter.nix inputs)
];
# Global configuration for my systems # Global configuration for my systems
globals = let baseName = "masu.rs"; globals = let baseName = "masu.rs";
in rec { in rec {
@ -125,6 +135,7 @@
mail.imapHost = "imap.purelymail.com"; mail.imapHost = "imap.purelymail.com";
mail.smtpHost = "smtp.purelymail.com"; mail.smtpHost = "smtp.purelymail.com";
dotfilesRepo = "git@github.com:nmasur/dotfiles"; dotfilesRepo = "git@github.com:nmasur/dotfiles";
nixpkgs.overlays = overlays;
hostnames = { hostnames = {
git = "git.${baseName}"; git = "git.${baseName}";
metrics = "metrics.${baseName}"; metrics = "metrics.${baseName}";
@ -137,16 +148,6 @@
}; };
}; };
# Common overlays to always use
overlays = [
inputs.nur.overlay
inputs.nix2vim.overlay
(import ./overlays/neovim-plugins.nix inputs)
(import ./overlays/calibre-web.nix)
(import ./overlays/disko.nix inputs)
(import ./overlays/tree-sitter.nix inputs)
];
# System types to support. # System types to support.
supportedSystems = supportedSystems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
@ -156,20 +157,26 @@
in rec { in rec {
nixosModules = {
globals = { config }: { config = globals; };
common = import ./modules/common;
nixos = import ./modules/nixos;
darwin = import ./modules/darwin;
};
# Contains my full system builds, including home-manager # Contains my full system builds, including home-manager
# nixos-rebuild switch --flake .#tempest # nixos-rebuild switch --flake .#tempest
nixosConfigurations = { nixosConfigurations = {
tempest = import ./hosts/tempest { inherit inputs globals overlays; }; tempest = import ./hosts/tempest { inherit self; };
hydra = import ./hosts/hydra { inherit inputs globals overlays; }; hydra = import ./hosts/hydra { inherit self; };
flame = import ./hosts/flame { inherit inputs globals overlays; }; flame = import ./hosts/flame { inherit self; };
swan = import ./hosts/swan { inherit inputs globals overlays; }; swan = import ./hosts/swan { inherit self; };
}; };
# Contains my full Mac system builds, including home-manager # Contains my full Mac system builds, including home-manager
# darwin-rebuild switch --flake .#lookingglass # darwin-rebuild switch --flake .#lookingglass
darwinConfigurations = { darwinConfigurations = {
lookingglass = lookingglass = import ./hosts/lookingglass { inherit self; };
import ./hosts/lookingglass { inherit inputs globals overlays; };
}; };
# For quickly applying home-manager settings with: # For quickly applying home-manager settings with:
@ -185,10 +192,8 @@
diskoConfigurations = { root = import ./disks/root.nix; }; diskoConfigurations = { root = import ./disks/root.nix; };
packages = let packages = let
aws = system: aws = system: import ./hosts/aws { inherit self system; };
import ./hosts/aws { inherit inputs globals overlays system; }; staff = system: import ./hosts/staff { inherit self system; };
staff = system:
import ./hosts/staff { inherit inputs globals overlays system; };
neovim = system: neovim = system:
let pkgs = import nixpkgs { inherit system overlays; }; let pkgs = import nixpkgs { inherit system overlays; };
in import ./modules/common/neovim/package { in import ./modules/common/neovim/package {

View File

@ -1,17 +1,14 @@
{ inputs, system, globals, overlays, ... }: { self, system, ... }:
inputs.nixos-generators.nixosGenerate { self.inputs.nixos-generators.nixosGenerate {
inherit system; inherit system;
format = "amazon"; format = "amazon";
modules = [ modules = [
inputs.home-manager.nixosModules.home-manager self.inputs.home-manager.nixosModules.home-manager
self.nixosModules.globals
self.nixosModules.common
self.nixosModules.nixos
{ {
nixpkgs.overlays = overlays;
user = globals.user;
fullName = globals.fullName;
dotfilesRepo = globals.dotfilesRepo;
gitName = globals.gitName;
gitEmail = globals.gitEmail;
networking.hostName = "sheep"; networking.hostName = "sheep";
gui.enable = false; gui.enable = false;
theme.colors = (import ../../colorscheme/gruvbox).dark; theme.colors = (import ../../colorscheme/gruvbox).dark;
@ -21,9 +18,6 @@ inputs.nixos-generators.nixosGenerate {
# AWS settings require this # AWS settings require this
permitRootLogin = "prohibit-password"; permitRootLogin = "prohibit-password";
} }
../../modules/common
../../modules/nixos
../../modules/nixos/services/sshd.nix
] ++ [ ] ++ [
# Required to fix diskSize errors during build # Required to fix diskSize errors during build
({ ... }: { amazonImage.sizeMB = 16 * 1024; }) ({ ... }: { amazonImage.sizeMB = 16 * 1024; })

View File

@ -4,24 +4,23 @@
# How to install: # How to install:
# https://blog.korfuri.fr/posts/2022/08/nixos-on-an-oracle-free-tier-ampere-machine/ # https://blog.korfuri.fr/posts/2022/08/nixos-on-an-oracle-free-tier-ampere-machine/
{ inputs, globals, overlays, ... }: { self, ... }:
inputs.nixpkgs.lib.nixosSystem { self.inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux"; system = "aarch64-linux";
specialArgs = { }; specialArgs = { };
modules = [ modules = [
globals self.inputs.home-manager.nixosModules.home-manager
inputs.home-manager.nixosModules.home-manager self.nixosModules.globals
../../modules/common self.nixosModules.common
../../modules/nixos self.nixosModules.nixos
{ {
nixpkgs.overlays = overlays;
# Hardware # Hardware
server = true; server = true;
networking.hostName = "flame"; networking.hostName = "flame";
imports = [ (inputs.nixpkgs + "/nixos/modules/profiles/qemu-guest.nix") ]; imports =
[ (self.inputs.nixpkgs + "/nixos/modules/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" ];
fileSystems."/" = { fileSystems."/" = {
@ -71,9 +70,6 @@ inputs.nixpkgs.lib.nixosSystem {
accessKeyId = "0026b0e73b2e2c80000000005"; accessKeyId = "0026b0e73b2e2c80000000005";
}; };
# # Grant access to Jellyfin directories from Nextcloud
# users.users.nextcloud.extraGroups = [ "jellyfin" ];
# # Wireguard config for Transmission # # Wireguard config for Transmission
# wireguard.enable = true; # wireguard.enable = true;
# networking.wireguard.interfaces.wg0 = { # networking.wireguard.interfaces.wg0 = {

View File

@ -1,21 +1,20 @@
# The Hydra # The Hydra
# System configuration for WSL # System configuration for WSL
{ inputs, globals, overlays, ... }: { self, ... }:
inputs.nixpkgs.lib.nixosSystem { self.inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { }; specialArgs = { };
modules = [ modules = [
../../modules/common self.inputs.wsl.nixosModules.wsl
../../modules/nixos self.inputs.home-manager.nixosModules.home-manager
../../modules/wsl self.nixosModules.globals
globals self.nixosModules.common
inputs.wsl.nixosModules.wsl self.nixosModules.nixos
inputs.home-manager.nixosModules.home-manager self.nixosModules.wsl
{ {
networking.hostName = "hydra"; networking.hostName = "hydra";
nixpkgs.overlays = overlays;
identityFile = "/home/${globals.user}/.ssh/id_ed25519"; identityFile = "/home/${globals.user}/.ssh/id_ed25519";
gui.enable = false; gui.enable = false;
theme = { theme = {

View File

@ -1,24 +1,23 @@
# The Looking Glass # The Looking Glass
# System configuration for my work Macbook # System configuration for my work Macbook
{ inputs, globals, overlays, ... }: { self, ... }:
inputs.darwin.lib.darwinSystem { self.inputs.darwin.lib.darwinSystem {
system = "x86_64-darwin"; system = "x86_64-darwin";
specialArgs = { }; specialArgs = { };
modules = [ modules = [
../../modules/common self.inputs.home-manager.darwinModules.home-manager
../../modules/darwin self.nixosModules.common
(globals // rec { self.nixosModules.darwin
user = "Noah.Masur"; ({ config, lib, ... }: {
gitName = "Noah-Masur_1701"; config = rec {
gitEmail = "${user}@take2games.com"; user = lib.mkForce "Noah.Masur";
}) gitName = lib.mkForce "Noah-Masur_1701";
inputs.home-manager.darwinModules.home-manager gitEmail = lib.mkForce "${user}@take2games.com";
{ nixpkgs.overlays = [ self.inputs.firefox-darwin.overlay ];
nixpkgs.overlays = [ inputs.firefox-darwin.overlay ] ++ overlays;
networking.hostName = "lookingglass"; networking.hostName = "lookingglass";
identityFile = "/Users/Noah.Masur/.ssh/id_ed25519"; identityFile = "/Users/${user}/.ssh/id_ed25519";
gui.enable = true; gui.enable = true;
theme = { theme = {
colors = (import ../../colorscheme/gruvbox-dark).dark; colors = (import ../../colorscheme/gruvbox-dark).dark;
@ -41,6 +40,7 @@ inputs.darwin.lib.darwinSystem {
kubernetes.enable = true; kubernetes.enable = true;
_1password.enable = true; _1password.enable = true;
slack.enable = true; slack.enable = true;
} };
})
]; ];
} }

View File

@ -1,13 +1,16 @@
# The Staff # The Staff
# ISO configuration for my USB drive # ISO configuration for my USB drive
{ inputs, system, overlays, ... }: { self, system, ... }:
inputs.nixos-generators.nixosGenerate { self.inputs.nixos-generators.nixosGenerate {
inherit system; inherit system;
format = "install-iso"; format = "install-iso";
modules = [{ modules = [
nixpkgs.overlays = overlays; self.nixosModules.global
self.nixosModules.common
self.nixosModules.nixos
({ config, pkgs, ... }: {
networking.hostName = "staff"; networking.hostName = "staff";
users.extraUsers.root.openssh.authorizedKeys.keys = [ users.extraUsers.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s"
@ -23,9 +26,7 @@ inputs.nixos-generators.nixosGenerate {
PermitRootLogin = "yes"; PermitRootLogin = "yes";
}; };
}; };
environment.systemPackages = environment.systemPackages = with pkgs; [
let pkgs = import inputs.nixpkgs { inherit system overlays; };
in with pkgs; [
git git
vim vim
wget wget
@ -39,5 +40,6 @@ inputs.nixos-generators.nixosGenerate {
experimental-features = nix-command flakes experimental-features = nix-command flakes
warn-dirty = false warn-dirty = false
''; '';
}]; })
];
} }

View File

@ -1,17 +1,17 @@
# The Swan # The Swan
# System configuration for my home NAS server # System configuration for my home NAS server
{ inputs, globals, overlays, ... }: { self, ... }:
inputs.nixpkgs.lib.nixosSystem { self.inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { }; specialArgs = { };
modules = [ modules = [
globals self.inputs.home-manager.nixosModules.home-manager
inputs.home-manager.nixosModules.home-manager self.inputs.disko.nixosModules.disko
inputs.disko.nixosModules.disko self.nixosModules.globals
../../modules/common self.nixosModules.common
../../modules/nixos self.nixosModules.nixos
{ {
# Hardware # Hardware
server = true; server = true;
@ -46,7 +46,6 @@ inputs.nixpkgs.lib.nixosSystem {
gui.enable = false; gui.enable = false;
theme = { colors = (import ../../colorscheme/gruvbox).dark; }; theme = { colors = (import ../../colorscheme/gruvbox).dark; };
nixpkgs.overlays = overlays;
neovim.enable = true; neovim.enable = true;
cloudflare.enable = true; cloudflare.enable = true;
dotfiles.enable = true; dotfiles.enable = true;

View File

@ -1,18 +1,16 @@
# The Tempest # The Tempest
# System configuration for my desktop # System configuration for my desktop
{ inputs, globals, overlays, ... }: { self, ... }:
inputs.nixpkgs.lib.nixosSystem { self.inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
globals self.inputs.home-manager.nixosModules.home-manager
inputs.home-manager.nixosModules.home-manager self.nixosModules.globals
../../modules/common self.nixosModules.common
../../modules/nixos self.nixosModules.nixos
{ {
nixpkgs.overlays = overlays;
# Hardware # Hardware
physical = true; physical = true;
networking.hostName = "tempest"; networking.hostName = "tempest";
@ -53,7 +51,7 @@ inputs.nixpkgs.lib.nixosSystem {
# Must be prepared ahead # Must be prepared ahead
identityFile = "/home/${globals.user}/.ssh/id_ed25519"; identityFile = "/home/${globals.user}/.ssh/id_ed25519";
passwordHash = inputs.nixpkgs.lib.fileContents ../../password.sha512; passwordHash = self.inputs.nixpkgs.lib.fileContents ../../password.sha512;
# Theming # Theming
gui.enable = true; gui.enable = true;
@ -61,8 +59,8 @@ inputs.nixpkgs.lib.nixosSystem {
colors = (import ../../colorscheme/gruvbox-dark).dark; colors = (import ../../colorscheme/gruvbox-dark).dark;
dark = true; dark = true;
}; };
wallpaper = "${inputs.wallpapers}/gruvbox/road.jpg"; wallpaper = "${self.inputs.wallpapers}/gruvbox/road.jpg";
gtk.theme.name = inputs.nixpkgs.lib.mkDefault "Adwaita-dark"; gtk.theme.name = self.inputs.nixpkgs.lib.mkDefault "Adwaita-dark";
# Programs and services # Programs and services
charm.enable = true; charm.enable = true;