nixos/flake.nix

222 lines
8.2 KiB
Nix
Raw Normal View History

2021-05-19 23:08:18 +02:00
{
description = "Malte Tammena's system configuration";
2021-10-13 17:38:24 +02:00
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
2021-11-23 12:54:30 +01:00
"nixpkgs-21.05".url = "github:NixOS/nixpkgs/nixos-21.05";
2021-10-13 17:38:24 +02:00
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";
2021-10-13 22:57:04 +02:00
mensa.url = "github:MalteT/mensa/main";
2021-10-13 17:38:24 +02:00
custom-udev-rules.url = "github:MalteT/custom-udev-rules";
fenix.url = "github:nix-community/fenix";
2021-12-04 12:47:59 +01:00
sops-nix.url = "github:Mic92/sops-nix";
2021-10-13 17:38:24 +02:00
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;
};
2021-10-31 10:59:39 +01:00
"fend" = { url = "github:MalteT/fend/flake"; };
2021-07-21 09:10:17 +02:00
};
2021-05-19 23:08:18 +02:00
2021-05-27 23:08:25 +02:00
outputs = { self, nixpkgs, nixos-hardware, home-manager, ... }@inputs:
2021-05-19 23:08:18 +02:00
let
2021-06-15 18:56:08 +02:00
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";
2021-06-15 18:15:54 +02:00
2021-05-19 23:08:18 +02:00
in rec {
2021-11-06 09:27:57 +01:00
nixosModules.thinkpad-p1-gen3 = { pkgs, config, lib, ... }: {
2021-05-19 23:08:18 +02:00
imports = [
nixos-hardware.nixosModules.common-cpu-intel
2021-07-21 09:11:00 +02:00
nixos-hardware.nixosModules.common-gpu-nvidia
2021-05-19 23:08:18 +02:00
nixos-hardware.nixosModules.common-pc-laptop
nixos-hardware.nixosModules.common-pc-laptop-ssd
nixos-hardware.nixosModules.common-pc-laptop-acpi_call
2021-11-06 09:27:57 +01:00
./hardware/thinkpad-p1-gen3.nix
2021-05-19 23:08:18 +02:00
];
};
2021-11-06 09:27:57 +01:00
homeManagerConfigurations.malte =
2021-05-23 16:00:37 +02:00
home-manager.lib.homeManagerConfiguration {
2021-11-06 09:27:57 +01:00
system = "x86_64-linux";
username = "malte";
2021-05-23 16:00:37 +02:00
configuration = ./malte/home.nix;
2021-11-06 09:27:57 +01:00
homeDirectory = "/home/malte";
2021-05-23 16:00:37 +02:00
};
2021-05-19 23:08:18 +02:00
nixosModules.home-manager = { pkgs, ... }: {
home-manager.verbose = true;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
2021-11-06 09:27:57 +01:00
home-manager.users.malte.imports = [ ./malte/home.nix ];
2021-05-19 23:08:18 +02:00
};
2021-06-15 18:15:54 +02:00
# Necessary for flakes to work
2021-06-10 21:34:27 +02:00
nixosModules.nixUnstable = { pkgs, ... }: {
nix.registry.nixpkgs.flake = nixpkgs;
nix.package = pkgs.nixUnstable;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
nixpkgs.overlays = [ (self: super: { nix = super.nixUnstable; }) ];
2021-06-10 21:34:27 +02:00
};
2021-06-15 18:15:54 +02:00
# Some basics that every machine should have
2021-11-06 09:27:57 +01:00
nixosModules.x86_64-linux-basics = { pkgs, ... }: {
imports = [
inputs.custom-udev-rules.nixosModule
2021-12-04 12:47:59 +01:00
inputs.sops-nix.nixosModules.sops
self.nixosModules.nixUnstable
2021-11-06 09:27:57 +01:00
./modules/neovim.nix
];
2021-06-15 18:15:54 +02:00
# Basic system things
2021-07-18 13:33:50 +02:00
system.configurationRevision = pkgs.lib.mkIf (self ? rev) self.rev;
2021-11-29 16:36:57 +01:00
nixpkgs.config = {
allowUnfree = true;
joypixels.acceptLicense = true;
};
2021-06-15 18:15:54 +02:00
hardware.enableAllFirmware = true;
2021-08-18 15:50:25 +02:00
hardware.enableRedistributableFirmware = true;
2021-06-15 18:15:54 +02:00
# Make sure that I can log in
2021-06-15 18:56:08 +02:00
users.users.root = { openssh.authorizedKeys.keys = [ publicSshKey ]; };
2021-06-15 18:15:54 +02:00
# Basic packages
2021-11-03 14:35:32 +01:00
environment.systemPackages = with pkgs; [ git ];
2021-06-15 18:15:54 +02:00
# 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";
2021-11-03 14:35:32 +01:00
# Default locale on all systems
i18n.defaultLocale = "en_US.UTF-8";
2021-06-15 18:15:54 +02:00
# Some boot defaults
2021-06-15 19:02:47 +02:00
boot.kernelPackages = pkgs.lib.mkDefault pkgs.linuxPackages_latest;
2021-07-07 18:49:12 +02:00
boot.loader.timeout = pkgs.lib.mkDefault 1;
2021-06-15 18:15:54 +02:00
boot.loader.systemd-boot.configurationLimit = 100;
2021-11-03 14:35:32 +01:00
# This is set explicitly in all configurations, let's just do it here
networking.useDHCP = false;
2021-07-11 17:57:17 +02:00
# Add some useful overlays
nixpkgs.overlays = [
(self: super: {
# Add a meta package containing packages from master
2021-11-06 09:27:57 +01:00
bleeding = inputs.nixpkgs-master.legacyPackages.x86_64-linux;
2021-12-04 13:35:34 +01:00
"nixpkgs-21.05" =
inputs."nixpkgs-21.05".legacyPackages.x86_64-linux;
2021-07-11 17:57:17 +02:00
# 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" =
2021-11-06 09:27:57 +01:00
inputs.emulator-2a.packages.x86_64-linux."2a-emulator";
2021-10-13 22:57:04 +02:00
# Add my mensa tool
2021-11-06 09:27:57 +01:00
mensa = inputs.mensa.packages.x86_64-linux.mensa;
fend = inputs.fend.packages.x86_64-linux.fend;
2021-07-11 17:57:17 +02:00
})
2021-07-21 09:10:17 +02:00
# Some program adjustments
2021-08-16 16:17:37 +02:00
(import ./overlays/cataclysm-dda.nix)
2021-07-11 17:57:17 +02:00
];
2021-06-15 18:15:54 +02:00
};
# My thinkpad P1
2021-05-19 23:08:18 +02:00
nixosConfigurations.helix-texta = nixpkgs.lib.nixosSystem {
2021-06-15 18:15:54 +02:00
system = "x86_64-linux";
2021-05-23 16:00:37 +02:00
modules = [
2021-11-06 09:27:57 +01:00
./hosts/helix-texta.nix
./modules/light-actkbd.nix
./modules/scanner.nix
self.nixosModules.thinkpad-p1-gen3
2021-05-19 23:08:18 +02:00
home-manager.nixosModules.home-manager
self.nixosModules.home-manager
2021-11-06 09:27:57 +01:00
self.nixosModules.x86_64-linux-basics
2021-05-19 23:08:18 +02:00
({ pkgs, ... }: {
2021-06-04 16:07:13 +02:00
nix = {
# add binary caches
binaryCachePublicKeys = [
2021-11-13 09:14:28 +01:00
"elysia-clarki:aGVlotez1OXr8OHYZxgw+LH93sJEVzrKIS0aoVfKtpc="
2021-06-04 16:07:13 +02:00
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
];
2021-11-13 09:14:28 +01:00
binaryCaches = nixpkgs.lib.mkForce [
2021-11-14 11:40:42 +01:00
"http://cache.home.dyn.tammena.rocks"
2021-06-04 16:07:13 +02:00
"https://cache.nixos.org"
"https://nixpkgs-wayland.cachix.org"
];
};
2021-06-15 18:15:54 +02:00
# Overwrite basics
services.openssh.enable = false;
programs.mosh.enable = false;
2021-11-06 09:27:57 +01:00
# Overlays only relevant to my primary laptop
2021-06-04 16:07:51 +02:00
nixpkgs.overlays = [
inputs.nixpkgs-wayland.overlay
2021-10-13 17:38:24 +02:00
inputs.fenix.overlay
(import ./overlays/sane-backends.nix)
2021-11-06 09:27:57 +01:00
(import ./overlays/logisim.nix)
2021-06-04 16:07:51 +02:00
];
2021-05-23 16:00:37 +02:00
})
];
2021-05-19 23:08:18 +02:00
};
2021-06-09 22:24:06 +02:00
# Currently hosted by NetCup
2021-06-09 22:24:06 +02:00
nixosConfigurations.achatina-fulica = nixpkgs.lib.nixosSystem {
2021-06-15 18:15:54 +02:00
system = "x86_64-linux";
2021-06-09 22:24:06 +02:00
modules = [
2021-11-06 09:27:57 +01:00
self.nixosModules.x86_64-linux-basics
./hosts/achatina-fulica.nix
./hardware/netcup-minimal.nix
./modules/nginx-reverse-proxy.nix
./modules/radicale.nix
2021-11-06 17:00:11 +01:00
#./modules/grafana.nix
2021-06-09 22:24:06 +02:00
];
2021-06-09 22:30:55 +02:00
};
2021-06-15 17:25:16 +02:00
# Server @home
2021-06-15 17:33:35 +02:00
nixosConfigurations.elysia-clarki = nixpkgs.lib.nixosSystem {
2021-06-15 18:15:54 +02:00
system = "x86_64-linux";
2021-06-15 17:25:16 +02:00
modules = [
2021-11-06 09:27:57 +01:00
self.nixosModules.x86_64-linux-basics
./hosts/elysia-clarki.nix
./hardware/intel-nuc.nix
./modules/local-build-service.nix
2021-11-14 11:43:51 +01:00
./modules/nginx-reverse-proxy.nix
2021-11-13 09:14:28 +01:00
./modules/binary-cache.nix
./modules/ccqcraft-backups.nix
2021-06-15 19:02:47 +02:00
({ pkgs, ... }: {
# Override kernel version for zfs
2021-06-15 19:06:16 +02:00
boot.kernelPackages = pkgs.linuxPackages_5_10;
2021-06-15 19:02:47 +02:00
})
2021-06-15 17:25:16 +02:00
];
};
2021-07-07 18:49:12 +02:00
2021-05-19 23:08:18 +02:00
};
}