From d885924961b3c4b3db76b78e603c0cc84ff88aae Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Mon, 16 Oct 2023 23:16:01 +0200 Subject: stuff --- lib/default.nix | 4 +-- lib/ivi.nix | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/my.nix | 15 ----------- 3 files changed, 84 insertions(+), 17 deletions(-) create mode 100644 lib/ivi.nix delete mode 100644 lib/my.nix (limited to 'lib') diff --git a/lib/default.nix b/lib/default.nix index 6375d5b..7b80611 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,4 @@ -lib: prev: with lib; { +self: lib: prev: with lib; { modulesIn = dir: pipe dir [ builtins.readDir (mapAttrsToList (name: type: @@ -17,5 +17,5 @@ lib: prev: with lib; { collectFlakeInputs = input: [ input ] ++ concatMap collectFlakeInputs (builtins.attrValues (input.inputs or {})); - my = import ./my.nix lib; + ivi = import ./ivi.nix self lib; } diff --git a/lib/ivi.nix b/lib/ivi.nix new file mode 100644 index 0000000..64d358a --- /dev/null +++ b/lib/ivi.nix @@ -0,0 +1,82 @@ +self: lib: with lib; let + modules = [ + { + options.machines = mkOption { + description = "Lookup for static info needed to configure machines"; + default = {}; + type = with types; attrsOf (submodule ({ name, config, ... }: { + freeformType = attrs; + options = { + modules = mkOption { + description = "Final list of modules to import"; + type = listOf str; + default = []; + }; + profiles = mkOption { + description = "List of profiles to use"; + type = listOf str; + default = []; + }; + hostname = mkOption { + description = "The machine's hostname"; + type = str; + readOnly = true; + default = name; + }; + ipv4 = mkOption { + description = "The machines public IPv4 addresses"; + type = listOf str; + default = []; + }; + ipv6 = mkOption { + description = "The machines public IPv6 addresses"; + type = listOf str; + default = []; + }; + isDeployed = mkOption { + description = "The machine is deployed with nixos"; + type = boolean; + default = false; + }; + }; + config = { + modules = + (concatMap + (p: (attrValues (modulesIn (self + "/profiles/" + p)))) + ivi.machines.${name}.profiles + ); + }; + })); + }; + config = { + _module.freeformType = with types; attrs; + + username = "ivi"; + githubUsername = "ivi-vink"; + realName = "Mike Vink"; + domain = "vinkland.xyz"; + email = "mike1994vink@gmail.com"; + sshKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMT59Kbv+rO0PvB1q5u3l9wdUgsKT0M8vQ7WHnjq+kYN ${ivi.email}" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDqsfYS7sOLfLWvGTmxT2QYGkbXJ5kREFl42n3jtte5sLps76KECgKqEjA4OLhNZ51lKFBDzcn1QOUl3RN4+qHsBtkr+02a7hhf1bBLeb1sx6+FVXdsarln5lUF/NMcpj6stUi8mqY4aQ21jQKxZsGip9fI8fx3HtXYCVhIarRbshQlwDqTplJBLDtrnmWTprxVnz1xSZRr3euXsIh1FFQZI6klPPBa6qFJtWWtGNBCRr8Sruo6I4on7QjNyW/s1OgiNAR0N2IO9wCdjlXrjNnFEAaMrpDpZde7eULbiFP2pHYVVy/InwNhhePYkeBh/4BzlaUZVv6gXsX7wOC5OyWaXbbMzWEopbnqeXXLwNyOZ88YpN/c+kZk2/1CHl+xmlVGAr9TnZ9VST5Y4ZAEqq8OKoP3ZcchAWxWjzTgPogSfiIAP/n5xrgB+8uRZb/gkN+I7RTQKGrS2Ex7gfkj39beDeevQj3XVQ1U2kp3n+jUBHItCCpZyHISgTYW2Ct6lrziJpD0kPlAOrN3BGQtkStHYK+4EE1PrrwWGkG7Ue+tlETe8FTg+AMv1VjLV9b3pHZJCrao5/cY2MxkfGzf4HTfeueqSLSsrYuiogHAPvvzfvOV5un+dWX8HyeBjmKTBwDBFuhdca/wzk0ArHSgEYUmh2NXj/G4gaSF3EX5ZSxmMQ== ${ivi.email}" + ]; + + machines = { + lemptop = { + profiles = [ + "core" + "station" + "email" + ]; + }; + serber = { + isDeployed = true; + profiles = [ + "core" + ]; + }; + }; + }; + } + ]; +in (evalModules { inherit modules; }).config diff --git a/lib/my.nix b/lib/my.nix deleted file mode 100644 index 720fd32..0000000 --- a/lib/my.nix +++ /dev/null @@ -1,15 +0,0 @@ -lib: with lib; let - modules = [ - { - config = { - _module.freeformType = with types; attrs; - - username = "ivi"; - githubUsername = "mvinkio"; - realName = "Mike Vink"; - domain = "vinkland.xyz"; - email = "mike1994vink@gmail.com"; - }; - } - ]; -in (evalModules { inherit modules; }).config -- cgit v1.2.3