xin/flake.nix

287 lines
8.7 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-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";
2022-11-22 21:30:31 -07:00
oldStable.url = "github:NixOS/nixpkgs/nixos-22.05-small";
stable.url = "github:NixOS/nixpkgs/nixos-22.11-small";
2022-09-01 11:49:36 -06:00
nixos-hardware = { url = "github:NixOS/nixos-hardware/master"; };
reform = { url = "github:nix-community/hardware-mnt-reform"; };
2022-08-25 12:21:35 -06:00
emacs-overlay = {
url =
2022-11-28 05:55:41 -07:00
"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
};
sshKnownHosts = {
url = "github:qbit/ssh_known_hosts";
flake = false;
};
2022-11-16 20:28:42 -07:00
microca = {
url = "github:qbit/microca";
inputs.nixpkgs.follows = "unstable";
};
gostart = {
url = "github:qbit/gostart";
2022-11-25 07:50:55 -07:00
inputs.nixpkgs.follows = "unstable";
};
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-11-23 10:43:11 -07:00
url = "github:qbit/tsvnstat/04b11abad8299ab40c74ccd837f02a81629eea84";
2022-11-16 20:28:42 -07:00
inputs.nixpkgs.follows = "unstable";
};
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
};
2022-11-22 21:30:31 -07:00
outputs = { self, unstable, unstableSmall, stable, oldStable, nixos-hardware
, reform, sshKnownHosts, microca, gostart, xintray, tsvnstat, taskobs
2022-11-25 07:50:55 -07:00
, mcchunkie, gqrss, darwin, xin-secrets, peerix, ... }@inputs:
2022-08-25 12:21:35 -06:00
let
2022-10-12 07:13:52 -06:00
supportedSystems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = unstable.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import unstable { inherit system; });
2022-08-25 12:21:35 -06:00
hostBase = {
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 = [
2022-11-16 20:24:40 -07:00
inputs.emacs-overlay.overlay
inputs.peerix.overlay
inputs.microca.overlay
inputs.taskobs.overlay
2022-11-22 21:30:31 -07:00
inputs.reform.overlay
inputs.gostart.overlay
2022-09-04 08:04:56 -06:00
];
2022-08-25 12:21:35 -06:00
# Set our configurationRevison based on the status of our git repo.
# If the repo is dirty, disable autoUpgrade as it means we are
# testing something.
buildVer = let state = self.rev or "DIRTY";
in {
system.configurationRevision = state;
2022-11-04 09:03:15 -06:00
system.autoUpgrade.enable = state != "DIRTY";
};
2022-08-25 12:21:35 -06:00
buildShell = pkgs:
pkgs.mkShell {
shellHook = ''
PS1='\u@\h:\w; '
( . ./common.sh; start ) || true;
2022-08-25 12:21:35 -06:00
'';
nativeBuildInputs = with pkgs; [
deadnix
git
2022-08-25 12:21:35 -06:00
go
jq
nil
2022-08-25 12:21:35 -06:00
nix-diff
2022-10-10 06:49:27 -06:00
shfmt
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;
specialArgs = { inherit inputs; };
2022-08-25 12:21:35 -06:00
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 = {
europa = buildSys "x86_64-linux" unstable
[ nixos-hardware.nixosModules.framework ] "europa";
2022-10-10 08:05:37 -06:00
stan = buildSys "x86_64-linux" unstable [ ] "stan";
2022-10-28 12:01:44 -06:00
weather = buildSys "aarch64-linux" stable
2022-10-10 08:05:37 -06:00
[ 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";
2022-09-14 14:37:51 -06:00
luna = buildSys "x86_64-linux" stable
[ "${nixos-hardware}/common/cpu/intel" ] "luna";
h = buildSys "x86_64-linux" stable [
./configs/hardened.nix
gostart.nixosModule
] "h";
2022-10-04 21:57:49 -06:00
router =
buildSys "x86_64-linux" stable [ ./configs/hardened.nix ] "router";
2022-08-25 12:21:35 -06:00
2022-10-28 12:01:44 -06:00
weatherInstall = stable.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"
];
};
2022-11-22 21:30:31 -07:00
reformInstall = oldStable.lib.nixosSystem {
system = "aarch64-linux";
modules = [
reform.nixosModule
(import (./installer.nix))
xin-secrets.nixosModules.sops
(import "${sshKnownHosts}")
"${reform}/nixos/installer.nix"
];
};
2022-08-25 12:21:35 -06:00
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-10-12 07:13:52 -06:00
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in {
ada_language_server =
pkgs.callPackage ./pkgs/ada_language_server.nix { inherit pkgs; };
2022-10-20 07:46:44 -06:00
alire = pkgs.callPackage ./pkgs/alire.nix { inherit pkgs; };
gqrss = pkgs.callPackage ./pkgs/gqrss.nix {
inherit pkgs;
isUnstable = true;
};
icbirc = pkgs.callPackage ./pkgs/icbirc.nix {
inherit pkgs;
isUnstable = true;
};
2022-11-28 21:36:55 -07:00
kurinto = pkgs.callPackage ./pkgs/kurinto.nix { };
mcchunkie = pkgs.callPackage ./pkgs/mcchunkie.nix {
inherit pkgs;
isUnstable = true;
};
yarr = pkgs.callPackage ./pkgs/yarr.nix {
inherit pkgs;
isUnstable = true;
};
2022-12-02 15:01:05 -07:00
precursorupdater = pkgs.callPackage ./pkgs/precursorupdater.nix {
inherit pkgs;
inherit (pkgs.python39Packages) buildPythonPackage;
inherit (pkgs.python39Packages) fetchPypi;
inherit (pkgs.python39Packages) pyusb;
inherit (pkgs.python39Packages) progressbar2;
inherit (pkgs.python39Packages) requests;
};
golink = pkgs.callPackage ./pkgs/golink.nix { inherit pkgs; };
2022-10-17 11:12:01 -06:00
gosignify = pkgs.callPackage ./pkgs/gosignify.nix { inherit pkgs; };
2022-11-29 06:24:55 -07:00
gotosocial = pkgs.callPackage ./pkgs/gotosocial.nix { inherit pkgs; };
2022-11-01 10:35:42 -06:00
govulncheck =
pkgs.callPackage ./pkgs/govulncheck.nix { inherit pkgs; };
zutty = pkgs.callPackage ./pkgs/zutty.nix {
inherit pkgs;
isUnstable = true;
};
2022-11-16 15:00:30 -07:00
inherit (xintray.packages.${system}) xintray;
2022-11-16 20:24:40 -07:00
inherit (tsvnstat.packages.${system}) tsvnstat;
2022-10-12 07:13:52 -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-09-23 16:33:22 -06:00
templates."perl" = {
path = ./templates/perl;
description = "Perl template.";
};
2022-09-27 17:33:33 -06:00
templates."mojo" = {
path = ./templates/mojo;
description = "Perl MojoLicious template.";
};
2022-10-05 21:46:32 -06:00
templates."ocaml" = {
path = ./templates/ocaml;
description = "OCaml template.";
};
2022-08-25 12:21:35 -06:00
};
}