athens/flake.nix

179 lines
4.9 KiB
Nix
Raw Normal View History

2022-04-29 14:23:10 -04:00
{
description = "walkah's little city state";
inputs = {
2022-09-23 15:40:36 -04:00
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
2022-04-29 14:23:10 -04:00
home-manager.url = "github:nix-community/home-manager";
flake-utils.url = "github:numtide/flake-utils";
deploy-rs.url = "github:serokell/deploy-rs";
2022-05-03 21:00:37 -04:00
2022-05-31 10:38:16 -04:00
darwin = {
2022-10-23 11:02:55 -04:00
url = "github:lnl7/nix-darwin/master";
2022-05-31 10:38:16 -04:00
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
2022-05-09 17:09:32 -04:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-05-03 21:00:37 -04:00
# My stuff
dotfiles = {
url = "github:walkah/dotfiles";
flake = false;
2022-05-03 21:00:37 -04:00
};
2022-10-27 22:34:08 -04:00
workon = {
url = "github:walkah/workon";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-04-29 14:23:10 -04:00
};
2022-05-06 20:01:04 -04:00
outputs =
{ self
, nixpkgs
2022-06-24 22:44:43 -04:00
, nixos-hardware
2022-05-06 20:01:04 -04:00
, deploy-rs
2022-05-31 10:38:16 -04:00
, darwin
2022-05-06 20:01:04 -04:00
, flake-utils
, home-manager
2022-05-09 17:09:32 -04:00
, sops-nix
2022-05-06 20:01:04 -04:00
, dotfiles
2022-10-27 22:34:08 -04:00
, workon
2022-05-06 20:01:04 -04:00
, ...
2022-05-09 17:09:32 -04:00
}@inputs:
2022-05-03 21:00:37 -04:00
let
2022-10-27 22:34:08 -04:00
overlays = [
(self: super: {
workon = workon.packages.${self.system}.default;
})
];
2022-05-03 21:00:37 -04:00
mkSystem = hostName: system: modules:
nixpkgs.lib.nixosSystem {
system = system;
modules = [
home-manager.nixosModules.home-manager
({ config, ... }: {
networking.hostName = hostName;
2022-10-27 22:34:08 -04:00
nixpkgs.overlays = overlays;
2022-05-03 21:00:37 -04:00
})
2022-05-06 20:01:04 -04:00
] ++ modules;
2022-05-09 17:09:32 -04:00
specialArgs = inputs;
2022-05-03 21:00:37 -04:00
};
2022-05-31 10:38:16 -04:00
mkDarwin = hostName: system: modules:
darwin.lib.darwinSystem {
system = system;
modules = [
home-manager.darwinModules.home-manager
({ config, ... }: {
networking.hostName = hostName;
2022-10-27 22:34:08 -04:00
nixpkgs.overlays = overlays;
2022-05-31 10:38:16 -04:00
})
] ++ modules;
specialArgs = inputs;
};
2022-05-03 21:00:37 -04:00
in
2022-04-29 14:23:10 -04:00
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
darwin-local = pkgs.writeScriptBin "darwin-local" ''
#!${pkgs.stdenv.shell}
nix build .#darwinConfigurations.$(hostname -s).system
./result/sw/bin/darwin-rebuild switch --flake .
'';
2022-05-06 20:01:04 -04:00
in
{
devShells.default = pkgs.mkShell {
2022-06-01 20:22:08 -04:00
name = "athens";
2022-06-14 21:01:36 -04:00
buildInputs = [ darwin-local deploy-rs.packages.${system}.deploy-rs pkgs.nixpkgs-fmt pkgs.rnix-lsp pkgs.sops ];
2022-05-06 20:01:04 -04:00
};
}) // {
2022-04-29 14:23:10 -04:00
nixosConfigurations = {
2022-05-03 21:00:37 -04:00
# Aristotle
2022-06-28 22:12:01 -04:00
agent = mkSystem "agent" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
form = mkSystem "form" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
matter = mkSystem "matter" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
purpose = mkSystem "purpose" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
2022-04-29 14:23:10 -04:00
plato = mkSystem "plato" "x86_64-linux" [ ./hosts/plato/configuration.nix ];
socrates = mkSystem "socrates" "x86_64-linux" [ ./hosts/socrates/configuration.nix ];
2022-04-29 14:23:10 -04:00
};
2022-05-31 10:38:16 -04:00
darwinConfigurations = {
epicurus = mkDarwin "epicurus" "aarch64-darwin" [ ./hosts/epicurus/darwin-configuration.nix ];
2022-06-02 17:21:54 -04:00
heraclitus = mkDarwin "heraclitus" "aarch64-darwin" [ ./hosts/heraclitus/darwin-configuration.nix ];
2022-05-31 10:38:16 -04:00
};
2022-04-29 14:23:10 -04:00
deploy.nodes = {
agent = {
hostname = "agent";
sshUser = "root";
profiles.system = {
user = "root";
path = deploy-rs.lib.aarch64-linux.activate.nixos
self.nixosConfigurations.agent;
};
};
form = {
hostname = "form";
sshUser = "root";
profiles.system = {
user = "root";
path = deploy-rs.lib.aarch64-linux.activate.nixos
self.nixosConfigurations.form;
};
};
2022-05-03 21:00:37 -04:00
matter = {
hostname = "matter";
sshUser = "root";
profiles.system = {
user = "root";
path = deploy-rs.lib.aarch64-linux.activate.nixos
self.nixosConfigurations.matter;
};
};
purpose = {
hostname = "purpose";
sshUser = "root";
profiles.system = {
user = "root";
path = deploy-rs.lib.aarch64-linux.activate.nixos
self.nixosConfigurations.purpose;
};
};
plato = {
hostname = "plato";
profiles = {
system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.plato;
};
};
};
socrates = {
hostname = "socrates";
profiles = {
system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.socrates;
};
};
};
2022-04-29 14:23:10 -04:00
};
};
}