nixos/flake.nix

275 lines
9.2 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
outputs = { nixpkgs, home-manager, stylix, ... }:
let
default = {
hostName = "Atlas";
user = "xenia";
system = "x86_64-linux";
group = "users";
shell = "zsh";
systemModules = [ ./system/hyprland.nix ];
serviceModules = [ ];
homeModules = [
2024-01-05 15:26:30 +00:00
./home/default.nix
./home/emacs.nix
./home/accounts/default.nix
./home/hyprland/default.nix
2023-12-15 13:13:01 +00:00
./home/nyxt/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
({ config, lib, pkgs, ... }: {
2023-10-09 14:48:40 +01:00
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
programs = {
${shell}.enable = true;
nano = {
enable = true;
syntaxHighlight = true;
nanorc = ''
set nowrap
set tabstospaces
set tabsize 2
'';
};
};
nix = {
enable = true;
settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
2023-11-14 11:43:47 +00:00
channel.enable = true;
registry = {
nixpkgs.to = {
type = "path";
path = pkgs.path;
};
};
nixPath = [ "nixpkgs=${nixpkgs}" ];
gc = {
automatic = true;
options = "--delete-older-than 7d";
};
optimise.automatic = true;
extraOptions = ''
keep-outputs = true
keep-derivations = true
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"steam"
"steam-original"
"steam-run"
"nomachine-client"
];
system = { inherit stateVersion; };
networking = {
inherit hostName;
firewall.enable = true;
};
stylix = {
autoEnable = false;
targets = {
chromium.enable = true;
console.enable = true;
lightdm.enable = true;
};
2023-12-18 08:50:43 +00:00
image = ./wallpapers/space.png;
base16Scheme =
2023-12-18 08:15:18 +00:00
"${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
polarity = "dark";
opacity = {
popups = 0.5;
terminal = 0.8;
};
fonts = rec {
sizes.terminal = 14;
emoji = {
name = "Noto Color Emoji";
package = pkgs.noto-fonts-emoji;
};
monospace = {
name = "JetBrainsMono Nerd Font";
package = (pkgs.nerdfonts.override {
fonts = [ "JetBrainsMono" ];
});
};
sansSerif = {
name = "Noto Sans";
package = pkgs.noto-fonts;
};
serif = sansSerif;
};
homeManagerIntegration.followSystem = true;
};
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-emoji
jetbrains-mono
(nerdfonts.override {
fonts = [ "JetBrainsMono" "NerdFontsSymbolsOnly" ];
})
emacs-all-the-icons-fonts
weather-icons
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
liberation_ttf
];
fontconfig.enable = true;
};
users.users = let
authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINI1dWlS16Keil0MGPWmMsBzx8F9ylfz+fRwxUr8/tZ/ ion"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIANfkqd5lPTsSPU3SRYnAa1UjCYDmDeBTyzq5McmWlm6 xenia@Vanguard"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ/ZSSCN5sqrA+tdoIZr5EUm5DRuBV4dQ7J+QBEtUwUU xenia@Northstar"
];
in {
2023-11-10 07:18:13 +00:00
root.openssh = { inherit authorizedKeys; };
2023-10-22 06:38:40 +01:00
${user} = {
inherit group;
isNormalUser = true;
description = "Evie Litherland-Smith";
2023-11-10 07:18:13 +00:00
extraGroups =
[ "networkmanager" "wheel" "video" "input" "uinput" ];
2023-10-22 06:38:40 +01:00
shell = pkgs.${shell};
initialHashedPassword =
"$y$j9T$tHIPQt09Kf3KH2eIRze3g/$2mwSlcq27DTGvHNPJ5EP9/1CfL3bXP0F6oS/Vuffmn3";
openssh = { inherit authorizedKeys; };
2023-10-22 06:38:40 +01:00
};
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users = {
root = {
imports = [ ./home/default.nix ];
home = {
inherit stateVersion;
username = "root";
homeDirectory = "/root";
};
programs.home-manager.enable = true;
};
${user} = let
username = user;
homeDirectory = "/home/${user}";
in {
imports =
[ ./hosts/${hostName}/home.nix ./home/default.nix ]
++ homeModules;
home = { inherit username homeDirectory stateVersion; };
programs.home-manager.enable = true;
xdg.userDirs = {
enable = true;
createDirectories = true;
extraConfig = {
XDG_PROJECTS_DIR = "${homeDirectory}/Projects";
};
};
};
};
};
})
] ++ systemModules ++ serviceModules;
};
in {
nixosConfigurations = {
## Server
Legion = let
hostName = "Legion";
2023-08-31 12:33:10 +01:00
user = "xenia";
system = "x86_64-linux";
in systemConfig {
inherit hostName user system;
systemModules = [ ./system/default.nix ./system/autoupgrade.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
./services/nextcloud.nix
./services/ntfy-sh.nix
./services/sshd.nix
./services/syncthing.nix
];
homeModules = [ ./home/default.nix ];
};
## Laptops
Northstar = let
hostName = "Northstar";
user = "xenia";
system = "x86_64-linux";
2023-12-16 22:44:24 +00:00
in systemConfig { inherit hostName user system; };
Ronin = let
hostName = "Ronin";
user = "elitherl";
system = "x86_64-linux";
2023-09-11 10:31:55 +01:00
in systemConfig { inherit hostName user system; };
## Desktops
2023-12-19 10:10:06 +00:00
Scorch = let
hostName = "Scorch";
user = "elitherl";
system = "x86_64-linux";
in systemConfig {
inherit hostName user system;
systemModules = default.systemModules ++ [ ./system/autoupgrade.nix ];
};
2023-12-19 10:10:06 +00:00
Vanguard = let
hostName = "Vanguard";
user = "xenia";
system = "x86_64-linux";
in systemConfig {
inherit hostName user system;
systemModules = default.systemModules
++ [ ./system/autoupgrade.nix ./system/steam.nix ];
homeModules = default.homeModules ++ [ ./home/games/default.nix ];
};
};
};
2023-06-21 17:41:35 +01:00
}