nixos/flake.nix

251 lines
9 KiB
Nix

{
description = "Malte Tammena's system configuration";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
home-manager.url = "github:nix-community/home-manager";
emulator-2a.url = "github:MalteT/2a-emulator/develop";
mensa.url = "github:MalteT/mensa/main";
custom-udev-rules.url = "github:MalteT/custom-udev-rules";
fenix.url = "github:nix-community/fenix";
gruvbox-material-gtk = {
url = "github:sainnhe/gruvbox-material-gtk";
flake = false;
};
rip = {
url = "github:nivekuil/rip";
flake = false;
};
sway = {
url = "github:swaywm/sway";
flake = false;
};
wlroots = {
url = "github:swaywm/wlroots";
flake = false;
};
mosh = {
url = "github:mobile-shell/mosh";
flake = false;
};
"2i-emulator" = {
url = "github:klemens/2i-emulator";
flake = false;
};
"cataclysm-dda" = {
url = "github:CleverRaven/Cataclysm-DDA";
flake = false;
};
"fend" = { url = "github:MalteT/fend/flake"; };
};
outputs = { self, nixpkgs, nixos-hardware, home-manager, ... }@inputs:
let
system = "x86_64-linux";
username = "malte";
publicSshKey =
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDXnYMJtwgvSNpjysKzvRCjzyyQRB4yDtzynD7c5ALDZfRHvrgGQS11vk96ExClo66ll3vrFci5mBmGJf4/+yPBb3qiiovEHobjh5nIDHXYTg7tJDHivKIMQ3w8DmZwBKSLFlsH/UZe8NJVGrGRHGofWnTY/yw/FdbAkaKqvF/V+WGP7kR+dQ1pIqXXpP3phAu0WfO+E2838XxHAxLtm35GkE40GCX9dhXmjurxCeTSaJE6OYQ4/+z73fOZc1ebV/Ze6UZsGhOtzJPBIH19Ft0v9x86KoZabqgK3KDSHn9QKcM+Mm7o3tOthfQPlg1tCoxGueDJFI/0+AyjwBmQ1CUvNXpfmL4NE+6GRwRfZNsWoW0nPmC1B/c3rWk+JXYsxGQhvVeDk+1HXCFKghdPTSgpESua03A4UqLNadERYC9s2Q5TzSYQsV/8fpg4gCxlVRl/g1aUvbaCL09jmUkDJ4i36X+g8rvux5Q2CTpskLuhHeFVcC4/c1XXF+cJTwl1GjppEL0JFKgcjIwlyE8neR4PVlOq3UQqZdZEvzZigaLxtpwZMKNGhdIqS2/qqo/LlJ66/Y7TohimhsCRyHHqbf85Cha1z0Ct+9GtTdn9hpeC6Sb2Et+iN4gxdm+SWqPybZipeBL7b+ir5Ssxq1vIf/sbqKh7Kz699dwKSeRaAmJiew== openpgp:0xC43C0C72";
in rec {
nixosModules.helix-texta-hardware = { pkgs, config, lib, ... }: {
imports = [
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-gpu-nvidia
nixos-hardware.nixosModules.common-pc-laptop
nixos-hardware.nixosModules.common-pc-laptop-ssd
nixos-hardware.nixosModules.common-pc-laptop-acpi_call
./system/helix-texta-hardware.nix
];
};
homeManagerConfigurations."${username}" =
home-manager.lib.homeManagerConfiguration {
inherit system username;
configuration = ./malte/home.nix;
homeDirectory = "/home/${username}";
};
nixosModules.home-manager = { pkgs, ... }: {
home-manager.verbose = true;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."${username}".imports = [ ./malte/home.nix ];
};
# Necessary for flakes to work
nixosModules.nixUnstable = { pkgs, ... }: {
nix.registry.nixpkgs.flake = nixpkgs;
nix.package = pkgs.nixUnstable;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
};
# Some basics that every machine should have
nixosModules.basics = { pkgs, ... }: {
imports = [
#self.nixosModules.udevRule
inputs.custom-udev-rules.nixosModule
self.nixosModules.nixUnstable
./system/modules/neovim.nix
];
# Basic system things
system.configurationRevision = pkgs.lib.mkIf (self ? rev) self.rev;
nixpkgs.config.allowUnfree = true;
hardware.enableAllFirmware = true;
hardware.enableRedistributableFirmware = true;
# Make sure that I can log in
users.users.root = { openssh.authorizedKeys.keys = [ publicSshKey ]; };
# Basic packages
environment.systemPackages = with pkgs; [ mosh git ];
# Enable mosh for some SSH superpower
programs.mosh.enable = pkgs.lib.mkDefault true;
services.openssh.enable = pkgs.lib.mkDefault true;
# My timezone
time.timeZone = "Europe/Berlin";
# Some boot defaults
boot.kernelPackages = pkgs.lib.mkDefault pkgs.linuxPackages_latest;
boot.loader.timeout = pkgs.lib.mkDefault 1;
boot.loader.systemd-boot.configurationLimit = 100;
# Add some useful overlays
nixpkgs.overlays = [
(self: super: {
# Add a meta package containing packages from master
bleeding = inputs.nixpkgs-master.legacyPackages.${system};
# Add FiraCode as a package, but use NerdFonts
firaCodeNerd = super.nerdfonts.override { fonts = [ "FiraCode" ]; };
# TODO: Remove once khal is fixed
khal = super.bleeding.khal;
# Add the emulator
"2a-emulator" =
inputs.emulator-2a.packages."${system}"."2a-emulator";
# Add my mensa tool
mensa = inputs.mensa.packages."${system}".mensa;
fend = inputs.fend.packages."${system}".fend;
})
# Some program adjustments
#(import ./overlays/mosh.nix)
(import ./overlays/logisim.nix)
(import ./overlays/cataclysm-dda.nix)
];
};
# My thinkpad P1
nixosConfigurations.helix-texta = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system/helix-texta.nix
./system/light-actkbd.nix
self.nixosModules.helix-texta-hardware
home-manager.nixosModules.home-manager
self.nixosModules.home-manager
self.nixosModules.basics
({ pkgs, ... }: {
nix = {
# add binary caches
binaryCachePublicKeys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
# ...
];
binaryCaches = [
"https://cache.nixos.org"
"https://nixpkgs-wayland.cachix.org"
# ...
];
};
# Overwrite basics
services.openssh.enable = false;
programs.mosh.enable = false;
boot.kernelPackages = pkgs.linuxPackages_latest;
nixpkgs.overlays = [
# Use packages from nixpkgs-wayland
inputs.nixpkgs-wayland.overlay
inputs.fenix.overlay
];
})
];
};
# Currently hosted by NetCup
nixosConfigurations.achatina-fulica = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.basics
./system/achatina-fulica.nix
./system/achatina-fulica-hardware.nix
./system/modules/nginx-reverse-proxy.nix
./system/modules/radicale.nix
];
};
# Server @home
nixosConfigurations.elysia-clarki = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.basics
./system/elysia-clarki.nix
./system/elysia-clarki-hardware.nix
({ pkgs, ... }: {
# Override kernel version for zfs
boot.kernelPackages = pkgs.linuxPackages_5_10;
})
];
};
# Experiments with iso generation
nixosConfigurations.installer = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-base.nix"
home-manager.nixosModules.home-manager
self.nixosModules.home-manager
self.nixosModules.basics
({ pkgs, ... }: {
#nixpkgs.config.allowBroken = true;
# Override kernel version for zfs
boot.kernelPackages = pkgs.linuxPackages_5_10;
users.users.malte = {
description = "Malte Tammena";
isNormalUser = true;
extraGroups =
[ "wheel" "networkmanager" "video" "lp" "kvm" "libvirtd" ];
# Yes, use the best, please
shell = pkgs.fish;
};
services.xserver = {
enable = true;
desktopManager = { xterm.enable = false; };
displayManager = { defaultSession = "none+i3"; };
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu # application launcher most people use
i3status # gives you the default i3 status bar
i3lock # default i3 screen locker
i3blocks # if you are planning on using i3blocks over i3status
];
};
};
})
];
};
installer = nixosConfigurations.installer.config.system.build.isoImage;
};
}