xin/flake.nix

359 lines
10 KiB
Nix
Raw Normal View History

2022-08-25 12:21:35 -06:00
{
description = "bold.daemon";
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";
2023-05-26 08:06:02 -06:00
#stable.url = "github:NixOS/nixpkgs/nixos-22.11-small";
stable.url = "github:NixOS/nixpkgs/nixos-23.05-small";
2023-05-25 12:14:37 -06:00
2022-12-28 14:42:00 -07:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs-stable.follows = "stable";
inputs.nixpkgs.follows = "unstable";
};
xin-secrets = {
url = "git+ssh://xin-secrets-ro/qbit/xin-secrets.git?ref=main";
inputs.sops-nix.follows = "sops-nix";
};
2023-07-11 09:12:50 -06:00
nixos-hardware = {url = "github:NixOS/nixos-hardware/master";};
2022-08-25 12:21:35 -06:00
emacs-overlay = {
2023-07-11 09:12:50 -06:00
url = "github:nix-community/emacs-overlay/d54a1521619daa37c9aa8c9e3362abb34e676007";
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
};
2022-11-16 20:28:42 -07:00
microca = {
url = "github:qbit/microca";
inputs.nixpkgs.follows = "unstable";
};
gostart = {
url = "github:qbit/gostart";
inputs.nixpkgs.follows = "stable";
2022-11-25 07:50:55 -07:00
};
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
taskobs = {
url = "github:qbit/taskobs";
inputs.nixpkgs.follows = "unstable";
};
xintray = {
url = "github:qbit/xintray";
inputs.nixpkgs.follows = "unstable";
};
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";
};
2023-01-31 12:55:24 -07:00
tsRevProx = {
url = "github:qbit/ts-reverse-proxy";
inputs.nixpkgs.follows = "unstable";
};
2022-08-25 12:21:35 -06:00
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
};
2023-07-11 09:12:50 -06:00
outputs = {
self,
darwin,
gostart,
nixos-hardware,
peerix,
po,
pots,
pr-status,
stable,
tsRevProx,
tsvnstat,
unstable,
unstableSmall,
xin-secrets,
xintray,
...
} @ inputs: let
xinlib = import ./lib {inherit (unstable) lib;};
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;
#imports = [ ./overlays ];
});
stablePkgsFor = forAllSystems (system:
import stable {
inherit system;
#imports = [ ./overlays ];
});
hostBase = {
modules = [
# Common config stuffs
(import ./default.nix)
xin-secrets.nixosModules.sops
xin-secrets.nixosModules.xin-secrets
peerix.nixosModules.peerix
];
};
2022-08-25 12:21:35 -06:00
2023-07-11 09:12:50 -06:00
overlays = [
inputs.emacs-overlay.overlay
inputs.gostart.overlay
inputs.microca.overlay
inputs.peerix.overlay
inputs.pots.overlay
inputs.pr-status.overlay
inputs.taskobs.overlay
inputs.tsRevProx.overlay
];
buildSys = sys: sysBase: extraMods: name:
sysBase.lib.nixosSystem {
system = sys;
specialArgs = {
inherit inputs;
inherit xinlib;
};
modules =
hostBase.modules
++ extraMods
++ [
{
nix = {
registry.nixpkgs.flake = sysBase;
registry.stable.flake = stable;
registry.unstable.flake = unstable;
nixPath = ["nixpkgs=${sysBase}"];
};
}
]
++ [(xinlib.buildVer self) (./. + "/hosts/${name}")]
++ [{nixpkgs.overlays = overlays;}];
};
lpkgs = unstable.legacyPackages.x86_64-linux;
darwinPkgs = unstableSmall.legacyPackages.aarch64-darwin;
in {
darwinConfigurations = {
plq = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {inherit xinlib;};
modules = [
2022-08-25 12:21:35 -06:00
xin-secrets.nixosModules.sops
2023-07-11 09:12:50 -06:00
./overlays
2022-08-31 08:00:21 -06:00
2023-07-11 09:12:50 -06:00
./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-07-11 09:12:50 -06:00
# Expose all of the overlays to unstable so we can test build
# everything before deploying
legacyPackages.x86_64-linux = import unstable {
system = "x86_64-linux";
overlays = let
overlayFn = import ./overlays;
stableList = overlayFn {
isUnstable = true;
inherit xinlib;
2022-08-25 12:21:35 -06:00
};
2023-07-11 09:12:50 -06:00
unstableList = overlayFn {
isUnstable = false;
inherit xinlib;
2022-08-25 12:21:35 -06:00
};
2023-07-11 09:12:50 -06:00
in
[] ++ stableList.nixpkgs.overlays ++ unstableList.nixpkgs.overlays;
};
2022-08-25 12:21:35 -06:00
2023-07-11 09:12:50 -06:00
formatter.x86_64-linux = stable.legacyPackages.x86_64-linux.alejandra;
formatter.aarch64-darwin = stable.legacyPackages.aarch64-darwin.alejandra;
devShells.x86_64-linux.default = xinlib.buildShell lpkgs;
devShells.aarch64-darwin.default = xinlib.buildShell darwinPkgs;
nixosConfigurations = {
europa = buildSys "x86_64-linux" unstable [
nixos-hardware.nixosModules.framework
] "europa";
pwntie = buildSys "x86_64-linux" stable [] "pwntie";
stan = buildSys "x86_64-linux" unstable [] "stan";
#weather = buildSys "aarch64-linux" stable
# [ nixos-hardware.nixosModules.raspberry-pi-4 ] "weather";
faf = buildSys "x86_64-linux" stable [./configs/hardened.nix] "faf";
box = buildSys "x86_64-linux" stable [./configs/hardened.nix] "box";
#luna = buildSys "x86_64-linux" stable
# [ "${nixos-hardware}/common/cpu/intel" ] "luna";
h = buildSys "x86_64-linux" stable [
./configs/hardened.nix
gostart.nixosModule
pots.nixosModule
pr-status.nixosModule
] "h";
#router =
# buildSys "x86_64-linux" stable [ ./configs/hardened.nix ] "router";
arm64Install = stable.lib.nixosSystem {
system = "aarch64-linux";
2023-06-20 12:45:15 -06:00
2023-07-11 09:12:50 -06:00
modules = [
(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"
];
};
2022-08-25 12:21:35 -06:00
2023-07-19 10:58:08 -06:00
weatherzero = buildSys "armv6l" stable [
"${stable}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix"
{
nixpkgs = {
buildPlatform = {
system = "x86_64-linux";
config = "x86_64-unknown-linux-gnu";
};
hostPlatform = {
system = "armv6l-linux";
config = "armv6l-unknown-linux-gnueabihf";
};
};
}
] "weatherzero";
2023-07-11 09:12:50 -06:00
isoInstall = stable.lib.nixosSystem {
system = "x86_64-linux";
2022-08-25 12:21:35 -06:00
2023-07-11 09:12:50 -06:00
modules = [
(xinlib.buildVer self)
(import ./installer.nix)
xin-secrets.nixosModules.sops
"${stable}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix"
];
2022-08-25 12:21:35 -06:00
};
2023-07-11 09:12:50 -06:00
};
2022-09-06 13:49:01 -06:00
2023-07-11 09:12:50 -06:00
packages = forAllSystems (system: let
upkgs = unstablePkgsFor.${system};
spkgs = stablePkgsFor.${system};
in {
ada_language_server =
spkgs.callPackage ./pkgs/ada_language_server.nix {inherit spkgs;};
alire = spkgs.callPackage ./pkgs/alire.nix {inherit spkgs;};
bearclaw = spkgs.callPackage ./pkgs/bearclaw.nix {inherit spkgs;};
clilol = spkgs.callPackage ./pkgs/clilol.nix {inherit spkgs;};
gqrss = spkgs.callPackage ./pkgs/gqrss.nix {
inherit spkgs;
isUnstable = true;
2022-09-19 07:05:32 -06:00
};
2023-07-11 09:12:50 -06:00
iamb = upkgs.callPackage ./pkgs/iamb.nix {};
icbirc = spkgs.callPackage ./pkgs/icbirc.nix {
inherit spkgs;
isUnstable = true;
2022-09-06 13:49:01 -06:00
};
2023-07-11 09:12:50 -06:00
femtolisp = upkgs.callPackage ./pkgs/femtolisp.nix {};
fyne = upkgs.callPackage ./pkgs/fyne.nix {inherit upkgs;};
flake-warn =
spkgs.callPackage ./pkgs/flake-warn.nix {inherit spkgs;};
2023-07-20 07:30:19 -06:00
#kurinto = spkgs.callPackage ./pkgs/kurinto.nix {};
2023-07-11 09:12:50 -06:00
mcchunkie = spkgs.callPackage ./pkgs/mcchunkie.nix {inherit spkgs;};
yaegi = spkgs.callPackage ./pkgs/yaegi.nix {inherit spkgs;};
gen-patches =
spkgs.callPackage ./bins/gen-patches.nix {inherit spkgs;};
yarr = spkgs.callPackage ./pkgs/yarr.nix {
inherit spkgs;
isUnstable = true;
2022-09-23 16:33:22 -06:00
};
2023-07-11 09:12:50 -06:00
precursorupdater = spkgs.python3Packages.callPackage ./pkgs/precursorupdater.nix {
inherit spkgs;
2022-09-27 17:33:33 -06:00
};
2023-07-11 09:12:50 -06:00
kobuddy = upkgs.python3Packages.callPackage ./pkgs/kobuddy.nix {
inherit upkgs;
2022-10-05 21:46:32 -06:00
};
2023-07-11 09:12:50 -06:00
ghexport = upkgs.python3Packages.callPackage ./pkgs/ghexport.nix {
inherit upkgs;
};
hpi =
upkgs.python3Packages.callPackage ./pkgs/hpi.nix {inherit upkgs;};
promnesia = upkgs.python3Packages.callPackage ./pkgs/promnesia.nix {
inherit upkgs;
};
sliding-sync =
spkgs.callPackage ./pkgs/sliding-sync.nix {inherit spkgs;};
golink = spkgs.callPackage ./pkgs/golink.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;
isUnstable = true;
};
inherit (xintray.packages.${system}) xintray;
inherit (tsvnstat.packages.${system}) tsvnstat;
inherit (pots.packages.${system}) pots;
inherit (po.packages.${system}) po;
inherit (tsRevProx.packages.${system}) ts-reverse-proxy;
inherit (spkgs) matrix-synapse;
});
templates."ada" = {
path = ./templates/ada;
description = "Ada template.";
};
templates."go" = {
path = ./templates/go;
description = "Go template.";
};
templates."perl" = {
path = ./templates/perl;
description = "Perl template.";
2022-08-25 12:21:35 -06:00
};
2023-07-11 09:12:50 -06:00
templates."mojo" = {
path = ./templates/mojo;
description = "Perl MojoLicious template.";
};
templates."ocaml" = {
path = ./templates/ocaml;
description = "OCaml template.";
};
checks = let
buildList = ["europa" "stan" "h" "box" "faf" "weatherzero"];
2023-07-11 09:12:50 -06:00
in
with unstable.lib;
foldl' recursiveUpdate {} (mapAttrsToList (name: system: {
"${system.pkgs.stdenv.hostPlatform.system}"."${name}" =
system.config.system.build.toplevel;
}) (filterAttrs (n: _: (builtins.elem n buildList))
self.nixosConfigurations));
};
2022-08-25 12:21:35 -06:00
}