diff options
| author | Mike Vink <mike@pionative.com> | 2024-10-13 00:47:25 +0200 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2024-10-13 00:47:25 +0200 |
| commit | d5d25f1fbb4d44cc7816c47363b1c24414fc1549 (patch) | |
| tree | 14e247061e41b9a8f06038bbefe6ae624be09a92 | |
| parent | 0d5b62cb0eaa0dd2a2906d2f1077015869f88bcc (diff) | |
cleanup flake for syncthing
| -rw-r--r-- | flake.nix | 243 | ||||
| -rw-r--r-- | lib/default.nix | 21 | ||||
| -rw-r--r-- | profiles/core/packages.nix | 2 |
3 files changed, 141 insertions, 125 deletions
@@ -30,134 +30,148 @@ deploy-rs, ... }: let - lib = - (nixpkgs.lib.extend - (_: _: home-manager.lib)).extend - (import ./lib inputs); - in - with lib; rec { - inherit lib; - nixosConfigurations = mkSystems { - lemptop = { - system = "x86_64-linux"; - modules = - [ - ./machines/lemptop.nix - ] - ++ modulesIn ./profiles/core - ++ modulesIn ./profiles/graphical - ++ modulesIn ./profiles/station - ++ modulesIn ./profiles/email - ++ [ - (import ./profiles/netboot/system.nix nixosConfigurations.pump) - ]; - opts = { - isStation = true; - syncthing = { - enable = true; - id = "TGRWV6Z-5CJ4KRI-4VDTIUE-UA5LQYS-3ARZGNK-KL7HGXP-352PB5Q-ADTV6Q2"; - }; - }; - }; + withLibs = nixpkgs.lib.foldl + (acc: inputLib: acc.extend (_: _: inputLib)) + nixpkgs.lib; - pump = { - system = "x86_64-linux"; - modules = - [ - ./machines/pump-netboot.nix - ./profiles/core/configuration.nix - ./profiles/core/syncthing.nix - ./profiles/core/secrets.nix - ./profiles/core/hm.nix - ] - ++ modulesIn ./profiles/homeserver; - opts = { - isServer = true; - ipv4 = [ "192.168.2.13" ]; - ipv6 = [ "2a02:a46b:ee73:1:c240:4bcb:9fc3:71ab" ]; - tailnet = { - ipv4 = "100.90.145.95"; - ipv6 = "fd7a:115c:a1e0::e2da:915f"; - nodeKey = "nodekey:dcd737aab30c21eb4f44a40193f3b16a8535ffe2fb5008904b39bb54e2da915e"; - }; - syncthing = { - enable = false; - # id = "7USTCMT-QZTLGPL-5FCRKJW-BZUGMOS-H7D2TTK-F4COYPG-5D7VUO2-QFME2AS"; - }; + lib = (withLibs [ + inputs.nix-darwin.lib + home-manager.lib + ]).extend + (import ./lib inputs); + + nixosSystems = with lib; { + lemptop = { + system = "x86_64-linux"; + modules = + [ + ./machines/lemptop.nix + ] + ++ modulesIn ./profiles/core + ++ modulesIn ./profiles/graphical + ++ modulesIn ./profiles/station + ++ modulesIn ./profiles/email + ++ [ + (import ./profiles/netboot/system.nix nixosConfigurations.pump) + ]; + opts = { + isStation = true; + syncthing = { + enable = true; + id = "TGRWV6Z-5CJ4KRI-4VDTIUE-UA5LQYS-3ARZGNK-KL7HGXP-352PB5Q-ADTV6Q2"; }; }; + }; - serber = { - system = "x86_64-linux"; - modules = - [ - ./machines/serber.nix - ] - ++ modulesIn ./profiles/core - ++ modulesIn ./profiles/server; - opts = { - isServer = true; - ipv4 = [ "65.109.143.65" ]; - ipv6 = [ "2a01:4f9:c012:ccc2::1" ]; + pump = { + system = "x86_64-linux"; + modules = + [ + ./machines/pump-netboot.nix + ./profiles/core/configuration.nix + ./profiles/core/syncthing.nix + ./profiles/core/secrets.nix + ./profiles/core/hm.nix + ] + ++ modulesIn ./profiles/homeserver; + opts = { + isServer = true; + ipv4 = [ "192.168.2.13" ]; + ipv6 = [ "2a02:a46b:ee73:1:c240:4bcb:9fc3:71ab" ]; + tailnet = { + ipv4 = "100.90.145.95"; + ipv6 = "fd7a:115c:a1e0::e2da:915f"; + nodeKey = "nodekey:dcd737aab30c21eb4f44a40193f3b16a8535ffe2fb5008904b39bb54e2da915e"; + }; + syncthing = { + enable = false; + # id = "7USTCMT-QZTLGPL-5FCRKJW-BZUGMOS-H7D2TTK-F4COYPG-5D7VUO2-QFME2AS"; }; }; + }; - work = { - system = "aarch64-darwin"; - modules = - [ - ./machines/work.nix - ] - ++ modulesIn ./profiles/core; - opts = { - isDarwin = true; - syncthing = { - enable = true; - id = "GR5MHK2-HDCFX4I-Y7JYKDN-EFTQFG6-24CXSHB-M5C6R3G-2GWX5ED-VEPAQA7"; - }; - }; + serber = { + system = "x86_64-linux"; + modules = + [ + ./machines/serber.nix + ] + ++ modulesIn ./profiles/core + ++ modulesIn ./profiles/server; + opts = { + isServer = true; + ipv4 = [ "65.109.143.65" ]; + ipv6 = [ "2a01:4f9:c012:ccc2::1" ]; }; + }; + + gpg = { + system = "aarch64-linux"; + modules = + [ + (import ./machines/gpg.nix inputs.drduh-yubikey-guide) + ./profiles/core/configuration.nix + ./profiles/core/hm.nix + ./profiles/core/meta.nix + ./profiles/core/neovim.nix + ] + ++ modulesIn ./profiles/graphical; + opts = { }; + }; - gpg = { - system = "aarch64-linux"; - modules = - [ - (import ./machines/gpg.nix inputs.drduh-yubikey-guide) - ./profiles/core/configuration.nix - ./profiles/core/hm.nix - ./profiles/core/meta.nix - ./profiles/core/neovim.nix - ] - ++ modulesIn ./profiles/graphical; - opts = { }; + vm-aarch64 = { + system = "aarch64-linux"; + modules = + [ + ./machines/vm-aarch64.nix + ] + ++ modulesIn ./profiles/core + ++ modulesIn ./profiles/graphical; + opts = { + isStation = true; + syncthing = { + enable = true; + id = "LDZVZ6H-KO3BKC6-FMLZOND-MKXI4DF-SNT27OT-Q5KMN2M-A2DYFNQ-3BWUYA6"; + }; }; + }; - vm-aarch64 = { - system = "aarch64-linux"; - modules = - [ - ./machines/vm-aarch64.nix - ] - ++ modulesIn ./profiles/core - ++ modulesIn ./profiles/graphical; - opts = { - isStation = true; - syncthing = { - enable = true; - id = "LDZVZ6H-KO3BKC6-FMLZOND-MKXI4DF-SNT27OT-Q5KMN2M-A2DYFNQ-3BWUYA6"; - }; + bellerophone = { + opts = { + syncthing = { + enable = true; + id = "75U7B2F-SZOJRY2-UKAADJD-NI3R5SJ-K4J35IN-D2NJJFJ-JG5TCJA-AUERDAA"; }; }; + }; + }; - bellerophone = { - opts = { - syncthing = { - enable = true; - id = "75U7B2F-SZOJRY2-UKAADJD-NI3R5SJ-K4J35IN-D2NJJFJ-JG5TCJA-AUERDAA"; - }; + darwinSystems = with lib; { + work = { + system = "aarch64-darwin"; + modules = + [ + ./machines/work.nix + ] + ++ modulesIn ./profiles/core; + opts = { + isDarwin = true; + syncthing = { + enable = true; + id = "GR5MHK2-HDCFX4I-Y7JYKDN-EFTQFG6-24CXSHB-M5C6R3G-2GWX5ED-VEPAQA7"; }; }; }; + }; + + mkSystems = lib.mkSystemsFor (nixosSystems // darwinSystems); + in + with lib; { + inherit lib; + + nixosConfigurations = mkSystems nixosSystems; + + darwinConfigurations = mkSystems darwinSystems; deploy.nodes = { pump = { @@ -179,10 +193,5 @@ export HCLOUD_TOKEN="$(pass show personal/hetzner-token)" ''; }; - - # templates = - # mapAttrs - # (name: type: {path = ./templates + "/${name}";}) - # (builtins.readDir ./templates); - }; + }; } diff --git a/lib/default.nix b/lib/default.nix index 960a7a4..bca0a8e 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -33,8 +33,18 @@ inputs: lib: prev: with lib; rec { }: let machine = machines.${name}; + systemClosure = + (if hasInfix "darwin" system then + darwinSystem + else + nixosSystem); + home-manager = + (if hasInfix "darwin" system then + [inputs.home-manager.darwinModules.default] + else + [inputs.home-manager.nixosModules.default]); in - lib.nixosSystem { + systemClosure { inherit lib system; specialArgs = { inherit (inputs) self; @@ -43,10 +53,7 @@ inputs: lib: prev: with lib; rec { modules = modules ++ - (if lib.hasInfix "darwin" system then - [inputs.home-manager.darwinModules.default] - else - [inputs.home-manager.nixosModules.default]) + home-manager ++ [ ({pkgs, ...}: { nixpkgs.overlays = with lib; [ @@ -60,9 +67,9 @@ inputs: lib: prev: with lib; rec { ]; }; - mkSystems = systems: + mkSystemsFor = allSystems: systems: let - machines = mkMachines (mapAttrs (name: value: value.opts) systems); + machines = mkMachines (mapAttrs (name: value: value.opts) allSystems); in (mapAttrs (mkSystem machines) systems); diff --git a/profiles/core/packages.nix b/profiles/core/packages.nix index 7793c95..bd6fd0d 100644 --- a/profiles/core/packages.nix +++ b/profiles/core/packages.nix @@ -32,7 +32,6 @@ with lib; # gcc gnumake file - psmisc bc mediainfo bat @@ -42,6 +41,7 @@ with lib; ] ++ (optionals (!machine.isDarwin) [ man-pages man-pages-posix + psmisc # pkgsi686Linux.glibc gdb pciutils |
