1
0
mirror of https://github.com/tboerger/nixos-config synced 2024-11-22 18:21:58 +01:00
github.com-tboerger-nixos-c.../flake.nix

401 lines
10 KiB
Nix
Raw Normal View History

2022-02-20 17:46:48 +01:00
{
description = "NixOS configurations by tboerger";
inputs = {
nixpkgs = {
2022-04-11 00:02:22 +02:00
url = "github:nixos/nixpkgs/nixos-unstable";
2022-02-20 17:46:48 +01:00
};
utils = {
url = "github:numtide/flake-utils";
2022-02-20 17:46:48 +01:00
};
devshell = {
url = "github:numtide/devshell";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
};
disko = {
url = "github:nix-community/disko";
2022-10-25 09:53:40 +02:00
inputs.nixpkgs.follows = "nixpkgs";
};
homemanager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-10-25 09:53:40 +02:00
hardware = {
url = "github:nixos/nixos-hardware";
2022-02-20 17:46:48 +01:00
};
};
2024-07-17 16:05:33 +02:00
outputs = { self, nixpkgs, utils, devshell, deploy-rs, disko, homemanager, agenix, hardware, ... }@inputs:
2022-02-20 17:46:48 +01:00
let
inherit (self) outputs;
2022-10-26 20:37:14 +02:00
mkComputer = configurationNix: systemName: extraModules: nixpkgs.lib.nixosSystem {
system = systemName;
modules = [
({ pkgs, ... }:
{
nixpkgs = {
overlays = [
(import ./overlays)
];
};
}
)
homemanager.nixosModules.home-manager
agenix.nixosModules.default
configurationNix
2022-10-26 18:35:12 +02:00
] ++ extraModules;
2022-10-26 18:22:17 +02:00
specialArgs = {
inherit inputs;
};
};
2022-02-20 17:46:48 +01:00
in
{
diskoConfigurations = {
anubis = import ./desktops/anubis/disko.nix;
chnum = import ./desktops/chnum/disko.nix;
asgard = import ./servers/asgard/disko.nix;
utgard = import ./servers/utgard/disko.nix;
vanaheim = import ./servers/vanaheim/disko.nix;
};
2022-02-20 17:46:48 +01:00
nixosConfigurations = {
2022-11-22 11:15:02 +01:00
anubis = mkComputer
./desktops/anubis
"x86_64-linux"
[
disko.nixosModules.disko
./home/thomas/user.nix
./home/anna/user.nix
./home/adrian/user.nix
./home/tabea/user.nix
{
home-manager = {
extraSpecialArgs = {
desktopSystem = true;
};
users = {
thomas = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/thomas
];
};
anna = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/anna
];
};
adrian = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/adrian
];
};
tabea = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/tabea
];
};
};
};
}
];
2022-11-22 11:15:02 +01:00
chnum = mkComputer
./desktops/chnum
"x86_64-linux"
[
disko.nixosModules.disko
./home/thomas/user.nix
./home/anna/user.nix
./home/adrian/user.nix
./home/tabea/user.nix
{
home-manager = {
extraSpecialArgs = {
desktopSystem = true;
};
users = {
thomas = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/thomas
];
};
anna = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/anna
];
};
adrian = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/adrian
];
};
tabea = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/tabea
];
};
};
};
}
];
asgard = mkComputer
./servers/asgard
"x86_64-linux"
[
disko.nixosModules.disko
./home/thomas/user.nix
{
home-manager = {
extraSpecialArgs = {
desktopSystem = false;
};
users = {
thomas = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/thomas
];
};
};
};
}
];
utgard = mkComputer
./servers/utgard
"x86_64-linux"
[
disko.nixosModules.disko
./home/thomas/user.nix
{
home-manager = {
extraSpecialArgs = {
desktopSystem = false;
};
users = {
thomas = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/thomas
];
};
};
};
}
];
vanaheim = mkComputer
./servers/vanaheim
"x86_64-linux"
[
disko.nixosModules.disko
./home/thomas/user.nix
{
home-manager = {
extraSpecialArgs = {
desktopSystem = false;
};
users = {
thomas = {
imports = [
2024-07-17 16:05:33 +02:00
agenix.homeManagerModules.default
./home/thomas
];
};
};
};
}
];
# yggdrasil = mkComputer
# ./servers/yggdrasil
# "aarch64-linux"
# [
# hardware.nixosModules.raspberry-pi-4
# ./home/thomas/user.nix
# {
# home-manager = {
# extraSpecialArgs = {
# desktopSystem = false;
# };
# users = {
# thomas = {
# imports = [
2024-07-17 16:05:33 +02:00
# agenix.homeManagerModules.default
# ./home/thomas
# ];
# };
# };
# };
# }
# ];
};
deploy = {
nodes = {
2024-07-17 16:05:33 +02:00
anubis = {
sshOpts = [ "-p" "22" ];
hostname = "anubis";
fastConnection = true;
profiles = {
system = {
sshUser = "thomas";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.anubis;
user = "root";
};
};
};
chnum = {
sshOpts = [ "-p" "22" ];
hostname = "chnum";
fastConnection = true;
profiles = {
system = {
sshUser = "thomas";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.chnum;
user = "root";
};
};
};
asgard = {
sshOpts = [ "-p" "22" ];
hostname = "asgard.boerger.ws";
fastConnection = true;
profiles = {
system = {
2024-01-30 23:48:00 +01:00
sshUser = "thomas";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.asgard;
user = "root";
};
};
};
utgard = {
sshOpts = [ "-p" "22" ];
hostname = "utgard.boerger.ws";
fastConnection = true;
profiles = {
system = {
2024-01-30 23:48:00 +01:00
sshUser = "thomas";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.utgard;
user = "root";
};
};
};
vanaheim = {
sshOpts = [ "-p" "22" ];
hostname = "vanaheim.boerger.ws";
fastConnection = true;
profiles = {
system = {
2024-01-30 23:48:00 +01:00
sshUser = "thomas";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.vanaheim;
user = "root";
};
};
};
# yggdrasil = {
# sshOpts = [ "-p" "22" ];
# hostname = "yggdrasil.boerger.ws";
# fastConnection = true;
# profiles = {
# system = {
2024-01-30 23:48:00 +01:00
# sshUser = "thomas";
# path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.yggdrasil;
# user = "root";
# };
# };
# };
};
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
} // utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlays.default ];
};
in
{
devShells.default = pkgs.devshell.mkShell {
commands = [
{
name = "age-encrypt";
category = "secrets commands";
help = "Encrypt secret with age";
command = "${pkgs.rage}/bin/rage -e -a -i ~/.ssh/id_ed25519";
}
{
name = "age-decrypt";
category = "secrets commands";
help = "Decrypt secret with age";
command = "${pkgs.rage}/bin/rage -d -i ~/.ssh/id_ed25519";
}
{
name = "agenix-rekey";
category = "secrets commands";
help = "Rekey agenix secrets";
command = "cd secrets && agenix -r";
}
{
package = "nixpkgs-fmt";
category = "formatter commands";
}
];
packages = with pkgs; [
inputs.agenix.packages.${system}.default
inputs.deploy-rs.packages.${system}.default
2024-07-17 16:05:33 +02:00
git
gnumake
home-manager
nixpkgs-fmt
rage
];
};
}
);
2022-02-20 17:46:48 +01:00
}