athens/flake.nix

220 lines
5.8 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-12-28 19:03:43 -05:00
devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-compat.follows = "flake-compat";
};
2023-02-09 22:38:20 -05:00
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-12-28 19:03:43 -05:00
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
, deploy-rs
2022-05-31 10:38:16 -04:00
, darwin
2022-05-06 20:01:04 -04:00
, flake-utils
2023-02-09 22:38:20 -05:00
, nixos-generators
2022-05-06 20:01:04 -04:00
, home-manager
2022-12-26 21:33:53 -05:00
, devenv
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 = [
2022-12-27 10:10:53 -05:00
(self: _super: {
2022-10-27 22:34:08 -04:00
workon = workon.packages.${self.system}.default;
2022-12-27 10:10:53 -05:00
inherit (devenv.packages.${self.system}) devenv;
2022-10-27 22:34:08 -04:00
})
];
2022-05-03 21:00:37 -04:00
mkSystem = hostName: system: modules:
nixpkgs.lib.nixosSystem {
2022-12-27 10:10:53 -05:00
inherit system;
2022-05-03 21:00:37 -04:00
modules = [
home-manager.nixosModules.home-manager
2022-12-27 10:10:53 -05:00
(_: {
2022-05-03 21:00:37 -04:00
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 {
2022-12-27 10:10:53 -05:00
inherit system;
2022-05-31 10:38:16 -04:00
modules = [
home-manager.darwinModules.home-manager
2022-12-27 10:10:53 -05:00
(_: {
2022-05-31 10:38:16 -04:00
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};
2022-05-06 20:01:04 -04:00
in
{
2023-02-09 22:38:20 -05:00
packages = {
digitalocean = nixos-generators.nixosGenerate {
system = "x86_64-linux";
format = "do";
};
};
2022-12-27 10:06:18 -05:00
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
2023-02-07 22:08:49 -05:00
packages = with pkgs; [
deploy-rs.packages.${system}.deploy-rs
nodePackages.typescript-language-server
pulumi-bin
sops
];
2022-12-27 10:06:18 -05:00
scripts.darwin-local.exec = ''
nix build .#darwinConfigurations.$(hostname -s).system
./result/sw/bin/darwin-rebuild switch --flake .
'';
languages.nix.enable = true;
pre-commit.hooks = {
2022-12-27 10:10:53 -05:00
deadnix.enable = true;
2022-12-27 10:06:18 -05:00
nixpkgs-fmt.enable = true;
2022-12-27 10:10:53 -05:00
statix.enable = true;
2022-12-27 10:06:18 -05:00
};
2023-02-07 22:08:49 -05:00
env.PULUMI_SKIP_UPDATE_CHECK = true;
2022-12-27 10:06:18 -05:00
}
];
2022-05-06 20:01:04 -04:00
};
2022-10-31 17:41:19 -04:00
formatter = pkgs.nixpkgs-fmt;
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
};
};
}
2023-02-15 12:13:26 -05:00