From 806140b6ccafaeaf178bd168101e364a31f55093 Mon Sep 17 00:00:00 2001 From: nathan mccarty Date: Sun, 3 Jul 2022 00:43:50 -0400 Subject: [PATCH] Create configuration.nix --- flake.nix | 71 +-------------------------- machines/levitation/configuration.nix | 54 ++++++++++++++++++++ machines/x86vm/configuration.nix | 19 +++++++ 3 files changed, 75 insertions(+), 69 deletions(-) create mode 100644 machines/levitation/configuration.nix create mode 100644 machines/x86vm/configuration.nix diff --git a/flake.nix b/flake.nix index b792bc9..0c047f7 100644 --- a/flake.nix +++ b/flake.nix @@ -107,58 +107,7 @@ hostName = "levitation"; extraModules = [ ./hardware/levitation.nix - ({ pkgs, config, lib, ... }: { - # sops for borg - sops.secrets."borg-ssh-key" = { - sopsFile = ./secrets/levitation/borg.yaml; - format = "yaml"; - }; - sops.secrets."borg-password" = { - sopsFile = ./secrets/levitation/borg.yaml; - format = "yaml"; - }; - # Setup system configuration - nathan = { - programs = { - games = true; - }; - services = { - borg = { - enable = true; - extraExcludes = [ - "/home/${config.nathan.config.user}/Music" - "/var/lib/docker" - "/var/log" - ]; - passwordFile = config.sops.secrets."borg-password".path; - sshKey = config.sops.secrets."borg-ssh-key".path; - }; - }; - config = { - isDesktop = true; - setupGrub = true; - nix.autoUpdate = false; - harden = false; - }; - }; - # Configure networking - networking = { - domain = "mccarty.io"; - useDHCP = false; - interfaces.enp6s0.useDHCP = true; - nat.externalInterface = "enp6s0"; - # Open ports for soulseek - # TODO add in soulseek - firewall = { - allowedTCPPorts = [ 61377 ]; - allowedUDPPorts = [ 61377 ]; - }; - }; - # FIXME borg backup module - - # Setup home manager - home-manager.users.nathan = import ./machines/levitation/home.nix; - }) + ./machines/levitation/configuration.nix ]; }; @@ -168,23 +117,7 @@ extraModules = [ "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix" "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" - ({ pkgs, config, lib, ... }: { - nathan = { - programs = { - games = true; - }; - config = { - isDesktop = true; - nix.autoUpdate = false; - }; - }; - home-manager.users.nathan = import ./machines/x86vm/home.nix; - - # Workaround to get sway working in qemu - environment.variables = { - "WLR_RENDERER" = "pixman"; - }; - }) + ./machines/x86vm/configuration.nix ]; }; }; diff --git a/machines/levitation/configuration.nix b/machines/levitation/configuration.nix new file mode 100644 index 0000000..0a8a4aa --- /dev/null +++ b/machines/levitation/configuration.nix @@ -0,0 +1,54 @@ +{ config, lib, pkgs, ... }: + +{ + # sops for borg + sops.secrets."borg-ssh-key" = { + sopsFile = ../../secrets/levitation/borg.yaml; + format = "yaml"; + }; + sops.secrets."borg-password" = { + sopsFile = ../../secrets/levitation/borg.yaml; + format = "yaml"; + }; + # Setup system configuration + nathan = { + programs = { + games = true; + }; + services = { + borg = { + enable = true; + extraExcludes = [ + "/home/${config.nathan.config.user}/Music" + "/var/lib/docker" + "/var/log" + ]; + passwordFile = config.sops.secrets."borg-password".path; + sshKey = config.sops.secrets."borg-ssh-key".path; + }; + }; + config = { + isDesktop = true; + setupGrub = true; + nix.autoUpdate = false; + harden = false; + }; + }; + # Configure networking + networking = { + domain = "mccarty.io"; + useDHCP = false; + interfaces.enp6s0.useDHCP = true; + nat.externalInterface = "enp6s0"; + # Open ports for soulseek + # TODO add in soulseek + firewall = { + allowedTCPPorts = [ 61377 ]; + allowedUDPPorts = [ 61377 ]; + }; + }; + # FIXME borg backup module + + # Setup home manager + home-manager.users.nathan = import ./home.nix; +} diff --git a/machines/x86vm/configuration.nix b/machines/x86vm/configuration.nix new file mode 100644 index 0000000..a7d4a1a --- /dev/null +++ b/machines/x86vm/configuration.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +{ + nathan = { + programs = { + games = true; + }; + config = { + isDesktop = true; + nix.autoUpdate = false; + }; + }; + home-manager.users.nathan = import ./home.nix; + + # Workaround to get sway working in qemu + environment.variables = { + "WLR_RENDERER" = "pixman"; + }; +}