2021-12-30 16:19:49 +01:00
|
|
|
{
|
|
|
|
|
description = "niveum: packages, modules, systems";
|
|
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/release-21.11";
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
stockholm = {
|
|
|
|
|
url = "git+https://cgit.lassul.us/stockholm";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
nix-writers = {
|
|
|
|
|
url = "git+https://cgit.krebsco.de/nix-writers";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
retiolum = {
|
|
|
|
|
url = "github:krebs/retiolum";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
2021-12-31 16:57:45 +01:00
|
|
|
|
|
|
|
|
menstruation-telegram = { url = "github:kmein/menstruation-telegram"; flake = false; };
|
|
|
|
|
traadfri = { url = "github:kmein/traadfri"; flake = false; };
|
|
|
|
|
menstruation-backend = { url = "github:kmein/menstruation.rs"; flake = false; };
|
|
|
|
|
telebots = { url = "github:kmein/telebots"; flake = false; };
|
|
|
|
|
recht = { url = "github:kmein/recht"; flake = false; };
|
|
|
|
|
tuna = { url = "github:kmein/tuna"; flake = false; };
|
|
|
|
|
scripts = { url = "github:kmein/scripts"; flake = false; };
|
|
|
|
|
tinc-graph = { url = "github:kmein/tinc-graph"; flake = false; };
|
2021-12-30 16:19:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
|
{ self
|
|
|
|
|
, flake-utils
|
|
|
|
|
, home-manager
|
|
|
|
|
, krops
|
2021-12-30 16:42:02 +01:00
|
|
|
, menstruation-backend
|
|
|
|
|
, menstruation-telegram
|
2021-12-31 16:57:45 +01:00
|
|
|
, telebots
|
|
|
|
|
, traadfri
|
|
|
|
|
, recht
|
|
|
|
|
, tuna
|
|
|
|
|
, scripts
|
|
|
|
|
, tinc-graph
|
2021-12-30 16:19:49 +01:00
|
|
|
, nix-writers
|
|
|
|
|
, nixpkgs
|
|
|
|
|
, nixpkgs-unstable
|
|
|
|
|
, retiolum
|
|
|
|
|
, stockholm
|
2021-12-31 16:05:08 +01:00
|
|
|
}@inputs:
|
2021-12-30 16:19:49 +01:00
|
|
|
let
|
|
|
|
|
system = "x86_64-linux";
|
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
|
# having to declare the git upstream urls here is suboptimal, but the inputs don't remember where they're from
|
|
|
|
|
source = name: {
|
|
|
|
|
niveum.file = toString ./.;
|
|
|
|
|
nixos-config.symlink = "niveum/systems/${name}/configuration.nix";
|
|
|
|
|
nixpkgs.git = { url = "https://github.com/NixOS/nixpkgs"; ref = nixpkgs.rev; shallow = true; };
|
|
|
|
|
nixpkgs-unstable.git = { url = "https://github.com/NixOS/nixpkgs"; ref = nixpkgs-unstable.rev; shallow = true; };
|
|
|
|
|
home-manager.git = { url = "https://github.com/nix-community/home-manager"; ref = home-manager.rev; };
|
|
|
|
|
stockholm.git = { url = "https://cgit.lassul.us/stockholm"; ref = stockholm.rev; };
|
|
|
|
|
nix-writers.git = { url = "https://cgit.krebsco.de/nix-writers"; ref = nix-writers.rev; };
|
|
|
|
|
retiolum.git = { url = "https://github.com/krebs/retiolum"; ref = retiolum.rev; };
|
2021-12-31 16:57:45 +01:00
|
|
|
|
|
|
|
|
traadfri.git = { url = "https://github.com/kmein/traadfri"; ref = tuna.rev; };
|
|
|
|
|
tuna.git = { url = "https://github.com/kmein/tuna"; ref = tuna.rev; };
|
|
|
|
|
telebots.git = { url = "https://github.com/kmein/telebots"; ref = telebots.rev; };
|
|
|
|
|
recht.git = { url = "https://github.com/kmein/recht"; ref = recht.rev; };
|
2021-12-30 16:42:02 +01:00
|
|
|
menstruation-telegram.git = { url = "https://github.com/kmein/menstruation-telegram"; ref = menstruation-telegram.rev; };
|
|
|
|
|
menstruation-backend.git = { url = "https://github.com/kmein/menstruation.rs"; ref = menstruation-backend.rev; };
|
2021-12-31 16:57:45 +01:00
|
|
|
scripts.git = { url = "https://github.com/kmein/scripts"; ref = scripts.rev; };
|
|
|
|
|
tinc-graph.git = { url = "https://github.com/kmein/tinc-graph"; ref = tinc-graph.rev; };
|
2021-12-30 16:19:49 +01:00
|
|
|
|
|
|
|
|
system-secrets.pass = {
|
|
|
|
|
dir = toString ~/.password-store;
|
|
|
|
|
name = "systems/${name}";
|
|
|
|
|
};
|
|
|
|
|
secrets.pass = {
|
|
|
|
|
dir = toString ~/.password-store;
|
|
|
|
|
name = "shared";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
deployScriptFor = {name, host}: let inherit (import ./lib/default.nix) sshPort; in toString (krops.packages.${system}.writeDeploy "deploy-${name}" {
|
|
|
|
|
source = krops.lib.evalSource [ (source name) ];
|
|
|
|
|
target = "root@${host}:${toString sshPort}";
|
|
|
|
|
});
|
|
|
|
|
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";
|
2021-12-31 16:26:30 +01:00
|
|
|
program = deployScriptFor { inherit name; host = "${system}.r"; };
|
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";
|
2021-12-31 16:05:08 +01:00
|
|
|
program = import ./ci.nix { inherit name system inputs; };
|
2021-12-31 15:56:43 +01:00
|
|
|
};
|
|
|
|
|
});
|
2021-12-31 16:16:53 +01:00
|
|
|
in deployScripts // ciScripts;
|
2021-12-30 16:19:49 +01:00
|
|
|
};
|
|
|
|
|
}
|