1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/flake.nix

93 lines
3.0 KiB
Nix
Raw Permalink Normal View History

2021-12-30 16:19:49 +01:00
{
description = "niveum: packages, modules, systems";
inputs = {
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
2021-12-31 16:57:45 +01:00
menstruation-backend = { url = "github:kmein/menstruation.rs"; flake = false; };
2021-12-31 17:26:15 +01:00
menstruation-telegram = { url = "github:kmein/menstruation-telegram"; flake = false; };
nix-writers = { url = "git+https://cgit.krebsco.de/nix-writers"; flake = false; };
2021-12-31 16:57:45 +01:00
recht = { url = "github:kmein/recht"; flake = false; };
2021-12-31 17:26:15 +01:00
retiolum = { url = "github:krebs/retiolum"; flake = false; };
2021-12-31 16:57:45 +01:00
scripts = { url = "github:kmein/scripts"; flake = false; };
2021-12-31 17:26:15 +01:00
stockholm = { url = "git+https://cgit.lassul.us/stockholm"; flake = false; };
telebots = { url = "github:kmein/telebots"; flake = false; };
2021-12-31 16:57:45 +01:00
tinc-graph = { url = "github:kmein/tinc-graph"; flake = false; };
2021-12-31 17:26:15 +01:00
traadfri = { url = "github:kmein/traadfri"; flake = false; };
tuna = { url = "github:kmein/tuna"; 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-30 16:19:49 +01:00
, nix-writers
, nixpkgs
, nixpkgs-unstable
2021-12-31 17:26:15 +01:00
, recht
2021-12-30 16:19:49 +01:00
, retiolum
2021-12-31 17:26:15 +01:00
, scripts
2021-12-30 16:19:49 +01:00
, stockholm
2021-12-31 17:26:15 +01:00
, telebots
, tinc-graph
, traadfri
, tuna
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};
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);
2021-12-30 16:19:49 +01:00
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";
program = deployScriptFor { inherit name; host = "${name}.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
};
});
in deployScripts // ciScripts;
2021-12-30 16:19:49 +01:00
};
}