infrastructure

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit eb62d42ee1a470d935b64b28d0e365a88e439797
parent fed63d67f11b90a924880e23a78bad81c41b9d89
Author: Silas Brack <silasbrack@gmail.com>
Date:   Sun,  3 Nov 2024 15:48:05 +0100

Small refactor.

Diffstat:
Dconfiguration.nix | 128-------------------------------------------------------------------------------
Mflake.nix | 6+++---
Anixos/configuration.nix | 128+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rvm.nix -> nixos/vm.nix | 0
Rvpn.nix -> nixos/vpn.nix | 0
5 files changed, 131 insertions(+), 131 deletions(-)

diff --git a/configuration.nix b/configuration.nix @@ -1,128 +0,0 @@ -{ - pkgs, - sops, - modulesPath, - my_app, - ... -}: -{ - # Generic - system.stateVersion = "24.05"; # Do not change lightly! - environment.systemPackages = with pkgs; [ - vim - wget - curl - rsync - rclone - zip - unzip - ]; - services.openssh.enable = true; - networking.firewall.allowedTCPPorts = [ 80 ]; - - boot.loader.grub = { - enable = false; - }; - fileSystems."/" = { - device = "/dev/sda1"; - fsType = "ext4"; - }; - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - - # Specific - networking.hostName = "nixos-s-1vcpu-512mb-10gb-ams3-01"; - time.timeZone = "Europe/Amsterdam"; - - imports = [ - (modulesPath + "/virtualisation/digital-ocean-image.nix") - ./vpn.nix - ./apps/my_app/module.nix - ]; - # security.pki.certificates = [ (builtins.readFile "/run/secrets/ca_certificate") ]; - - sops.defaultSopsFile = ./secrets.yaml; - sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; - sops.secrets.server_wireguard_key = { - restartUnits = [ "wg-quick-wg0.service" ]; - }; - sops.secrets.ca_certificate = { }; - - users.users.silas = { - isNormalUser = true; - description = "Silas Brack"; - home = "/home/silas"; - extraGroups = [ - "networkmanager" - "wheel" - ]; # "keys" - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPYO29H4+yDvJbaoUqTg5V6IpD3CMFlB2F47MCzHNpY silasbrack@gmail.com" # Thinkpad (obsolete) - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJtyTJ7fQ/dF4ObtXcjmjJ3OFtjkYEJdr/szcugDEA3C silasbrack@gmail.com" # Thinkpad - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGqHJMc2SCzL50SO9Flfnhn012p1dmp4Iph8lPQ2aoe/ silasbrack@gmail.com" # Desktop - ]; - }; - - services.my_app = { - enable = false; - package = my_app.packages."x86_64-linux".default; - port = 8009; - }; - - services.nginx = { - enable = true; - virtualHosts."localhost" = { - locations."/" = { - return = "200 'Hello, NixOS!'"; - extraConfig = '' - default_type text/plain; - ''; - }; - # locations."/chat" = { - # proxyPass = "http://10.100.0.4:8080"; - # }; - }; - }; - - # services.open-webui = { - # enable = true; - # }; - - # # Enable postgres - # services.postgresql = { - # enable = true; - # package = pkgs.postgresql_16; - # extraPlugins = ps: with ps; [ pgvector ]; - # ensureDatabases = [ "mydb" ]; - # ensureUsers = [ - # { - # name = "datascientist"; - # } - # { - # name = "silas"; - # } - # ]; - # authentication = pkgs.lib.mkOverride 10 '' - # #TYPE DATABASE USER AUTH-METHOD OPTIONAL_IDENT_MAP - # local all all peer map=superuser_map - # #TYPE DATABASE USER ADDRESS AUTH-METHOD - # host all all 127.0.0.1/32 trust - # host all all ::1/128 trust - # ''; - # identMap = '' - # # MAPNAME SYSTEM-USERNAME PG-USERNAME - # superuser_map root postgres - # superuser_map postgres postgres - # superuser_map /^(.*)$ \1 - # ''; - # initialScript = pkgs.writeText "backend-initScript" '' - # GRANT ALL PRIVILEGES ON DATABASE mydb TO silas; - # ''; - # settings = { - # port = 44537; - # }; - # }; -} diff --git a/flake.nix b/flake.nix @@ -43,7 +43,7 @@ modulesPath, sops, }: - import ./configuration.nix (inputs // { inherit my_app; }) + import ./nixos/configuration.nix (inputs // { inherit my_app; }) ) ]; }; @@ -75,7 +75,7 @@ # modulesPath, # sops, # }: - # import ./configuration.nix (inputs // { inherit my_app; }) + # import ./nixos/configuration.nix (inputs // { inherit my_app; }) # ) ( inputs@{ @@ -87,7 +87,7 @@ modulesPath, sops, }: - import ./vm.nix ( + import ./nixos/vm.nix ( inputs // { inherit self; diff --git a/nixos/configuration.nix b/nixos/configuration.nix @@ -0,0 +1,128 @@ +{ + pkgs, + sops, + modulesPath, + my_app, + ... +}: +{ + # Generic + system.stateVersion = "24.05"; # Do not change lightly! + environment.systemPackages = with pkgs; [ + vim + wget + curl + rsync + rclone + zip + unzip + ]; + services.openssh.enable = true; + networking.firewall.allowedTCPPorts = [ 80 ]; + + boot.loader.grub = { + enable = false; + }; + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; + }; + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + + # Specific + networking.hostName = "nixos-s-1vcpu-512mb-10gb-ams3-01"; + time.timeZone = "Europe/Amsterdam"; + + imports = [ + (modulesPath + "/virtualisation/digital-ocean-image.nix") + ./nixos/vpn.nix + ./apps/my_app/module.nix + ]; + # security.pki.certificates = [ (builtins.readFile "/run/secrets/ca_certificate") ]; + + sops.defaultSopsFile = ./secrets.yaml; + sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; + sops.secrets.server_wireguard_key = { + restartUnits = [ "wg-quick-wg0.service" ]; + }; + sops.secrets.ca_certificate = { }; + + users.users.silas = { + isNormalUser = true; + description = "Silas Brack"; + home = "/home/silas"; + extraGroups = [ + "networkmanager" + "wheel" + ]; # "keys" + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPYO29H4+yDvJbaoUqTg5V6IpD3CMFlB2F47MCzHNpY silasbrack@gmail.com" # Thinkpad (obsolete) + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJtyTJ7fQ/dF4ObtXcjmjJ3OFtjkYEJdr/szcugDEA3C silasbrack@gmail.com" # Thinkpad + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGqHJMc2SCzL50SO9Flfnhn012p1dmp4Iph8lPQ2aoe/ silasbrack@gmail.com" # Desktop + ]; + }; + + services.my_app = { + enable = false; + package = my_app.packages."x86_64-linux".default; + port = 8009; + }; + + services.nginx = { + enable = true; + virtualHosts."localhost" = { + locations."/" = { + return = "200 'Hello, NixOS!'"; + extraConfig = '' + default_type text/plain; + ''; + }; + # locations."/chat" = { + # proxyPass = "http://10.100.0.4:8080"; + # }; + }; + }; + + # services.open-webui = { + # enable = true; + # }; + + # # Enable postgres + # services.postgresql = { + # enable = true; + # package = pkgs.postgresql_16; + # extraPlugins = ps: with ps; [ pgvector ]; + # ensureDatabases = [ "mydb" ]; + # ensureUsers = [ + # { + # name = "datascientist"; + # } + # { + # name = "silas"; + # } + # ]; + # authentication = pkgs.lib.mkOverride 10 '' + # #TYPE DATABASE USER AUTH-METHOD OPTIONAL_IDENT_MAP + # local all all peer map=superuser_map + # #TYPE DATABASE USER ADDRESS AUTH-METHOD + # host all all 127.0.0.1/32 trust + # host all all ::1/128 trust + # ''; + # identMap = '' + # # MAPNAME SYSTEM-USERNAME PG-USERNAME + # superuser_map root postgres + # superuser_map postgres postgres + # superuser_map /^(.*)$ \1 + # ''; + # initialScript = pkgs.writeText "backend-initScript" '' + # GRANT ALL PRIVILEGES ON DATABASE mydb TO silas; + # ''; + # settings = { + # port = 44537; + # }; + # }; +} diff --git a/vm.nix b/nixos/vm.nix diff --git a/vpn.nix b/nixos/vpn.nix