xin/flake.nix

433 lines
13 KiB
Nix
Raw Normal View History

2022-08-25 12:21:35 -06:00
{
description = "xin";
2022-08-25 12:21:35 -06:00
inputs = {
2022-10-29 11:00:07 -06:00
unstable.url = "github:NixOS/nixpkgs";
2022-08-27 07:45:25 -06:00
unstableSmall.url = "github:NixOS/nixpkgs/nixos-unstable-small";
2024-05-31 07:51:16 -06:00
stable.url = "github:NixOS/nixpkgs/nixos-24.05-small";
2023-05-25 12:14:37 -06:00
2024-06-24 08:03:31 -06:00
lix-module = {
2024-08-12 21:39:56 -06:00
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz";
2024-06-24 08:03:31 -06:00
inputs.nixpkgs.follows = "unstable";
};
2022-12-28 14:42:00 -07:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs = {
nixpkgs-stable.follows = "stable";
nixpkgs.follows = "unstable";
};
};
xin-secrets = {
url = "git+ssh://xin-secrets-ro/qbit/xin-secrets.git?ref=main";
inputs = {
sops-nix.follows = "sops-nix";
stable.follows = "stable";
unstable.follows = "unstable";
};
};
emacs-overlay = {
url = "github:nix-community/emacs-overlay";
inputs = {
nixpkgs.follows = "unstable";
nixpkgs-stable.follows = "stable";
};
};
2022-08-25 12:21:35 -06:00
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
};
simple-nixos-mailserver = {
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.05";
inputs = {
nixpkgs.follows = "stable";
};
};
2023-11-28 14:27:18 -07:00
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
mcchunkie = {
url = "github:qbit/mcchunkie";
inputs.nixpkgs.follows = "unstable";
};
2022-11-16 20:28:42 -07:00
microca = {
url = "github:qbit/microca";
inputs.nixpkgs.follows = "unstable";
};
gostart = {
url = "github:qbit/gostart";
2023-09-20 09:50:24 -06:00
inputs.nixpkgs.follows = "unstable";
2022-11-25 07:50:55 -07:00
};
2024-03-26 20:35:56 -06:00
kogs = {
url = "github:qbit/kogs";
inputs.nixpkgs.follows = "unstable";
};
2023-05-23 06:30:07 -06:00
pr-status = {
url = "github:qbit/pr-status-pl";
inputs.nixpkgs.follows = "stable";
};
2022-11-16 20:28:42 -07:00
xintray = {
url = "github:qbit/xintray";
inputs.nixpkgs.follows = "unstable";
};
2024-01-03 13:00:36 -07:00
beyt = {
url = "github:qbit/beyt";
inputs.nixpkgs.follows = "unstable";
};
2022-11-16 20:28:42 -07:00
tsvnstat = {
2022-12-10 09:52:32 -07:00
url = "github:qbit/tsvnstat";
2022-11-16 20:28:42 -07:00
inputs.nixpkgs.follows = "unstable";
};
pots = {
url = "github:qbit/pots";
inputs.nixpkgs.follows = "unstable";
};
2023-01-29 06:11:36 -07:00
po = {
url = "github:qbit/po";
inputs.nixpkgs.follows = "unstable";
};
2024-08-23 13:33:46 -06:00
tsns = {
url = "github:qbit/tsns";
inputs.nixpkgs.follows = "unstable";
};
2024-06-28 09:48:05 -06:00
ts-reverse-proxy = {
2023-01-31 12:55:24 -07:00
url = "github:qbit/ts-reverse-proxy";
inputs.nixpkgs.follows = "unstable";
};
traygent = {
url = "github:qbit/traygent";
inputs.nixpkgs.follows = "unstable";
};
2022-08-25 12:21:35 -06:00
gqrss = {
url = "github:qbit/gqrss";
flake = false;
};
};
2023-09-12 08:44:05 -06:00
outputs =
{ self
, beyt
2023-09-12 08:44:05 -06:00
, darwin
, emacs-overlay
2023-09-12 08:44:05 -06:00
, gostart
2024-03-26 20:35:56 -06:00
, kogs
, lix-module
, mcchunkie
, microca
, nixos-hardware
2023-09-12 08:44:05 -06:00
, po
, pots
, pr-status
, simple-nixos-mailserver
2023-09-12 08:44:05 -06:00
, stable
, traygent
, ts-reverse-proxy
2024-08-23 13:33:46 -06:00
, tsns
2023-09-12 08:44:05 -06:00
, tsvnstat
, unstable
, unstableSmall
, xin-secrets
, xintray
, ...
} @ inputs:
let
xinlib = import ./lib {
inherit (unstable) lib;
inherit inputs;
};
2023-09-12 08:44:05 -06:00
supportedSystems = [ "x86_64-linux" ];
#[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = unstable.lib.genAttrs supportedSystems;
unstablePkgsFor = forAllSystems (system:
import unstable {
inherit system;
});
stablePkgsFor = forAllSystems (system:
import stable {
inherit system;
#imports = [ ./overlays ];
});
hostBase = {
2023-07-11 09:12:50 -06:00
modules = [
2023-09-12 08:44:05 -06:00
# Common config stuffs
(import ./default.nix)
2022-08-25 12:21:35 -06:00
xin-secrets.nixosModules.sops
2023-09-12 08:44:05 -06:00
xin-secrets.nixosModules.xin-secrets
2024-06-24 08:03:31 -06:00
lix-module.nixosModules.default
ts-reverse-proxy.nixosModule
2024-08-23 13:33:46 -06:00
tsns.nixosModule
2022-08-25 12:21:35 -06:00
];
};
2023-09-12 08:44:05 -06:00
overlays = [
emacs-overlay.overlay
gostart.overlay
kogs.overlay
mcchunkie.overlay
microca.overlay
pots.overlay
pr-status.overlay
ts-reverse-proxy.overlay
2024-08-23 13:33:46 -06:00
tsns.overlay
2023-09-12 08:44:05 -06:00
];
buildSys = sys: sysBase: extraMods: name:
sysBase.lib.nixosSystem {
system = sys;
specialArgs = {
inherit inputs;
inherit xinlib;
};
modules =
hostBase.modules
++ extraMods
++ [
{
nix = {
registry = {
nixpkgs.flake = sysBase;
stable.flake = stable;
unstable.flake = unstable;
};
nixPath = [ "nixpkgs=${sysBase}" ];
};
}
]
++ [ (xinlib.buildVer self) (./. + "/hosts/${name}") ]
++ [{ nixpkgs.overlays = overlays; }];
2022-08-25 12:21:35 -06:00
};
2023-09-12 08:44:05 -06:00
lpkgs = unstable.legacyPackages.x86_64-linux;
darwinPkgs = unstableSmall.legacyPackages.aarch64-darwin;
in
{
darwinConfigurations = {
plq = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = { inherit xinlib; };
modules = [
./overlays
./hosts/plq
];
2022-08-25 12:21:35 -06:00
};
2023-07-11 09:12:50 -06:00
};
2022-08-25 12:21:35 -06:00
2023-09-12 08:44:05 -06:00
# Expose all of the overlays to unstable so we can test build
# everything before deploying
legacyPackages.x86_64-linux = import unstable {
2023-07-11 09:12:50 -06:00
system = "x86_64-linux";
2023-09-12 08:44:05 -06:00
overlays =
let
overlayFn = import ./overlays;
stableList = overlayFn {
isUnstable = true;
inherit xinlib;
};
unstableList = overlayFn {
isUnstable = false;
inherit xinlib;
};
in
stableList.nixpkgs.overlays ++ unstableList.nixpkgs.overlays;
};
2022-08-25 12:21:35 -06:00
2023-09-12 08:44:05 -06:00
formatter.x86_64-linux = stable.legacyPackages.x86_64-linux.nixpkgs-fmt;
formatter.aarch64-darwin = stable.legacyPackages.aarch64-darwin.nixpkgs-fmt;
devShells.x86_64-linux.default = xinlib.buildShell lpkgs;
devShells.aarch64-darwin.default = xinlib.buildShell darwinPkgs;
nixosConfigurations = {
europa = buildSys "x86_64-linux" unstable [
2024-04-15 15:18:00 -06:00
nixos-hardware.nixosModules.framework-13-7040-amd
] "europa";
2024-01-18 12:45:27 -07:00
clunk = buildSys "x86_64-linux" unstable [ ] "clunk";
tv = buildSys "x86_64-linux" unstable [
2024-05-27 21:12:29 -06:00
nixos-hardware.nixosModules.framework-11th-gen-intel
] "tv";
2024-02-04 19:30:52 -07:00
orcim = buildSys "x86_64-linux" unstable [ ] "orcim";
2023-09-12 08:44:05 -06:00
pwntie = buildSys "x86_64-linux" stable [ ] "pwntie";
2023-12-28 07:11:16 -07:00
stan = buildSys "x86_64-linux" unstable [
nixos-hardware.nixosModules.framework-11th-gen-intel
] "stan";
2023-12-06 13:33:22 -07:00
weather = buildSys "aarch64-linux" stable [ ] "weather";
retic = buildSys "aarch64-linux" stable [ ] "retic";
2023-09-12 08:44:05 -06:00
faf = buildSys "x86_64-linux" stable [ ./configs/hardened.nix ] "faf";
2023-12-13 08:07:19 -07:00
box = buildSys "x86_64-linux" unstable [ ./configs/hardened.nix ] "box";
2023-09-12 08:44:05 -06:00
h = buildSys "x86_64-linux" stable [
./configs/hardened.nix
gostart.nixosModule
mcchunkie.nixosModule
2024-03-26 20:35:56 -06:00
kogs.nixosModule
2023-09-12 08:44:05 -06:00
pots.nixosModule
pr-status.nixosModule
2023-11-28 14:27:18 -07:00
simple-nixos-mailserver.nixosModule
2023-09-12 08:44:05 -06:00
] "h";
#router =
# buildSys "x86_64-linux" stable [ ./configs/hardened.nix ] "router";
arm64Install = stable.lib.nixosSystem {
system = "aarch64-linux";
2023-09-12 08:44:05 -06:00
modules = [
{
_module.args.isUnstable = false;
}
2023-09-12 08:44:05 -06:00
(import ./installer.nix)
xin-secrets.nixosModules.sops
2023-07-11 09:12:50 -06:00
"${stable}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix"
];
};
2023-09-12 08:44:05 -06:00
isoInstall = stable.lib.nixosSystem {
system = "x86_64-linux";
2023-09-12 08:44:05 -06:00
modules = [
{
_module.args.isUnstable = false;
}
(xinlib.buildVer self)
(import ./installer.nix)
xin-secrets.nixosModules.sops
2023-09-12 08:44:05 -06:00
"${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
2023-09-12 08:44:05 -06:00
packages = forAllSystems (system:
let
upkgs = unstablePkgsFor.${system};
spkgs = stablePkgsFor.${system};
in
{
rtlamr = spkgs.callPackage ./pkgs/rtlamr.nix { inherit spkgs; };
gqrss = spkgs.callPackage ./pkgs/gqrss.nix {
inherit spkgs;
isUnstable = true;
};
icbirc = spkgs.callPackage ./pkgs/icbirc.nix {
inherit spkgs;
isUnstable = true;
};
ttfs = upkgs.callPackage ./pkgs/ttfs.nix { };
2024-08-09 12:35:20 -06:00
intiface-engine = upkgs.callPackage ./pkgs/intiface-engine.nix { };
2023-09-12 08:44:05 -06:00
flake-warn =
spkgs.callPackage ./pkgs/flake-warn.nix { inherit spkgs; };
gen-patches =
spkgs.callPackage ./bins/gen-patches.nix { inherit spkgs; };
yarr = spkgs.callPackage ./pkgs/yarr.nix {
inherit spkgs;
isUnstable = true;
};
precursorupdater = spkgs.python3Packages.callPackage ./pkgs/precursorupdater.nix {
inherit spkgs;
};
2024-07-17 07:41:42 -06:00
watchmap = spkgs.python3Packages.callPackage ./pkgs/watchmap.nix {
inherit spkgs;
};
2023-09-12 08:44:05 -06:00
rtlamr2mqtt = spkgs.python3Packages.callPackage ./pkgs/rtlamr2mqtt.nix {
inherit spkgs;
};
kobuddy = upkgs.python3Packages.callPackage ./pkgs/kobuddy.nix {
inherit upkgs;
};
ghexport = upkgs.python3Packages.callPackage ./pkgs/ghexport.nix {
inherit upkgs;
};
hpi =
upkgs.python3Packages.callPackage ./pkgs/hpi.nix { inherit upkgs; };
openevse =
upkgs.python312Packages.callPackage ./pkgs/openevse.nix { inherit upkgs; };
2024-07-24 08:19:37 -06:00
ble-serial =
upkgs.python312Packages.callPackage ./pkgs/ble-serial.nix { inherit upkgs; };
promnesia = upkgs.python3Packages.callPackage ./pkgs/promnesia.nix {
inherit upkgs;
};
2023-09-12 08:44:05 -06:00
sliding-sync =
spkgs.callPackage ./pkgs/sliding-sync.nix { inherit spkgs; };
gokrazy = upkgs.callPackage ./pkgs/gokrazy.nix { inherit upkgs; };
gosignify = spkgs.callPackage ./pkgs/gosignify.nix { inherit spkgs; };
gotosocial =
spkgs.callPackage ./pkgs/gotosocial.nix { inherit spkgs; };
zutty = upkgs.callPackage ./pkgs/zutty.nix {
inherit upkgs;
};
mvoice = upkgs.callPackage ./pkgs/mvoice.nix {
inherit upkgs;
};
2023-09-12 08:44:05 -06:00
inherit (xintray.packages.${system}) xintray;
2024-01-03 13:00:36 -07:00
inherit (beyt.packages.${system}) beyt;
2023-09-12 08:44:05 -06:00
inherit (tsvnstat.packages.${system}) tsvnstat;
inherit (pots.packages.${system}) pots;
inherit (po.packages.${system}) po;
2024-06-28 09:48:05 -06:00
inherit (ts-reverse-proxy.packages.${system}) ts-reverse-proxy;
2024-08-23 13:33:46 -06:00
inherit (tsns.packages.${system}) tsns;
inherit (traygent.packages.${system}) traygent;
2023-09-12 08:44:05 -06:00
inherit (spkgs) matrix-synapse;
xin = upkgs.callPackage ./bins/xin { inherit upkgs; };
openssh = upkgs.callPackage ./pkgs/openssh.nix { inherit upkgs; };
2023-09-12 08:44:05 -06:00
});
templates = {
2024-08-19 11:49:56 -06:00
"shell" = {
path = ./templates/shell;
description = "A bare bones shell template.";
};
2023-09-12 08:44:05 -06:00
"ada" = {
path = ./templates/ada;
description = "Ada template.";
};
"go" = {
path = ./templates/go;
description = "Go template.";
};
2024-01-02 18:27:25 -07:00
"go-fyne" = {
path = ./templates/go-fyne;
2024-08-19 11:49:56 -06:00
description = "Go + fyne template.";
};
"go-fyne-shell" = {
path = ./templates/go-fyne;
description = "Go + fyne template for shell usage.";
2024-01-02 18:27:25 -07:00
};
2023-09-12 08:44:05 -06:00
"perl" = {
path = ./templates/perl;
description = "Perl template.";
};
"mojo" = {
path = ./templates/mojo;
description = "Perl MojoLicious template.";
};
"ocaml" = {
path = ./templates/ocaml;
description = "OCaml template.";
};
2023-07-11 09:12:50 -06:00
};
2023-09-12 08:44:05 -06:00
checks =
let
2024-09-30 06:04:18 -06:00
buildList = [ "europa" "stan" "h" "box" "orcim" "tv" "retic" ];
2023-09-12 08:44:05 -06:00
in
with unstable.lib;
foldl' recursiveUpdate { } (mapAttrsToList
(name: system: {
2023-07-11 09:12:50 -06:00
"${system.pkgs.stdenv.hostPlatform.system}"."${name}" =
system.config.system.build.toplevel;
2023-09-12 08:44:05 -06:00
})
(filterAttrs (n: _: (builtins.elem n buildList))
2023-07-11 09:12:50 -06:00
self.nixosConfigurations));
2023-09-12 08:44:05 -06:00
};
2022-08-25 12:21:35 -06:00
}