2023-09-17 03:40:50 -05:00
|
|
|
{
|
2024-03-14 03:34:46 -05:00
|
|
|
description = "Price Hiller's flake for managing system configurations";
|
2023-09-17 03:40:50 -05:00
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2023-12-07 09:05:24 -06:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2024-01-30 22:07:30 -06:00
|
|
|
deploy-rs.url = "github:serokell/deploy-rs";
|
2024-02-17 14:10:39 -06:00
|
|
|
impermanence = { url = "github:nix-community/impermanence"; };
|
2023-10-29 22:38:56 -05:00
|
|
|
agenix = {
|
2024-01-31 20:08:06 -06:00
|
|
|
url = "github:yaxitech/ragenix";
|
2023-10-29 22:38:56 -05:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-10-27 01:46:14 -05:00
|
|
|
};
|
2023-12-07 09:05:24 -06:00
|
|
|
disko = {
|
|
|
|
url = "github:nix-community/disko";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-01-30 22:07:30 -06:00
|
|
|
# For the nixd language server
|
|
|
|
flake-compat = {
|
|
|
|
url = "github:inclyc/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
2023-12-07 09:05:24 -06:00
|
|
|
blog = {
|
2024-01-31 20:08:06 -06:00
|
|
|
url = "git+https://git.orion-technologies.io/blog/blog";
|
2023-12-03 02:17:44 -06:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-09-17 03:40:50 -05:00
|
|
|
};
|
2023-10-29 22:38:56 -05:00
|
|
|
|
2024-02-17 14:10:39 -06:00
|
|
|
outputs = inputs@{ self, nixpkgs, deploy-rs, impermanence, agenix, disko
|
|
|
|
, flake-utils, blog, ... }:
|
2023-10-29 22:38:56 -05:00
|
|
|
let
|
2024-01-30 22:07:30 -06:00
|
|
|
lib = (import ./lib { lib = nixpkgs.lib; }) // nixpkgs.lib;
|
|
|
|
persist-dir = "/persist";
|
2023-10-29 22:38:56 -05:00
|
|
|
defaults = {
|
|
|
|
config = {
|
2024-02-17 14:10:39 -06:00
|
|
|
environment.etc.machine-id.source =
|
|
|
|
"${persist-dir}/ephemeral/etc/machine-id";
|
2023-12-07 09:05:24 -06:00
|
|
|
environment.persistence.save = {
|
|
|
|
hideMounts = true;
|
2024-01-30 22:07:30 -06:00
|
|
|
persistentStoragePath = "${persist-dir}/save";
|
2023-12-07 09:05:24 -06:00
|
|
|
};
|
|
|
|
environment.persistence.ephemeral = {
|
2024-01-30 22:07:30 -06:00
|
|
|
persistentStoragePath = "${persist-dir}/ephemeral";
|
2023-12-07 09:05:24 -06:00
|
|
|
hideMounts = true;
|
2024-03-08 01:53:03 -06:00
|
|
|
directories = [ "/var/lib" "/etc/nixos" ];
|
2023-10-29 22:38:56 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-02-17 14:10:39 -06:00
|
|
|
in {
|
|
|
|
nixosConfigurations = {
|
|
|
|
orion = let hostname = "orion";
|
|
|
|
in nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = {
|
|
|
|
inherit self;
|
|
|
|
inherit inputs;
|
|
|
|
inherit hostname;
|
|
|
|
inherit lib;
|
|
|
|
inherit persist-dir;
|
|
|
|
root-disk = "/dev/vda";
|
2023-12-07 09:05:24 -06:00
|
|
|
};
|
2024-02-17 14:10:39 -06:00
|
|
|
modules = [
|
|
|
|
defaults
|
|
|
|
impermanence.nixosModules.impermanence
|
|
|
|
agenix.nixosModules.default
|
|
|
|
disko.nixosModules.disko
|
|
|
|
{
|
|
|
|
config = (import "${self}/secrets" {
|
|
|
|
agenix = false;
|
|
|
|
inherit lib;
|
|
|
|
}).${hostname};
|
|
|
|
}
|
|
|
|
./hosts/${hostname}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
luna = let hostname = "luna";
|
|
|
|
in nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = {
|
|
|
|
inherit self;
|
|
|
|
inherit blog;
|
|
|
|
inherit flake-utils;
|
|
|
|
inherit inputs;
|
|
|
|
inherit hostname;
|
|
|
|
inherit nixpkgs;
|
|
|
|
inherit lib;
|
|
|
|
inherit persist-dir;
|
|
|
|
root-disk = "/dev/nvme0n1";
|
|
|
|
fqdn = "orion-technologies.io";
|
|
|
|
};
|
|
|
|
modules = [
|
|
|
|
defaults
|
|
|
|
impermanence.nixosModules.impermanence
|
|
|
|
agenix.nixosModules.default
|
|
|
|
disko.nixosModules.disko
|
|
|
|
{
|
|
|
|
config = (import "${self}/secrets" {
|
|
|
|
agenix = false;
|
|
|
|
inherit lib;
|
|
|
|
}).${hostname};
|
|
|
|
}
|
|
|
|
./hosts/${hostname}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2023-12-07 09:05:24 -06:00
|
|
|
|
2024-02-17 14:10:39 -06:00
|
|
|
deploy.nodes = {
|
|
|
|
orion = {
|
|
|
|
hostname = "boot";
|
|
|
|
fastConnection = true;
|
|
|
|
profiles.system = {
|
|
|
|
sshUser = "price";
|
|
|
|
user = "root";
|
|
|
|
path = deploy-rs.lib.x86_64-linux.activate.nixos
|
|
|
|
self.nixosConfigurations.orion;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
luna = {
|
|
|
|
hostname = "luna.hosts.orion-technologies.io";
|
|
|
|
fastConnection = true;
|
|
|
|
profiles.system = {
|
|
|
|
sshUser = "price";
|
|
|
|
user = "root";
|
|
|
|
path = deploy-rs.lib.x86_64-linux.activate.nixos
|
|
|
|
self.nixosConfigurations.luna;
|
2024-01-30 22:07:30 -06:00
|
|
|
};
|
|
|
|
};
|
2024-02-17 14:10:39 -06:00
|
|
|
};
|
2024-01-30 22:07:30 -06:00
|
|
|
|
2023-12-07 09:05:24 -06:00
|
|
|
} // flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [ agenix.overlays.default ];
|
|
|
|
};
|
2024-02-17 14:10:39 -06:00
|
|
|
in {
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
|
|
packages = with pkgs; [
|
|
|
|
age
|
|
|
|
age-plugin-yubikey
|
|
|
|
pkgs.agenix
|
|
|
|
nixos-rebuild
|
|
|
|
pkgs.deploy-rs
|
|
|
|
];
|
|
|
|
shellHook = ''
|
|
|
|
export RULES="$PWD/secrets/secrets.nix"
|
|
|
|
nix eval --json --file ./.nixd.nix > .nixd.json
|
|
|
|
'';
|
|
|
|
};
|
2023-12-07 09:05:24 -06:00
|
|
|
});
|
2024-03-14 03:51:03 -05:00
|
|
|
}
|