convert to proper module layout

This commit is contained in:
Noah Masur
2022-12-21 14:18:03 -07:00
parent bf1d2f1e9e
commit d040077d3a
95 changed files with 1196 additions and 895 deletions

View File

@ -1,107 +0,0 @@
{ config, lib, pkgs, ... }: {
imports =
[ ../modules/shell ../modules/neovim ../modules/repositories/dotfiles.nix ];
options = {
user = lib.mkOption {
type = lib.types.str;
description = "Primary user of the system";
};
fullName = lib.mkOption {
type = lib.types.str;
description = "Human readable name of the user";
};
userDirs = {
# Required to prevent infinite recursion when referenced by himalaya
download = lib.mkOption {
type = lib.types.str;
description = "XDG directory for downloads";
default =
if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
};
};
identityFile = lib.mkOption {
type = lib.types.str;
description = "Path to existing private key file.";
default = "/etc/ssh/ssh_host_ed25519_key";
};
gui = {
enable = lib.mkEnableOption {
description = "Enable graphics.";
default = false;
};
};
theme = {
colors = lib.mkOption {
type = lib.types.attrs;
description = "Base16 color scheme.";
default = (import ../modules/colorscheme/gruvbox).dark;
};
dark = lib.mkOption {
type = lib.types.bool;
description = "Enable dark mode.";
default = true;
};
};
# colorscheme = lib.mkOption {
# type = types.attrs;
# description = "Base16 color scheme";
# };
homePath = lib.mkOption {
type = lib.types.path;
description = "Path of user's home directory.";
default = builtins.toPath (if pkgs.stdenv.isDarwin then
"/Users/${config.user}"
else
"/home/${config.user}");
};
dotfilesPath = lib.mkOption {
type = lib.types.path;
description = "Path of dotfiles repository.";
default = config.homePath + "/dev/personal/dotfiles";
};
dotfilesRepo = lib.mkOption {
type = lib.types.str;
description = "Link to dotfiles repository.";
};
unfreePackages = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "List of unfree packages to allow.";
default = [ ];
};
};
config = let stateVersion = "23.05";
in {
# Enable features in Nix commands
nix.extraOptions = ''
experimental-features = nix-command flakes
warn-dirty = false
'';
# Basic common system packages for all devices
environment.systemPackages = with pkgs; [ git vim wget curl ];
# Use the system-level nixpkgs instead of Home Manager's
home-manager.useGlobalPkgs = true;
# Install packages to /etc/profiles instead of ~/.nix-profile, useful when
# using multiple profiles for one user
home-manager.useUserPackages = true;
# Allow specified unfree packages (identified elsewhere)
# Retrieves package object based on string name
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) config.unfreePackages;
# Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion;
home-manager.users.root.home.stateVersion = stateVersion;
};
}

View File

@ -10,6 +10,7 @@ nixpkgs.lib.nixosSystem {
globals
home-manager.nixosModules.home-manager
{
physical = true;
networking.hostName = "desktop";
nixpkgs.overlays = [ nur.overlay ];
# Set registry to flake packages, used for nix X commands
@ -17,32 +18,32 @@ nixpkgs.lib.nixosSystem {
identityFile = "/home/${globals.user}/.ssh/id_ed25519";
gui.enable = true;
theme = {
colors = (import ../../modules/colorscheme/gruvbox).dark;
colors = (import ../../colorscheme/gruvbox).dark;
dark = true;
};
wallpaper = "${wallpapers}/gruvbox/road.jpg";
gtk.theme.name = nixpkgs.lib.mkDefault "Adwaita-dark";
passwordHash = nixpkgs.lib.fileContents ../../private/password.sha512;
media.enable = true;
firefox.enable = true;
kitty.enable = true;
"1password".enable = true;
discord.enable = true;
nautilus.enable = true;
obsidian.enable = true;
mail.aerc.enable = true;
mail.himalaya.enable = true;
gaming.enable = true;
gaming.steam.enable = true;
gaming.legendary.enable = true;
keybase.enable = true;
mullvad.enable = true;
nixlang.enable = true;
dotfiles.enable = true;
}
./hardware-configuration.nix
../common.nix
../../modules/hardware
../../modules/nixos
../../modules/graphical
../../modules/applications/media.nix
../../modules/applications/firefox.nix
../../modules/applications/kitty.nix
../../modules/applications/1password.nix
../../modules/applications/discord.nix
../../modules/applications/nautilus.nix
../../modules/applications/obsidian.nix
../../modules/mail
../../modules/gaming/steam.nix
../../modules/gaming/legendary.nix
../../modules/repositories/notes.nix
../../modules/services/keybase.nix
../../modules/services/mullvad.nix
../../modules/programming/nix.nix
../../modules
];
}

View File

@ -7,6 +7,7 @@ darwin.lib.darwinSystem {
system = "x86_64-darwin";
specialArgs = { };
modules = [
../../modules
(globals // {
user = "Noah.Masur";
gitName = "Noah-Masur_1701";
@ -14,30 +15,30 @@ darwin.lib.darwinSystem {
})
home-manager.darwinModules.home-manager
{
networking.hostName = "noah-masur-mac";
identityFile = "/Users/Noah.Masur/.ssh/id_ed25519";
gui.enable = true;
theme = {
colors = (import ../../modules/colorscheme/gruvbox).dark;
colors = (import ../../colorscheme/gruvbox).dark;
dark = true;
};
mailUser = globals.user;
networking.hostName = "noah-masur-mac";
mail.user = globals.user;
nixpkgs.overlays = [ firefox-darwin.overlay ] ++ overlays;
# Set registry to flake packages, used for nix X commands
nix.registry.nixpkgs.flake = nixpkgs;
mail.aerc.enable = true;
mail.himalaya.enable = true;
kitty.enable = true;
discord.enable = true;
firefox.enable = true;
dotfiles.enable = true;
nixlang.enable = true;
terraform.enable = true;
python.enable = true;
lua.enable = true;
kubernetes.enable = true;
"1password".enable = true;
}
../common.nix
../../modules/darwin
../../modules/mail
../../modules/applications/alacritty.nix
../../modules/applications/kitty.nix
../../modules/applications/discord.nix
../../modules/applications/firefox.nix
../../modules/repositories/notes.nix
../../modules/programming/nix.nix
../../modules/programming/terraform.nix
../../modules/programming/python.nix
../../modules/programming/lua.nix
../../modules/programming/kubernetes.nix
];
}

View File

@ -11,11 +11,14 @@ nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { };
modules = [
(removeAttrs globals [ "mailServer" ])
./hardware-configuration.nix
../../modules
(removeAttrs globals [ "mail.server" ])
home-manager.nixosModules.home-manager
{
server = true;
gui.enable = false;
theme = { colors = (import ../../modules/colorscheme/gruvbox).dark; };
theme = { colors = (import ../../colorscheme/gruvbox).dark; };
nixpkgs.overlays = overlays;
# FQDNs for various services
@ -33,7 +36,7 @@ nixpkgs.lib.nixosSystem {
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
# Nextcloud backup config
backupS3 = {
backup.s3 = {
endpoint = "s3.us-west-002.backblazeb2.com";
bucket = "noahmasur-backup";
accessKeyId = "0026b0e73b2e2c80000000005";
@ -72,20 +75,16 @@ nixpkgs.lib.nixosSystem {
# Grant access to Transmission directories from Jellyfin
users.users.jellyfin.extraGroups = [ "transmission" ];
# Proxy traffic with Cloudflare
cloudflare.enable = true;
# Setup Minecraft server
gaming.minecraft-server.enable = true;
# Clone dotfiles
dotfiles.enable = true;
}
./hardware-configuration.nix
../common.nix
../../modules/nixos
../../modules/hardware/server.nix
../../modules/services/sshd.nix
../../modules/services/calibre.nix
../../modules/services/jellyfin.nix
../../modules/services/nextcloud.nix
../../modules/services/cloudflare.nix
../../modules/services/transmission.nix
../../modules/services/prometheus.nix
../../modules/services/vaultwarden.nix
../../modules/services/gitea.nix
../../modules/gaming/minecraft-server.nix
];
}

View File

@ -10,6 +10,7 @@ nixpkgs.lib.nixosSystem {
globals
wsl.nixosModules.wsl
home-manager.nixosModules.home-manager
../../modules
{
networking.hostName = "wsl";
# Set registry to flake packages, used for nix X commands
@ -17,7 +18,7 @@ nixpkgs.lib.nixosSystem {
identityFile = "/home/${globals.user}/.ssh/id_ed25519";
gui.enable = false;
theme = {
colors = (import ../../modules/colorscheme/gruvbox).dark;
colors = (import ../../colorscheme/gruvbox).dark;
dark = true;
};
passwordHash = nixpkgs.lib.fileContents ../../private/password.sha512;
@ -30,13 +31,12 @@ nixpkgs.lib.nixosSystem {
interop.includePath =
false; # Including Windows PATH will slow down Neovim command mode
};
mail.aerc.enable = true;
mail.himalaya.enable = true;
dotfiles.enable = true;
nixlang.enable = true;
lua.enable = true;
}
../common.nix
../../modules/wsl
../../modules/nixos
../../modules/mail
../../modules/repositories/notes.nix
../../modules/programming/nix.nix
../../modules/programming/lua.nix
];
}