nixos/flake.nix

200 lines
7.2 KiB
Nix

{
description = "Malte Tammena's system configuration";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.nixpkgs-master.url = "github:NixOS/nixpkgs/master";
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware";
inputs.nixpkgs-wayland.url = "github:colemickens/nixpkgs-wayland";
inputs.home-manager.url = "github:nix-community/home-manager";
inputs.emulator-2a.url = "github:MalteT/2a-emulator/develop";
inputs.gruvbox-material-gtk = {
url = "github:sainnhe/gruvbox-material-gtk";
flake = false;
};
inputs.rip = {
url = "github:nivekuil/rip";
flake = false;
};
inputs.sway = {
url = "github:swaywm/sway";
flake = false;
};
inputs.wlroots = {
url = "github:swaywm/wlroots";
flake = false;
};
inputs.mosh = {
url = "github:mobile-shell/mosh";
flake = false;
};
inputs."2i-emulator" = {
url = "github:klemens/2i-emulator";
flake = false;
};
outputs = { self, nixpkgs, nixos-hardware, home-manager, ... }@inputs:
let
system = "x86_64-linux";
username = "malte";
emulator-2a = inputs.emulator-2a.packages."${system}"."emulator-2a";
bleeding-edge-overlay = self: super: {
bleeding = inputs.nixpkgs-master.legacyPackages.${system};
};
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-disable
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 ];
nixpkgs.overlays = [ (import ./overlays/logisim.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.nixUnstable ./system/modules/neovim.nix ];
# Basic system things
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
nixpkgs.config.allowUnfree = true;
hardware.enableAllFirmware = true;
# Make sure that I can log in
users.users.root = { openssh.authorizedKeys.keys = [ publicSshKey ]; };
# Basic packages
environment.systemPackages = with pkgs; [ ];
# 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;
};
nixosConfigurations.helix-texta = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system/helix-texta.nix
./system/light-actkbd.nix
./system/modules/restic.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;
nixpkgs.overlays = [
# Use packages from nixpkgs-wayland
inputs.nixpkgs-wayland.overlay
# Use some packages from master while unstable is lacking behind
bleeding-edge-overlay
#(import ./overlays/sway.nix)
(import ./overlays/mosh.nix)
# TODO: Remove once khal is fixed
(self: super: {
khal = super.bleeding.khal;
})
];
environment.systemPackages = [ emulator-2a ];
})
];
};
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
];
};
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;
})
];
};
installer = nixosConfigurations.installer.config.system.build.isoImage;
nixosConfigurations.installer = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-base.nix"
self.nixosModules.basics
({ pkgs, ... }: {
nixpkgs.config.allowBroken = true;
# Override kernel version for zfs
boot.kernelPackages = pkgs.linuxPackages_5_10;
isoImage.edition = "gnome";
})
];
};
};
}