nixos/flake.nix

317 lines
10 KiB
Nix
Raw Normal View History

2023-06-21 17:41:35 +01:00
{
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";
};
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2023-06-21 17:41:35 +01:00
2024-01-30 14:21:50 +00:00
outputs = {
nixpkgs,
home-manager,
stylix,
...
}: let
default = {
hostName = "Atlas";
user = "xenia";
system = "x86_64-linux";
group = "users";
shell = "zsh";
2024-01-30 14:21:50 +00:00
systemModules = [./system/hyprland.nix];
serviceModules = [];
homeModules = [./home/hyprland/default.nix];
stateVersion = "23.05";
};
systemConfig = {
hostName ? default.hostName,
user ? default.user,
system ? default.system,
group ? default.group,
shell ? default.shell,
systemModules ? default.systemModules,
serviceModules ? default.serviceModules,
homeModules ? default.homeModules,
stateVersion ? default.stateVersion,
}: let
specialArgs = {inherit hostName user;};
in
nixpkgs.lib.nixosSystem {
inherit system specialArgs;
modules =
[
./hosts/${hostName}/configuration.nix
./hosts/${hostName}/hardware-configuration.nix
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
2024-01-30 14:21:50 +00:00
({
config,
lib,
pkgs,
...
}: let
flakeURL = "https://git.xenia.me.uk/xenia/nixos.git?ref=main";
in {
2024-01-19 09:47:14 +00:00
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
programs = {
2024-02-11 07:18:18 +00:00
${shell}.enable = true;
2024-01-19 09:47:14 +00:00
command-not-found.enable = false;
nano = {
enable = true;
syntaxHighlight = true;
nanorc = ''
set nowrap
set tabstospaces
set tabsize 2
'';
};
2024-01-19 09:47:14 +00:00
};
nix = {
enable = true;
settings = {
2024-01-30 14:21:50 +00:00
trusted-users = ["root" user];
experimental-features = ["nix-command" "flakes"];
2024-01-19 09:47:14 +00:00
auto-optimise-store = true;
};
2024-01-19 09:47:14 +00:00
channel.enable = true;
registry = {
nixpkgs.flake = nixpkgs;
nixos = {
from = {
type = "indirect";
id = "nixos";
};
to = {
type = "git";
url = flakeURL;
};
};
2024-02-02 14:48:56 +00:00
pyenv = {
from = {
type = "indirect";
id = "pyenv";
};
to = {
type = "git";
url = "https://git.xenia.me.uk/utils/pyenv.git";
};
};
jupyter = {
from = {
type = "indirect";
id = "jupyter";
};
to = {
type = "git";
url = "https://git.xenia.me.uk/xenia/nix-jupyter.git";
};
};
};
2024-01-19 09:47:14 +00:00
gc = {
automatic = true;
options = "--delete-older-than 7d";
};
2024-01-19 09:47:14 +00:00
optimise.automatic = true;
extraOptions = ''
keep-outputs = false
keep-derivations = false
2024-01-19 09:47:14 +00:00
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
2024-02-09 14:08:42 +00:00
nixpkgs.config.allowUnfree = true;
system = {
inherit stateVersion;
autoUpgrade = {
enable = true;
flake = "git+${flakeURL}";
dates = "02:30";
};
};
2024-01-19 09:47:14 +00:00
networking = {
inherit hostName;
firewall.enable = true;
};
stylix = {
autoEnable = false;
targets = {
chromium.enable = true;
console.enable = true;
fish.enable = true;
};
image = ./wallpapers/sweet/Sweet-space.png;
base16Scheme = ./schemes/modus-vivendi-tinted.yaml;
2024-01-19 09:47:14 +00:00
polarity = "dark";
opacity = {
applications = 0.85;
desktop = 0.85;
popups = 0.85;
terminal = 0.85;
2024-01-19 09:47:14 +00:00
};
fonts = rec {
sizes = {
applications = 16;
desktop = 18;
2024-01-19 09:47:14 +00:00
popups = 18;
terminal = 16;
};
2024-01-19 09:47:14 +00:00
serif = monospace;
sansSerif = monospace;
monospace = {
name = "Iosevka Nerd Font";
package =
2024-01-30 14:21:50 +00:00
pkgs.nerdfonts.override {fonts = ["Iosevka"];};
};
2024-01-19 09:47:14 +00:00
emoji = {
name = "Noto Color Emoji";
package = pkgs.noto-fonts-emoji;
};
2023-10-22 06:38:40 +01:00
};
2024-01-19 09:47:14 +00:00
homeManagerIntegration.followSystem = true;
};
fonts = {
packages = with pkgs; [
2024-01-30 14:21:50 +00:00
(nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];})
2024-01-19 09:47:14 +00:00
emacs-all-the-icons-fonts
weather-icons
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
];
fontconfig.enable = true;
};
2024-02-11 07:16:08 +00:00
users = {
defaultUserShell = pkgs.${shell};
users = let
authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINI1dWlS16Keil0MGPWmMsBzx8F9ylfz+fRwxUr8/tZ/ ion"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDOcgeR3hh23aTiXnyC37xdP8oXfTZbbjgWzkUyxhT9P root@Vanguard"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIANfkqd5lPTsSPU3SRYnAa1UjCYDmDeBTyzq5McmWlm6 xenia@Vanguard"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ/ZSSCN5sqrA+tdoIZr5EUm5DRuBV4dQ7J+QBEtUwUU xenia@Northstar"
];
in {
root.openssh = {inherit authorizedKeys;};
${user} = {
inherit group;
isNormalUser = true;
description = "Evie Litherland-Smith";
extraGroups = ["networkmanager" "wheel" "video" "input" "uinput"];
initialHashedPassword = "$y$j9T$tHIPQt09Kf3KH2eIRze3g/$2mwSlcq27DTGvHNPJ5EP9/1CfL3bXP0F6oS/Vuffmn3";
openssh = {inherit authorizedKeys;};
};
};
2024-01-19 09:47:14 +00:00
};
home-manager = {
2024-01-30 14:21:50 +00:00
extraSpecialArgs = {inherit hostName;};
2024-01-19 09:47:14 +00:00
useGlobalPkgs = true;
useUserPackages = true;
users = {
root = {
2024-01-30 14:21:50 +00:00
imports = [./home/default.nix];
2024-01-19 09:47:14 +00:00
home = {
inherit stateVersion;
username = "root";
homeDirectory = "/root";
};
2024-01-19 09:47:14 +00:00
programs.home-manager.enable = true;
};
${user} = let
username = user;
homeDirectory = "/home/${user}";
in {
imports =
2024-01-30 14:21:50 +00:00
[./hosts/${hostName}/home.nix ./home/default.nix]
2024-01-19 09:47:14 +00:00
++ homeModules;
2024-01-30 14:21:50 +00:00
home = {inherit username homeDirectory stateVersion;};
2024-01-19 09:47:14 +00:00
programs.home-manager.enable = true;
xdg.userDirs = {
enable = true;
createDirectories = true;
extraConfig = {
XDG_PROJECTS_DIR = "${homeDirectory}/Projects";
};
};
};
};
2024-01-19 09:47:14 +00:00
};
})
2024-01-30 14:21:50 +00:00
]
++ systemModules
++ serviceModules;
};
in {
nixosConfigurations = {
## Server
2024-01-30 14:21:50 +00:00
Legion = let
hostName = "Legion";
user = "xenia";
system = "x86_64-linux";
in
systemConfig {
inherit hostName user system;
2024-01-30 14:21:50 +00:00
systemModules = [./system/default.nix];
serviceModules = [
./services/adguardhome.nix
2023-11-23 08:40:32 +00:00
./services/caddy.nix
./services/gitea.nix
2023-11-23 08:40:32 +00:00
./services/grafana.nix
2024-02-09 14:08:42 +00:00
./services/minecraft.nix
./services/ntfy-sh.nix
./services/sshd.nix
./services/syncthing.nix
];
2024-01-30 14:21:50 +00:00
homeModules = [./home/default.nix];
};
2024-01-30 14:21:50 +00:00
## Personal
2024-01-30 14:21:50 +00:00
Northstar = let
hostName = "Northstar";
user = "xenia";
system = "x86_64-linux";
in
systemConfig {
inherit hostName user system;
2024-01-30 14:21:50 +00:00
systemModules = default.systemModules ++ [./system/games.nix];
};
2024-01-30 14:21:50 +00:00
Vanguard = let
hostName = "Vanguard";
user = "xenia";
system = "x86_64-linux";
in
systemConfig {
inherit hostName user system;
2024-01-30 14:21:50 +00:00
systemModules = default.systemModules ++ [./system/games.nix];
};
2024-01-30 14:21:50 +00:00
## Work
2024-01-30 14:21:50 +00:00
Ronin = let
hostName = "Ronin";
user = "elitherl";
system = "x86_64-linux";
in
systemConfig {inherit hostName user system;};
2023-12-19 10:10:06 +00:00
2024-01-30 14:21:50 +00:00
Scorch = let
hostName = "Scorch";
user = "elitherl";
system = "x86_64-linux";
in
systemConfig {inherit hostName user system;};
};
2024-01-30 14:21:50 +00:00
};
2023-06-21 17:41:35 +01:00
}