2021-12-30 16:19:49 +01:00
|
|
|
{
|
|
|
|
|
description = "niveum: packages, modules, systems";
|
|
|
|
|
|
|
|
|
|
inputs = {
|
2022-02-15 22:16:50 +01:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
|
2021-12-30 16:19:49 +01:00
|
|
|
nixpkgs-unstable.url = "github:NixOS/nixpkgs/master";
|
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
|
home-manager = {
|
|
|
|
|
url = "github:nix-community/home-manager/release-21.11";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
|
|
|
|
krops = {
|
|
|
|
|
url = "github:Mic92/krops";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2021-12-30 16:59:58 +01:00
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
2021-12-30 16:19:49 +01:00
|
|
|
};
|
2021-12-31 16:57:45 +01:00
|
|
|
|
2021-12-31 17:26:15 +01:00
|
|
|
# legacy
|
2022-03-10 21:52:12 +01:00
|
|
|
menstruation-backend = {
|
|
|
|
|
url = "github:kmein/menstruation.rs";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
menstruation-telegram = {
|
|
|
|
|
url = "github:kmein/menstruation-telegram";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
nix-writers = {
|
|
|
|
|
url = "git+https://cgit.krebsco.de/nix-writers";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
recht = {
|
|
|
|
|
url = "github:kmein/recht";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
retiolum = {
|
|
|
|
|
url = "github:krebs/retiolum";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
scripts = {
|
|
|
|
|
url = "github:kmein/scripts";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
stockholm = {
|
|
|
|
|
url = "git+https://cgit.lassul.us/stockholm";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
telebots = {
|
|
|
|
|
url = "github:kmein/telebots";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
tinc-graph = {
|
|
|
|
|
url = "github:kmein/tinc-graph";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
traadfri = {
|
|
|
|
|
url = "github:kmein/traadfri";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
tuna = {
|
|
|
|
|
url = "github:kmein/tuna";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
2021-12-30 16:19:49 +01:00
|
|
|
};
|
|
|
|
|
|
2022-03-10 21:52:12 +01:00
|
|
|
outputs = {
|
|
|
|
|
self,
|
|
|
|
|
flake-utils,
|
|
|
|
|
home-manager,
|
|
|
|
|
krops,
|
|
|
|
|
menstruation-backend,
|
|
|
|
|
menstruation-telegram,
|
|
|
|
|
nix-writers,
|
|
|
|
|
nixpkgs,
|
|
|
|
|
nixpkgs-unstable,
|
|
|
|
|
recht,
|
|
|
|
|
retiolum,
|
|
|
|
|
scripts,
|
|
|
|
|
stockholm,
|
|
|
|
|
telebots,
|
|
|
|
|
tinc-graph,
|
|
|
|
|
traadfri,
|
|
|
|
|
tuna,
|
|
|
|
|
} @ inputs: let
|
2021-12-30 16:19:49 +01:00
|
|
|
system = "x86_64-linux";
|
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2022-03-10 21:52:12 +01:00
|
|
|
source = name:
|
|
|
|
|
{
|
|
|
|
|
niveum.file = toString ./.;
|
|
|
|
|
nixos-config.symlink = "niveum/systems/${name}/configuration.nix";
|
|
|
|
|
system-secrets.pass = {
|
|
|
|
|
dir = toString ~/.password-store;
|
|
|
|
|
name = "systems/${name}";
|
|
|
|
|
};
|
|
|
|
|
secrets.pass = {
|
|
|
|
|
dir = toString ~/.password-store;
|
|
|
|
|
name = "shared";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
// nixpkgs.lib.mapAttrs' (name: value: {
|
|
|
|
|
inherit name;
|
|
|
|
|
value.file = toString value;
|
|
|
|
|
}) (nixpkgs.lib.filterAttrs (name: _: !builtins.elem name ["flake-utils" "krops" "self"]) inputs);
|
|
|
|
|
deployScriptFor = {
|
|
|
|
|
name,
|
|
|
|
|
host,
|
|
|
|
|
}: let
|
|
|
|
|
inherit (import ./lib/default.nix) sshPort;
|
|
|
|
|
in
|
|
|
|
|
toString (krops.packages.${system}.writeDeploy "deploy-${name}" {
|
|
|
|
|
source = krops.lib.evalSource [(source name)];
|
2022-03-29 00:21:16 +02:00
|
|
|
target = "root@${host}:${toString sshPort}";
|
2022-03-10 21:52:12 +01:00
|
|
|
});
|
2021-12-30 16:19:49 +01:00
|
|
|
in {
|
|
|
|
|
apps.${system} = let
|
2021-12-31 15:56:43 +01:00
|
|
|
forSystems = f: builtins.listToAttrs (map f (builtins.attrNames (builtins.readDir ./systems)));
|
2021-12-31 16:26:30 +01:00
|
|
|
deployScripts = forSystems (name: {
|
|
|
|
|
name = "deploy-${name}";
|
2021-12-30 16:19:49 +01:00
|
|
|
value = {
|
|
|
|
|
type = "app";
|
2022-03-10 21:52:12 +01:00
|
|
|
program = deployScriptFor {
|
|
|
|
|
inherit name;
|
2022-05-20 23:04:15 +02:00
|
|
|
host =
|
|
|
|
|
if name != "ful"
|
|
|
|
|
then "${name}.r"
|
|
|
|
|
else "130.61.209.15";
|
2022-03-10 21:52:12 +01:00
|
|
|
};
|
2021-12-30 16:19:49 +01:00
|
|
|
};
|
2021-12-31 15:56:43 +01:00
|
|
|
});
|
2021-12-31 16:05:08 +01:00
|
|
|
ciScripts = forSystems (name: {
|
|
|
|
|
name = "build-${name}";
|
2021-12-31 15:56:43 +01:00
|
|
|
value = {
|
|
|
|
|
type = "app";
|
2022-03-10 21:52:12 +01:00
|
|
|
program = import ./ci.nix {inherit name system inputs;};
|
2021-12-31 15:56:43 +01:00
|
|
|
};
|
|
|
|
|
});
|
2022-03-10 21:52:12 +01:00
|
|
|
in
|
|
|
|
|
deployScripts // ciScripts;
|
2021-12-30 16:19:49 +01:00
|
|
|
};
|
|
|
|
|
}
|