os/flake.nix

163 lines
5 KiB
Nix

{
description = "b12f hosts";
nixConfig.extra-experimental-features = "nix-command flakes";
inputs = {
# Track channels with commits tested and built by hydra
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
nix-darwin.url = "github:lnl7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-flake.url = "github:srid/nixos-flake";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.inputs.flake-compat.follows = "flake-compat";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.inputs.darwin.follows = "nix-darwin";
nixos-hardware.url = "github:nixos/nixos-hardware";
master.url = "github:nixos/nixpkgs/master";
scan2paperless.url = "git+https://git.pub.solar/b12f/scan2paperless.git";
musnix.url = "github:musnix/musnix";
adblock-unbound.url = "github:MayNiklas/nixos-adblock-unbound";
adblock-unbound.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
imports = [
inputs.nixos-flake.flakeModule
./lib
./modules
./hosts
./users
];
perSystem = args@{ system, pkgs, config, ... }: {
_module.args = {
inherit inputs;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.agenix.overlays.default
];
};
unstable = import inputs.unstable { inherit system; };
master = import inputs.master { inherit system; };
};
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.nixpkgs-fmt
pkgs.agenix
pkgs.ssh-to-age
];
};
};
flake = {
nixosModules = rec {
base.imports = [
self.nixosModules.home-manager
inputs.agenix.nixosModules.default
inputs.musnix.nixosModules.musnix
({
flake,
pkgs,
lib,
unstable,
master,
...
}: {
nixpkgs.overlays = (import ./overlays) ++ [
(prev: next: {
scan2paperless = inputs.scan2paperless.legacyPackages.${prev.system}.scan2paperless;
nixd = inputs.unstable.legacyPackages.${prev.system}.nixd;
factorio-headless = inputs.master.legacyPackages.${prev.system}.factorio-headless;
paperless-ngx = inputs.master.legacyPackages.${prev.system}.paperless-ngx;
waybar = inputs.master.legacyPackages.${prev.system}.waybar;
element-desktop = inputs.master.legacyPackages.${prev.system}.element-desktop;
adlist = inputs.adblock-unbound.packages.${prev.system};
})
];
nix.nixPath = [
"nixpkgs=${inputs.nixpkgs}"
"nixos-config=${./lib/compat/nixos}"
"home-manager=${inputs.home-manager}"
];
})
self.nixosModules.arduino
self.nixosModules.audio
self.nixosModules.ci-runner
self.nixosModules.core
self.nixosModules.crypto
self.nixosModules.devops
self.nixosModules.docker
self.nixosModules.docker-ci-runner
self.nixosModules.email
self.nixosModules.gaming
self.nixosModules.graphical
self.nixosModules.mobile
self.nixosModules.nix
self.nixosModules.nextcloud
self.nixosModules.office
self.nixosModules.paperless
self.nixosModules.paranoia
self.nixosModules.printing
self.nixosModules.social
self.nixosModules.sway
self.nixosModules.terminal-life
self.nixosModules.uhk
self.nixosModules.user
self.nixosModules.virtualisation
self.nixosModules.root
];
};
deploy.nodes = {
droppie.profiles.system = {
hostname = "backup.b12f.io";
sshUser = "yule";
path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.droppie;
};
pie.profiles.system = {
hostname = "pie.local";
sshUser = "yule";
};
maoam.profiles.system = {
sshUser = "b12f";
};
};
};
};
}