1
0
mirror of https://github.com/tboerger/nixos-config synced 2024-11-26 07:43:45 +01:00
github.com-tboerger-nixos-c.../flake.nix

211 lines
5.2 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
};
nur = {
url = "github:nix-community/NUR";
};
utils = {
url = "github:numtide/flake-utils";
};
2022-10-25 09:53:40 +02:00
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
homemanager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
deployrs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-10-25 09:53:40 +02:00
arion = {
url = "github:hercules-ci/arion";
2022-02-20 17:46:48 +01:00
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
};
};
2022-10-25 09:53:40 +02:00
outputs = { self, nixpkgs, nur, utils, agenix, homemanager, deployrs, arion, hardware, ... }@inputs:
2022-02-20 17:46:48 +01:00
let
2022-10-26 20:37:14 +02:00
mkComputer = configurationNix: systemName: extraModules: nixpkgs.lib.nixosSystem {
system = systemName;
modules = [
({ pkgs, ... }:
let
nur-no-pkgs = import nur {
nurpkgs = import nixpkgs { system = systemName; };
};
in
{
imports = [
nur-no-pkgs.repos.tboerger.modules
];
nixpkgs = {
overlays = [
(import ./overlays)
nur.overlay
];
};
})
homemanager.nixosModules.home-manager
agenix.nixosModules.age
arion.nixosModules.arion
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
{
nixosConfigurations = {
2022-11-22 11:15:02 +01:00
anubis = mkComputer
./desktops/anubis
"x86_64-linux"
[
./profiles/thomas
# ./profiles/anna
# ./profiles/adrian
# ./profiles/tabea
];
2022-11-22 11:15:02 +01:00
chnum = mkComputer
./desktops/chnum
"x86_64-linux"
[
./profiles/thomas
# ./profiles/anna
# ./profiles/adrian
# ./profiles/tabea
];
osiris = mkComputer
./desktops/osiris
"x86_64-linux"
[
./profiles/thomas
2022-10-25 09:53:40 +02:00
# ./profiles/anna
# ./profiles/adrian
# ./profiles/tabea
];
asgard = mkComputer
./servers/asgard
"x86_64-linux"
[
./profiles/thomas
2022-10-25 09:53:40 +02:00
# ./profiles/anna
# ./profiles/adrian
# ./profiles/tabea
];
utgard = mkComputer
./servers/utgard
"x86_64-linux"
[
./profiles/thomas
# ./profiles/anna
# ./profiles/adrian
# ./profiles/tabea
];
midgard = mkComputer
./servers/midgard
"aarch64-linux"
[
hardware.nixosModules.raspberry-pi-4
./profiles/thomas
2022-10-25 09:53:40 +02:00
# ./profiles/anna
# ./profiles/adrian
# ./profiles/tabea
];
};
2022-11-22 11:15:02 +01:00
anubis = self.nixosConfigurations.anubis.config.system.build.toplevel;
chnum = self.nixosConfigurations.chnum.config.system.build.toplevel;
osiris = self.nixosConfigurations.osiris.config.system.build.toplevel;
asgard = self.nixosConfigurations.asgard.config.system.build.toplevel;
2022-10-26 18:22:17 +02:00
utgard = self.nixosConfigurations.utgard.config.system.build.toplevel;
midgard = self.nixosConfigurations.midgard.config.system.build.toplevel;
deploy = {
nodes = {
asgard = {
sshOpts = [ "-p" "22" ];
hostname = "192.168.1.10";
fastConnection = true;
profiles.system = {
2022-10-26 18:22:17 +02:00
sshUser = "admin";
user = "root";
path = deployrs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.asgard;
};
};
utgard = {
sshOpts = [ "-p" "22" ];
hostname = "192.168.1.11";
fastConnection = true;
profiles.system = {
2022-10-26 18:22:17 +02:00
sshUser = "admin";
user = "root";
path = deployrs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.utgard;
};
};
midgard = {
sshOpts = [ "-p" "22" ];
hostname = "192.168.1.5";
fastConnection = true;
profiles.system = {
2022-10-26 18:22:17 +02:00
sshUser = "admin";
user = "root";
path = deployrs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.midgard;
};
};
};
};
checks = builtins.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy)
deployrs.lib;
} // utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
agenix.defaultPackage.${system}
deployrs.defaultPackage.${system}
nixpkgs-fmt
gnumake
nixUnstable
];
};
}
);
2022-02-20 17:46:48 +01:00
}