xin/flake.nix

167 lines
4.5 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-29 09:49:37 -06:00
inputs.nixpkgs.follows = "stable";
2022-08-25 12:21:35 -06:00
};
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
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";
nixos-hardware = {
url = "github:NixOS/nixos-hardware/master";
inputs.nixpkgs.follows = "unstable";
inputs.nixpkgs-22_05.follows = "stable";
};
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";
inputs.nixpkgs.follows = "stable";
};
sshKnownHosts = {
url = "github:qbit/ssh_known_hosts";
flake = false;
};
microca = {
url = "github:qbit/microca";
flake = false;
};
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-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-30 15:56:37 -06:00
overlays = [ flakes.emacs-overlay.overlay flakes.peerix.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; '
'';
nativeBuildInputs = with pkgs; [
git
2022-08-25 12:21:35 -06:00
go
jq
nix-diff
nixfmt
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;
darwinPkgs = unstable.legacyPackages.aarch64-darwin;
in {
darwinConfigurations = {
plq = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
xin-secrets.nixosModules.sops
(import "${sshKnownHosts}")
./overlays
./hosts/plq
];
};
};
devShells.x86_64-linux.default = buildShell pkgs;
devShells.aarch64-darwin.default = buildShell darwinPkgs;
nixosConfigurations = {
box = buildSys "x86_64-linux" stable [ ] "box";
2022-08-30 15:56:37 -06:00
europa = buildSys "x86_64-linux" unstable [ peerix.nixosModules.peerix ]
"europa";
2022-08-25 12:21:35 -06:00
faf = buildSys "x86_64-linux" stable [ ] "faf";
hass = buildSys "x86_64-linux" stable [ ] "hass";
2022-08-29 09:49:37 -06:00
h = buildSys "x86_64-linux" unstableSmall [ ] "h";
2022-08-29 10:04:36 -06:00
stan = buildSys "x86_64-linux" stable [
nixos-hardware.nixosModules.framework
2022-08-30 15:56:37 -06:00
peerix.nixosModules.peerix
2022-08-29 10:04:36 -06:00
] "stan";
2022-08-25 12:21:35 -06:00
weather = buildSys "aarch64-linux" stable
[ nixos-hardware.nixosModules.raspberry-pi-4 ] "weather";
weatherInstall = stable.lib.nixosSystem {
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
];
};
};
};
}