365 lines
11 KiB
Nix
365 lines
11 KiB
Nix
{
|
|
description = "Malte Tammena's system configuration";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
|
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
|
|
custom-udev-rules.url = "github:MalteT/custom-udev-rules";
|
|
nix-colors.url = "github:Misterio77/nix-colors";
|
|
|
|
nickel = {
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
nixpkgs-wayland = {
|
|
url = "github:nix-community/nixpkgs-wayland";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
emulator-2a = {
|
|
url = "github:MalteT/2a-emulator/develop";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
mensa = {
|
|
url = "github:MalteT/mensa/develop";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
fenix = {
|
|
url = "github:nix-community/fenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
colmena = {
|
|
url = "github:zhaofengli/colmena";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
sops-nix = {
|
|
url = "github:Mic92/sops-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
glados = {
|
|
url = "git+https://git.sr.ht/~megamanmalte/GLaDOS?ref=main";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
fend = {
|
|
url = "github:MalteT/fend/flake";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
hydra = {
|
|
url = "github:NixOS/hydra";
|
|
inputs.nixpkgs.follows = "nixForHydra/nixpkgs";
|
|
inputs.nix.follows = "nixForHydra";
|
|
};
|
|
nixForHydra = {
|
|
url = "github:NixOS/nix/5fe4fe823c193cbb7bfa05a468de91eeab09058d";
|
|
};
|
|
|
|
rip = {
|
|
url = "github:nivekuil/rip";
|
|
flake = false;
|
|
};
|
|
"2i-emulator" = {
|
|
url = "github:klemens/2i-emulator";
|
|
flake = false;
|
|
};
|
|
"cataclysm-dda" = {
|
|
url = "github:CleverRaven/Cataclysm-DDA";
|
|
flake = false;
|
|
};
|
|
radicale_infcloud = {
|
|
url = "github:Unrud/RadicaleInfCloud";
|
|
flake = false;
|
|
};
|
|
qmk-udev-rules = {
|
|
url = "github:qmk/qmk_firmware";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
nixConfig = {
|
|
substituters = ["http://elysia-clarki:5000"];
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
utils,
|
|
nixpkgs,
|
|
nixos-hardware,
|
|
...
|
|
} @ inputs: let
|
|
pkgs = self.pkgs.x86_64-linux.nixpkgs;
|
|
|
|
hosts = [
|
|
"helix-texta"
|
|
"murex-pecten"
|
|
"cornu-aspersum"
|
|
"elysia-clarki"
|
|
"trochulus-hispidus"
|
|
"radix-balthica"
|
|
"faunus-ater"
|
|
];
|
|
|
|
defaultModules = [
|
|
inputs.home-manager.nixosModules.home-manager
|
|
self.nixosModules.home-manager-config
|
|
inputs.custom-udev-rules.nixosModule
|
|
inputs.sops-nix.nixosModules.sops
|
|
self.nixosModules.nixUnstable
|
|
./modules/base-system.nix
|
|
{config._module.args.flake = self;}
|
|
];
|
|
in
|
|
utils.lib.mkFlake {
|
|
inherit self inputs;
|
|
|
|
supportedSystems = ["x86_64-linux"];
|
|
nix.generateRegistryFromInputs = true;
|
|
nix.linkInputs = true;
|
|
|
|
sharedOverlays = [
|
|
inputs.fenix.overlay
|
|
inputs.nixpkgs-wayland.overlay
|
|
inputs.colmena.overlay
|
|
utils.overlay
|
|
(self: super: {
|
|
# Add fonts
|
|
hackNerdLigatures = super.callPackage ./pkgs/hack.nix {};
|
|
# Add the emulator
|
|
"2a-emulator" =
|
|
inputs.emulator-2a.packages.x86_64-linux."2a-emulator";
|
|
# Add my mensa tool
|
|
inherit (inputs.mensa.packages.x86_64-linux) mensa;
|
|
darkman = super.callPackage ./pkgs/darkman.nix {};
|
|
# TODO: Replace with upstream
|
|
inherit (inputs.fend.packages.x86_64-linux) fend;
|
|
nickel = inputs.nickel.defaultPackage.x86_64-linux;
|
|
hydra = inputs.hydra.defaultPackage.x86_64-linux;
|
|
# TODO: Remove once hydra fixes these removed aliases
|
|
inherit (super.perlPackages) buildPerlPackage;
|
|
netcat-openbsd = super.libressl.nc;
|
|
})
|
|
# Override cataclysm to use git
|
|
(import ./overlays/cataclysm-dda.nix)
|
|
(import ./overlays/qmk-udev-rules.nix)
|
|
(import ./overlays/sane-backends.nix)
|
|
(import ./overlays/logisim.nix)
|
|
(import ./overlays/fzf-kak.nix)
|
|
(import ./overlays/prometheus-fritzbox-exporter.nix)
|
|
];
|
|
|
|
hostDefaults.system = "x86_64-linux";
|
|
hostDefaults.modules = defaultModules;
|
|
|
|
hosts = builtins.listToAttrs (map (host: {
|
|
name = host;
|
|
value = {modules = [self.nixosModules.${host}];};
|
|
})
|
|
hosts);
|
|
|
|
nixosModules = {
|
|
home-manager-config = _: {
|
|
home-manager.verbose = true;
|
|
home-manager.useGlobalPkgs = true;
|
|
home-manager.useUserPackages = true;
|
|
home-manager.extraSpecialArgs = {inherit (inputs) nix-colors;};
|
|
};
|
|
|
|
nixUnstable = {pkgs, ...}: {
|
|
nix.registry.nixpkgs.flake = nixpkgs;
|
|
nix.package = pkgs.nixUnstable;
|
|
nix.extraOptions = ''
|
|
experimental-features = nix-command flakes
|
|
'';
|
|
};
|
|
|
|
helix-texta = {
|
|
pkgs,
|
|
config,
|
|
...
|
|
}: {
|
|
imports = [
|
|
./hosts/helix-texta.nix
|
|
./modules/light-actkbd.nix
|
|
self.nixosModules.thinkpad-p1-gen3
|
|
];
|
|
};
|
|
murex-pecten = {...}: {
|
|
imports = [
|
|
nixos-hardware.nixosModules.common-pc
|
|
nixos-hardware.nixosModules.common-pc-ssd
|
|
nixos-hardware.nixosModules.common-cpu-amd
|
|
nixos-hardware.nixosModules.common-gpu-amd
|
|
./hosts/murex-pecten.nix
|
|
./hardware/aorus.nix
|
|
];
|
|
};
|
|
cornu-aspersum = {...}: {
|
|
imports = [
|
|
./hosts/cornu-aspersum.nix
|
|
./hardware/netcup-rs-2000-g9.nix
|
|
./modules/nginx-reverse-proxy.nix
|
|
./modules/ccqcraft.nix
|
|
inputs.glados.nixosModules.glados
|
|
];
|
|
};
|
|
elysia-clarki = {pkgs, ...}: {
|
|
imports = [
|
|
./hosts/elysia-clarki.nix
|
|
./hardware/intel-nuc.nix
|
|
./modules/local-build-service.nix
|
|
./modules/nginx-reverse-proxy.nix
|
|
#./modules/binary-cache.nix
|
|
./modules/ccqcraft-backups.nix
|
|
#inputs.hydra.nixosModules.hydra
|
|
];
|
|
config = {
|
|
# Override kernel version for zfs
|
|
boot.kernelPackages = pkgs.linuxPackages_5_10;
|
|
};
|
|
};
|
|
trochulus-hispidus = {pkgs, ...}: {
|
|
imports = [
|
|
./hosts/trochulus-hispidus.nix
|
|
./hardware/latitude-e7440.nix
|
|
nixos-hardware.nixosModules.common-cpu-intel
|
|
nixos-hardware.nixosModules.common-pc-laptop
|
|
nixos-hardware.nixosModules.common-pc-laptop-ssd
|
|
];
|
|
};
|
|
thinkpad-p1-gen3 = {...}: {
|
|
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
|
|
./hardware/thinkpad-p1-gen3.nix
|
|
];
|
|
};
|
|
radix-balthica = {...}: {
|
|
imports = [
|
|
./hosts/radix-balthica.nix
|
|
];
|
|
};
|
|
faunus-ater = {...}: {
|
|
imports = [
|
|
nixos-hardware.nixosModules.common-cpu-intel #-cpu-only
|
|
./modules/nginx-reverse-proxy.nix
|
|
./hosts/faunus-ater.nix
|
|
./hardware/asrock-z370-i3-black-box.nix
|
|
];
|
|
};
|
|
};
|
|
|
|
colmena =
|
|
{
|
|
meta = {nixpkgs = pkgs;};
|
|
defaults = {...}: {imports = defaultModules;};
|
|
}
|
|
// (builtins.listToAttrs (map (
|
|
host: {
|
|
name = host;
|
|
value = {
|
|
imports = [self.nixosModules.${host}];
|
|
config.deployment = {
|
|
targetHost = host;
|
|
targetUser = "root";
|
|
};
|
|
};
|
|
}
|
|
)
|
|
hosts));
|
|
|
|
hydraJobs = {
|
|
shell.x86_64-linux = self.devShell.x86_64-linux;
|
|
packages = self.packages;
|
|
nixosConfigurations.x86_64-linux = builtins.listToAttrs (map (host: {
|
|
name = host;
|
|
value = self.nixosConfigurations.${host}.config.system.build.toplevel;
|
|
})
|
|
hosts);
|
|
};
|
|
|
|
packages.x86_64-linux.iso = self.nixosConfigurations.radix-balthica.config.system.build.isoImage;
|
|
packages.x86_64-linux.vm = self.nixosConfigurations.radix-balthica.config.system.build.vm;
|
|
|
|
outputsBuilder = channels: {
|
|
devShell = channels.nixpkgs.mkShell {
|
|
packages = let
|
|
personalCache = pkgs.writeShellApplication {
|
|
name = "personal-cache";
|
|
runtimeInputs = with pkgs; [
|
|
coreutils
|
|
nix
|
|
];
|
|
text = builtins.readFile ./scripts/personal-cache.sh;
|
|
};
|
|
|
|
rebuild = pkgs.writeShellApplication {
|
|
name = "rebuild";
|
|
runtimeInputs = with pkgs; [
|
|
coreutils
|
|
git
|
|
personalCache
|
|
nixos-rebuild
|
|
];
|
|
text = builtins.readFile ./scripts/rebuild.sh;
|
|
};
|
|
|
|
allHosts = pkgs.writeShellApplication {
|
|
name = "all-hosts";
|
|
runtimeInputs = with pkgs; [
|
|
jq
|
|
nix
|
|
];
|
|
text = ''
|
|
nix eval --json .#nixosConfigurations --apply builtins.attrNames 2>/dev/null | jq -r .[]
|
|
'';
|
|
};
|
|
|
|
option = pkgs.writeShellApplication {
|
|
name = "option";
|
|
runtimeInputs = with pkgs; [
|
|
coreutils
|
|
nix
|
|
];
|
|
text = builtins.readFile ./scripts/option.sh;
|
|
};
|
|
|
|
testConfig = pkgs.writeShellApplication {
|
|
name = "test-config";
|
|
runtimeInputs = with pkgs; [
|
|
coreutils
|
|
nix
|
|
allHosts
|
|
nixos-rebuild
|
|
bat
|
|
];
|
|
text = builtins.readFile ./scripts/test-config.sh;
|
|
};
|
|
|
|
date = "${pkgs.coreutils}/bin/date";
|
|
git = "${pkgs.git}/bin/git";
|
|
nixos-rebuild = "${pkgs.nixos-rebuild}/bin/nixos-rebuild";
|
|
sops = "${pkgs.sops}/bin/sops";
|
|
bat = "${pkgs.bat}/bin/bat";
|
|
echo = "${pkgs.coreutils}/bin/echo";
|
|
pingPersonalCache = "${pkgs.nix}/bin/nix store ping --store ${personalCache} --option connect-timeout 1 --option download-attempt 1 2>/dev/null";
|
|
in
|
|
with pkgs; [
|
|
rebuild
|
|
personalCache
|
|
allHosts
|
|
option
|
|
testConfig
|
|
inputs.colmena.packages.x86_64-linux.colmena
|
|
fup-repl
|
|
alejandra
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|