nixos/flake.nix

247 lines
7.6 KiB
Nix
Raw Normal View History

2023-06-21 17:41:35 +01:00
{
description = "Evie's machine configurations";
nixConfig = {
extra-substituters = ["https://nix.xenia.me.uk"];
2024-04-17 18:04:43 +01:00
extra-trusted-public-keys = ["nix.xenia.me.uk:tlgwOaG5KMLjQUk2YaErS8mAG69ZCr3PaHXZYi+Y5eI="];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-03-12 05:46:32 +00:00
iosevka-custom.url = "git+https://git.xenia.me.uk/pixelifytica/iosevka.git";
base16.url = "github:SenchoPens/base16.nix";
tt-schemes = {
url = "github:tinted-theming/schemes";
flake = false;
};
};
2023-06-21 17:41:35 +01:00
2024-01-30 14:21:50 +00:00
outputs = {
nixpkgs,
home-manager,
iosevka-custom,
base16,
tt-schemes,
2024-01-30 14:21:50 +00:00
...
}: let
systemConfig = {
hostName ? "Atlas",
user ? "pixelifytica",
system ? "x86_64-linux",
stateVersion ? "23.05",
systemModules ? [],
homeModules ? [],
2024-01-30 14:21:50 +00:00
}: let
defaultUserShell = "zsh";
specialArgs = {
inherit hostName user;
accentColour = "base07"; # catppuccin lavender
catppuccinVariant = "Mocha";
fonts = with import nixpkgs {inherit system;};
with iosevka-custom.outputs; rec {
sizes = {
2024-04-17 13:39:18 +01:00
applications = 14;
2024-04-21 13:08:25 +01:00
desktop = 12;
popups = 20;
2024-04-17 13:39:18 +01:00
terminal = 14;
};
serif = sansSerif;
sansSerif = {
name = names."iosevka-custom-aile";
package = packages.${system}."iosevka-custom-aile";
};
monospace = {
name = names."iosevka-custom-nerdfont";
package = packages.${system}."iosevka-custom-nerdfont";
};
emoji = {
name = "Noto Color Emoji";
package = noto-fonts-emoji;
};
};
};
2024-01-30 14:21:50 +00:00
in
nixpkgs.lib.nixosSystem {
inherit system specialArgs;
modules =
[
home-manager.nixosModules.home-manager
base16.nixosModule
./hosts/${hostName}/configuration.nix
./hosts/${hostName}/hardware-configuration.nix
./system/default.nix
({
config,
lib,
pkgs,
catppuccinVariant ? "Mocha",
...
}: {
scheme = "${tt-schemes}/base16/catppuccin-${lib.strings.toLower catppuccinVariant}.yaml";
2024-01-19 09:47:14 +00:00
nix = {
enable = true;
package = pkgs.nixVersions.unstable;
2024-01-19 09:47:14 +00:00
settings = {
2024-03-13 07:03:49 +00:00
cores = 0;
max-jobs = "auto";
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;
2024-02-17 08:44:26 +00:00
nixPath = ["nixpkgs=${pkgs.path}"];
registry.nixpkgs.flake = nixpkgs;
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;
networking = {inherit hostName;};
programs.${defaultUserShell}.enable = true;
system = {inherit stateVersion;};
2024-02-11 07:16:08 +00:00
users = {
defaultUserShell = pkgs.${defaultUserShell};
2024-02-11 07:16:08 +00:00
users = let
authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINI1dWlS16Keil0MGPWmMsBzx8F9ylfz+fRwxUr8/tZ/ ion"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC4M1zV3yLMMI1tYwdY9QDXJDlOBugm7UXKC+Xk89yHq pixelifytica@Vanguard"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN3fRij9Tm6davrSQOPYEZP7CdZdZ0D9ogWXWjpTs40e pixelifytica@Northstar"
2024-02-11 07:16:08 +00:00
];
in {
root.openssh = {inherit authorizedKeys;};
${user} = {
group = "users";
2024-02-11 07:16:08 +00:00
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 = {
extraSpecialArgs = {inherit (config) scheme;} // specialArgs;
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;
2024-01-30 14:21:50 +00:00
};
in {
nixosConfigurations = {
2024-01-30 14:21:50 +00:00
## Server
Legion = systemConfig {
2024-01-30 14:21:50 +00:00
hostName = "Legion";
systemModules = [
./services/caddy.nix
2024-03-31 18:06:01 +01:00
./services/forgejo.nix
./services/grafana.nix
./services/minecraft.nix
2024-04-16 06:58:21 +01:00
./services/nix-serve.nix
./services/radicale.nix
./services/sshd.nix
./services/syncthing.nix
];
2024-03-17 11:03:59 +00:00
homeModules = [./home/default.nix];
};
2024-01-30 14:21:50 +00:00
## Personal
Northstar = systemConfig {
2024-01-30 14:21:50 +00:00
hostName = "Northstar";
systemModules = [
./system/laptop.nix
./system/sway.nix
];
homeModules = [
./home/sway/default.nix
2024-04-17 09:01:59 +01:00
./home/email/work.nix
];
};
2024-03-08 07:30:18 +00:00
Vanguard = systemConfig {
2024-01-30 14:21:50 +00:00
hostName = "Vanguard";
systemModules = [
2024-04-13 07:28:53 +01:00
./system/desktop.nix
./system/games.nix
./system/sway.nix
];
homeModules = [
./home/sway/default.nix
2024-04-17 09:01:59 +01:00
./home/email/work.nix
];
2024-03-08 07:30:18 +00:00
};
2024-01-30 14:21:50 +00:00
## Work
Ronin = systemConfig {
2024-01-30 14:21:50 +00:00
hostName = "Ronin";
user = "elitherl";
systemModules = [
./system/laptop.nix
./system/sway.nix
];
homeModules = [
./home/sway/default.nix
./home/email/work.nix
];
};
2023-12-19 10:10:06 +00:00
Scorch = systemConfig {
2024-01-30 14:21:50 +00:00
hostName = "Scorch";
user = "elitherl";
systemModules = [
./system/desktop.nix
./system/sway.nix
];
homeModules = [
./home/sway/default.nix
./home/email/work.nix
];
};
};
2024-01-30 14:21:50 +00:00
};
2023-06-21 17:41:35 +01:00
}