summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix44
-rw-r--r--lib/deploy.nix39
-rw-r--r--lib/nginx.nix2
3 files changed, 14 insertions, 71 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 9a67a2e..92ae0f0 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -1,32 +1,14 @@
-{
- lib,
- inputs,
- ...
-}: {
- flake.lib =
- (lib.extend (final: prev: let
- readDir' = dir:
- prev.filterAttrs (name: (
- prev.const (name != "default.nix")
- )) (builtins.readDir dir);
- in {
- my =
- prev.recursiveUpdate
- (
- prev.mapAttrs' (name: (
- prev.const (
- prev.nameValuePair
- (prev.removeSuffix ".nix" name)
- (import ./${name} {
- lib = final;
- inherit inputs;
- })
- )
- )) (readDir' ./.)
- )
- {
- inherit readDir';
- };
- }))
- .my;
+{lib, ...}: let
+ fnsFrom = files:
+ builtins.listToAttrs (
+ map (file: {
+ name = lib.removeSuffix ".nix" (baseNameOf file);
+ value = import file lib;
+ })
+ files
+ );
+in {
+ flake.lib = fnsFrom [
+ ./nginx.nix
+ ];
}
diff --git a/lib/deploy.nix b/lib/deploy.nix
deleted file mode 100644
index fa15dc6..0000000
--- a/lib/deploy.nix
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- lib,
- inputs,
- ...
-}: let
- inherit (inputs) self;
- configurations = self.nixosConfigurations // self.darwinConfigurations;
-
- getDeploy = pkgs:
- (pkgs.appendOverlays [
- inputs.deploy.overlay
- (_: prev: {
- deploy-rs = {
- inherit (pkgs) deploy-rs;
- inherit (prev.deploy-rs) lib;
- };
- })
- ])
- .deploy-rs;
-
- toType = system:
- {
- "Linux" = "nixos";
- "Darwin" = "darwin";
- }
- .${system};
-
- toDeployNode = hostname: system: {
- sshUser = "root";
- inherit hostname;
- profiles.system.path = let
- deploy = getDeploy system.pkgs;
- type = toType system.pkgs.stdenv.hostPlatform.uname.system;
- in
- deploy.lib.activate.${type} system;
- };
-in {
- mapNodes = targets: lib.mapAttrs toDeployNode (lib.getAttrs targets configurations);
-}
diff --git a/lib/nginx.nix b/lib/nginx.nix
index 1b1c951..bcf3332 100644
--- a/lib/nginx.nix
+++ b/lib/nginx.nix
@@ -1,4 +1,4 @@
-{lib, ...}: {
+lib: {
mkProxy = endpoint: port: {
"${endpoint}" = {
proxyPass = "http://localhost:${toString port}";