xin/flake.nix

180 lines
4.9 KiB
Nix
Raw Normal View History

2022-08-25 12:21:35 -06:00
{
description = "bold.daemon";
inputs = {
xin-secrets = {
2022-08-25 21:23:58 -06:00
url = "git+ssh://xin-secrets-ro/qbit/xin-secrets.git?ref=main";
2022-08-25 12:21:35 -06:00
};
2022-09-10 12:22:22 -06:00
unstable.url = "github:NixOS/nixpkgs";
2022-08-27 07:45:25 -06:00
unstableSmall.url = "github:NixOS/nixpkgs/nixos-unstable-small";
2022-08-25 12:21:35 -06:00
stable.url = "github:NixOS/nixpkgs/nixos-22.05-small";
2022-09-01 11:49:36 -06:00
nixos-hardware = { url = "github:NixOS/nixos-hardware/master"; };
2022-08-25 12:21:35 -06:00
emacs-overlay = {
2022-08-30 15:58:26 -06:00
url = "github:nix-community/emacs-overlay";
2022-08-25 12:21:35 -06:00
inputs.nixpkgs.follows = "stable";
};
darwin = {
url = "github:lnl7/nix-darwin";
2022-09-09 10:37:15 -06:00
inputs.nixpkgs.follows = "unstableSmall";
2022-08-25 12:21:35 -06:00
};
sshKnownHosts = {
url = "github:qbit/ssh_known_hosts";
flake = false;
};
2022-09-04 07:45:09 -06:00
microca = { url = "github:qbit/microca"; };
2022-08-25 12:21:35 -06:00
mcchunkie = {
url = "github:qbit/mcchunkie";
flake = false;
};
gqrss = {
url = "github:qbit/gqrss";
flake = false;
};
2022-08-30 15:56:37 -06:00
peerix = {
url = "github:cid-chan/peerix";
inputs.nixpkgs.follows = "stable";
};
2022-08-25 12:21:35 -06:00
};
outputs = { self, unstable, unstableSmall, stable, nixos-hardware
2022-08-30 15:56:37 -06:00
, sshKnownHosts, microca, mcchunkie, gqrss, darwin, xin-secrets, peerix, ...
}@flakes:
2022-08-25 12:21:35 -06:00
let
hostBase = {
2022-08-30 15:56:37 -06:00
overlays = [
flakes.emacs-overlay.overlay
flakes.peerix.overlay
2022-09-04 08:04:56 -06:00
flakes.microca.overlay
2022-08-30 15:56:37 -06:00
];
2022-08-25 12:21:35 -06:00
modules = [
# Common config stuffs
(import (./default.nix))
(import "${sshKnownHosts}")
xin-secrets.nixosModules.sops
xin-secrets.nixosModules.xin-secrets
2022-08-31 08:00:21 -06:00
peerix.nixosModules.peerix
2022-08-25 12:21:35 -06:00
];
};
2022-09-04 08:04:56 -06:00
overlays = [
flakes.emacs-overlay.overlay
flakes.peerix.overlay
flakes.microca.overlay
];
2022-08-25 12:21:35 -06:00
buildVer = { system.configurationRevision = self.rev or "DIRTY"; };
buildShell = pkgs:
pkgs.mkShell {
shellHook = ''
PS1='\u@\h:\w; '
( . ./common.sh; start )
2022-08-25 12:21:35 -06:00
'';
nativeBuildInputs = with pkgs; [
git
2022-08-25 12:21:35 -06:00
go
jq
nix-diff
sops
2022-08-25 12:21:35 -06:00
ssh-to-age
ssh-to-pgp
statix
tree
2022-08-25 12:21:35 -06:00
];
};
buildSys = sys: sysBase: extraMods: name:
sysBase.lib.nixosSystem {
system = sys;
modules = hostBase.modules ++ extraMods ++ [{
nix = {
registry.nixpkgs.flake = sysBase;
nixPath = [ "nixpkgs=${sysBase}" ];
};
}] ++ [ buildVer (./. + "/hosts/${name}") ]
++ [{ nixpkgs.overlays = overlays; }];
};
pkgs = unstable.legacyPackages.x86_64-linux;
2022-09-09 09:56:41 -06:00
darwinPkgs = unstableSmall.legacyPackages.aarch64-darwin;
2022-08-25 12:21:35 -06:00
in {
darwinConfigurations = {
plq = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
xin-secrets.nixosModules.sops
(import "${sshKnownHosts}")
./overlays
./hosts/plq
];
};
};
2022-09-01 11:49:36 -06:00
formatter.x86_64-linux = stable.legacyPackages.x86_64-linux.nixfmt;
formatter.aarch64-darwin = stable.legacyPackages.aarch64-darwin.nixfmt;
2022-08-25 12:21:35 -06:00
devShells.x86_64-linux.default = buildShell pkgs;
devShells.aarch64-darwin.default = buildShell darwinPkgs;
nixosConfigurations = {
box = buildSys "x86_64-linux" stable [ ] "box";
europa = buildSys "x86_64-linux" unstable [ ] "europa";
2022-08-25 12:21:35 -06:00
faf = buildSys "x86_64-linux" stable [ ] "faf";
2022-09-08 11:29:46 -06:00
hass = buildSys "x86_64-linux" stable
[ "${nixos-hardware}/common/cpu/intel" ] "hass";
2022-09-14 14:37:51 -06:00
luna = buildSys "x86_64-linux" stable
[ "${nixos-hardware}/common/cpu/intel" ] "luna";
2022-08-29 09:49:37 -06:00
h = buildSys "x86_64-linux" unstableSmall [ ] "h";
stan = buildSys "x86_64-linux" unstable
[ nixos-hardware.nixosModules.framework ] "stan";
2022-09-22 13:18:24 -06:00
weather = buildSys "aarch64-linux" unstable
2022-08-25 12:21:35 -06:00
[ nixos-hardware.nixosModules.raspberry-pi-4 ] "weather";
2022-09-22 13:18:24 -06:00
weatherInstall = unstable.lib.nixosSystem {
2022-08-25 12:21:35 -06:00
system = "aarch64-linux";
modules = [
(import (./installer.nix))
xin-secrets.nixosModules.sops
(import "${sshKnownHosts}")
"${stable}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix"
];
};
isoInstall = stable.lib.nixosSystem {
system = "x86_64-linux";
modules = [
buildVer
(import (./installer.nix))
xin-secrets.nixosModules.sops
(import "${sshKnownHosts}")
"${stable}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix"
2022-08-25 12:21:35 -06:00
];
};
};
2022-09-06 13:49:01 -06:00
2022-09-19 07:05:32 -06:00
templates."ada" = {
path = ./templates/ada;
description = "Ada template.";
};
2022-09-06 13:49:01 -06:00
templates."go" = {
path = ./templates/go;
description = "Go template.";
};
2022-08-25 12:21:35 -06:00
};
}