From 4f2bb9479e0e81605fa2417cd819c2b63b0b3273 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 7 Dec 2022 02:01:17 +1000 Subject: [PATCH] passing all tests for all systems --- flake.nix | 155 +++++++++++++++--------- home/core/default.nix | 1 + hosts/box/default.nix | 1 - hosts/box/hardware-configuration.nix | 1 + hosts/cube/hardware-configuration.nix | 10 +- hosts/curve/default.nix | 2 +- hosts/curve/hardware-configuration.nix | 1 + hosts/helix/default.nix | 13 +- hosts/helix/hardware-configuration.nix | 1 + hosts/lituus/default.nix | 13 +- hosts/lituus/hardware-configuration.nix | 1 + hosts/profiles/core/default.nix | 2 +- hosts/profiles/freshrss/default.nix | 3 +- hosts/profiles/monitoring/default.nix | 10 +- hosts/profiles/sync/kitaab/default.nix | 1 + hosts/profiles/sync/website/default.nix | 4 +- hosts/users/anish/default.nix | 16 +-- modules/nixos/wallabag.nix | 4 +- 18 files changed, 142 insertions(+), 97 deletions(-) diff --git a/flake.nix b/flake.nix index 9fdbd447..fd7fc905 100644 --- a/flake.nix +++ b/flake.nix @@ -16,11 +16,16 @@ agenix.inputs.nixpkgs.follows = "nixpkgs"; deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.inputs.nixpkgs.follows = "nixpkgs"; + # Packages poonam.url = "git+ssh://gitea@git.sealight.xyz/aynish/kitaab?ref=main"; basant.url = "git+ssh://gitea@git.sealight.xyz/aynish/basant?ref=main"; basant.inputs.nixpkgs.follows = "nixpkgs"; basant.inputs.poonam.follows = "poonam"; + grasp.url = "git+ssh://gitea@git.sealight.xyz/aynish/grasp.git?ref=main"; + grasp.inputs.nixpkgs.follows = "nixpkgs"; + # Others + nur.url = "github:nix-community/NUR"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; @@ -30,13 +35,10 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.rust-overlay.follows = "rust-overlay"; }; - nur.url = "github:nix-community/NUR"; - grasp.url = "git+ssh://gitea@git.sealight.xyz/aynish/grasp.git?ref=main"; - grasp.inputs.nixpkgs.follows = "nixpkgs"; tidalcycles.url = "github:mitchmindtree/tidalcycles.nix"; tidalcycles.inputs.nixpkgs.follows = "unstable"; # TODO hundred rabbits software - # TODO not quite useful yet, since it needs secrets + # TODO needs secrets # dhyan.url = "git+ssh://gitea@git.sealight.xyz/aynish/dhyan?ref=main"; # dhyan.inputs.nixpkgs.follows = "nixpkgs"; # TODO needs secrets @@ -131,54 +133,78 @@ } ]; }; - # helix = pkgs.lib.nixosSystem { - # specialArgs = { inherit inputs outputs; }; - # modules = [ - # ./hosts/helix - # home-manager.nixosModules.home-manager - # { - # home-manager.useGlobalPkgs = true; - # home-manager.useUserPackages = true; - # home-manager.users.anish = import ./home/core; - # } - # ]; - # }; - # lituus = pkgs.lib.nixosSystem { - # specialArgs = { inherit inputs outputs; }; - # modules = [ - # ./hosts/lituus - # home-manager.nixosModules.home-manager - # { - # home-manager.useGlobalPkgs = true; - # home-manager.useUserPackages = true; - # home-manager.users.anish = import ./home/core; - # } - # ]; - # }; - # cube = pkgs.lib.nixosSystem { - # specialArgs = { inherit inputs outputs; }; - # modules = [ - # ./hosts/cube - # home-manager.nixosModules.home-manager - # { - # home-manager.useGlobalPkgs = true; - # home-manager.useUserPackages = true; - # home-manager.users.anish = import ./home/core; - # } - # ]; - # }; - # box = pkgs.lib.nixosSystem { - # specialArgs = { inherit inputs outputs; }; - # modules = [ - # ./hosts/box - # home-manager.nixosModules.home-manager - # { - # home-manager.useGlobalPkgs = true; - # home-manager.useUserPackages = true; - # home-manager.users.anish = import ./home/core; - # } - # ]; - # }; + helix = nixpkgs.lib.nixosSystem rec { + specialArgs = { inherit inputs self; }; + system = "x86_64-linux"; + pkgs = nixpkgsFor.${system}; + modules = [ + ./hosts/helix + agenix.nixosModules.age + self.nixosModules.backup + self.nixosModules.hesienbridge + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.anish = import ./home/core; + } + ]; + }; + lituus = nixpkgs.lib.nixosSystem rec { + specialArgs = { inherit inputs self; }; + system = "x86_64-linux"; + pkgs = nixpkgsFor.${system}; + modules = [ + ./hosts/lituus + agenix.nixosModules.age + self.nixosModules.backup + self.nixosModules.wireguard + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.anish = import ./home/core; + } + ]; + }; + cube = nixpkgs.lib.nixosSystem rec { + specialArgs = { inherit inputs self; }; + system = "x86_64-linux"; + pkgs = nixpkgsFor.${system}; + modules = [ + ./hosts/cube + agenix.nixosModules.age + self.nixosModules.backup + self.nixosModules.wireguard + basant.nixosModule + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.anish = import ./home/core; + } + ]; + }; + box = nixpkgs.lib.nixosSystem rec { + specialArgs = { inherit inputs self; }; + system = "x86_64-linux"; + pkgs = nixpkgsFor.${system}; + modules = [ + ./hosts/box + agenix.nixosModules.age + self.nixosModules.backup + self.nixosModules.wireguard + self.nixosModules.wallabag + self.nixosModules.gonic + grasp.nixosModule + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.anish = import ./home/core; + } + ]; + }; }; # Standalone home-manager configuration entrypoint @@ -189,17 +215,38 @@ extraSpecialArgs = { inherit inputs; }; modules = [ ./home/core.nix + ./home/profiles/firefox ]; }; }; deploy.nodes = { curve.profiles.system = { - user = "root"; + user = "anish"; path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.curve; }; + box.profiles.system = { + user = "anish"; + hostname = "mossnet.lan"; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.box; + }; + helix.profiles.system = { + user = "anish"; + hostname = "sealight.xyz"; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.helix; + }; + lituus.profiles.system = { + user = "anish"; + hostname = "git.sealight.xyz"; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.lituus; + }; + cube.profiles.system = { + user = "anish"; + hostname = "anish.lakhwara.com"; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.cube; + }; }; - # checks = builtins.mapAttrs (system: deploy-rsLib: deployLib.deployChecks self.deploy) deploy.lib; + checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; }; } diff --git a/home/core/default.nix b/home/core/default.nix index e826d856..1071c8e6 100644 --- a/home/core/default.nix +++ b/home/core/default.nix @@ -7,4 +7,5 @@ ../profiles/git ../profiles/task ]; + home.stateVersion = "22.05"; } diff --git a/hosts/box/default.nix b/hosts/box/default.nix index c6db5efa..f5734c64 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -2,7 +2,6 @@ { imports = [ ./configuration.nix - ../users/anish ../profiles/core ../profiles/server ../profiles/taskd diff --git a/hosts/box/hardware-configuration.nix b/hosts/box/hardware-configuration.nix index dd526bfb..3acb0068 100644 --- a/hosts/box/hardware-configuration.nix +++ b/hosts/box/hardware-configuration.nix @@ -49,4 +49,5 @@ powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nixpkgs.hostPlatform = "x86_64-linux"; } diff --git a/hosts/cube/hardware-configuration.nix b/hosts/cube/hardware-configuration.nix index 323fc578..a2ea68c7 100644 --- a/hosts/cube/hardware-configuration.nix +++ b/hosts/cube/hardware-configuration.nix @@ -5,7 +5,8 @@ { imports = - [ (modulesPath + "/profiles/qemu-guest.nix") + [ + (modulesPath + "/profiles/qemu-guest.nix") ]; boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; @@ -14,16 +15,19 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/9233d8be-539f-43c8-9b83-84b5b4d72a93"; + { + device = "/dev/disk/by-uuid/9233d8be-539f-43c8-9b83-84b5b4d72a93"; fsType = "ext4"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/E00D-9070"; + { + device = "/dev/disk/by-uuid/E00D-9070"; fsType = "vfat"; }; swapDevices = [ ]; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nixpkgs.hostPlatform = "x86_64-linux"; } diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix index 971dfd03..8833b39c 100644 --- a/hosts/curve/default.nix +++ b/hosts/curve/default.nix @@ -1,4 +1,4 @@ -{ self, inputs, pkgs, ... }: +{ self, pkgs, ... }: { imports = [ ./configuration.nix diff --git a/hosts/curve/hardware-configuration.nix b/hosts/curve/hardware-configuration.nix index fca90711..c92b7726 100644 --- a/hosts/curve/hardware-configuration.nix +++ b/hosts/curve/hardware-configuration.nix @@ -47,4 +47,5 @@ powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nixpkgs.hostPlatform = "x86_64-linux"; } diff --git a/hosts/helix/default.nix b/hosts/helix/default.nix index d46c6bc4..8d365120 100644 --- a/hosts/helix/default.nix +++ b/hosts/helix/default.nix @@ -10,18 +10,6 @@ ../profiles/wireguard-server ]; - # Capsul specific - users.users.cyberian = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - }; - - mossnet.wg = { - enable = true; - ips = [ "10.0.69.5/24" ]; - privateKeyFile = "/home/anish/wg/wg-priv"; - }; - # mossnet.backup = { # enable = false; # name = "sealight"; @@ -34,4 +22,5 @@ # databases = [ "matrix-synapse" "gitea" ]; # location = "/var/backup/postgresql"; # }; + } diff --git a/hosts/helix/hardware-configuration.nix b/hosts/helix/hardware-configuration.nix index a30f4ecc..cb2c516e 100644 --- a/hosts/helix/hardware-configuration.nix +++ b/hosts/helix/hardware-configuration.nix @@ -23,4 +23,5 @@ swapDevices = [ ]; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nixpkgs.hostPlatform = "x86_64-linux"; } diff --git a/hosts/lituus/default.nix b/hosts/lituus/default.nix index 80ae3dfe..8e7b1775 100644 --- a/hosts/lituus/default.nix +++ b/hosts/lituus/default.nix @@ -2,7 +2,6 @@ { imports = [ ./configuration.nix - ../users/anish ../profiles/core ../profiles/server ../profiles/metrics @@ -12,4 +11,16 @@ ../profiles/freshrss ]; + # Capsul specific + users.users.cyberian = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + + mossnet.wg = { + enable = true; + ips = [ "10.0.69.5/24" ]; + privateKeyFile = "/home/anish/wg/wg-priv"; + }; + } diff --git a/hosts/lituus/hardware-configuration.nix b/hosts/lituus/hardware-configuration.nix index 172bf7cc..fd79d996 100644 --- a/hosts/lituus/hardware-configuration.nix +++ b/hosts/lituus/hardware-configuration.nix @@ -23,4 +23,5 @@ swapDevices = [ ]; nix.maxJobs = lib.mkDefault 1; + nixpkgs.hostPlatform = "x86_64-linux"; } diff --git a/hosts/profiles/core/default.nix b/hosts/profiles/core/default.nix index 1c257967..b33cca67 100644 --- a/hosts/profiles/core/default.nix +++ b/hosts/profiles/core/default.nix @@ -2,7 +2,7 @@ let inherit (lib) fileContents; in { - imports = [ ../cachix ]; + imports = [ ../../users/anish ]; fonts = { diff --git a/hosts/profiles/freshrss/default.nix b/hosts/profiles/freshrss/default.nix index 579e8935..2c736daa 100644 --- a/hosts/profiles/freshrss/default.nix +++ b/hosts/profiles/freshrss/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ self, config, lib, pkgs, ... }: { age.secrets.freshrss-dbpass.file = "${self}/secrets/freshrss-dbpass.age"; @@ -7,6 +7,7 @@ enable = true; virtualHost = "rss.sealight.xyz"; baseUrl = "https://rss.sealight.xyz/"; + passwordFile = "/run/agenix/freshrss-dbpass"; database = { type = "pgsql"; passFile = "/run/agenix/freshrss-dbpass"; diff --git a/hosts/profiles/monitoring/default.nix b/hosts/profiles/monitoring/default.nix index c652a5ab..f4f4b6e5 100644 --- a/hosts/profiles/monitoring/default.nix +++ b/hosts/profiles/monitoring/default.nix @@ -2,9 +2,11 @@ # grafana configuration services.grafana = { enable = true; - domain = "stats.mossnet.lan"; - port = 2342; - addr = "127.0.0.1"; + settings.server = { + domain = "stats.mossnet.lan"; + http_port = 2342; + http_addr = "127.0.0.1"; + }; }; # nginx reverse proxy @@ -26,7 +28,7 @@ port = 9002; }; dnsmasq = { - enable = true; + enable = false; port = 9153; }; }; diff --git a/hosts/profiles/sync/kitaab/default.nix b/hosts/profiles/sync/kitaab/default.nix index b3e626b7..5a24bd3b 100644 --- a/hosts/profiles/sync/kitaab/default.nix +++ b/hosts/profiles/sync/kitaab/default.nix @@ -5,6 +5,7 @@ serviceConfig.Type = "oneshot"; path = [ pkgs.git + pkgs.openssh pkgs.coreutils ]; script = '' diff --git a/hosts/profiles/sync/website/default.nix b/hosts/profiles/sync/website/default.nix index af7b00c1..4d547d63 100644 --- a/hosts/profiles/sync/website/default.nix +++ b/hosts/profiles/sync/website/default.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: +{ pkgs, ... }: { systemd.services.website-deploy = { @@ -8,7 +8,7 @@ pkgs.coreutils pkgs.nixUnstable pkgs.openssh - inputs.deploy.packages.${pkgs.system}.deploy-rs + pkgs.deploy ]; script = '' cd /etc/nixos/ # TODO make variable diff --git a/hosts/users/anish/default.nix b/hosts/users/anish/default.nix index 633ae251..26cbc741 100644 --- a/hosts/users/anish/default.nix +++ b/hosts/users/anish/default.nix @@ -1,8 +1,6 @@ -{ hmUsers, pkgs, ... }: +{ pkgs, ... }: { - #home-manager.users = { inherit (hmUsers) anish; }; - users.users.anish = { description = "Personal user for Anish"; hashedPassword = "$y$j9T$y3DPt/dWaPE.gRazQqw1w0$1RMH5sl/Nu8kW3ZMywYCPRniHD/jF5qRh0VKrdJ.bV2"; @@ -16,16 +14,4 @@ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDtU2GMYjXj6RGO1+mwM4TDGOo0qrKLTL4Di8+QgDX0p5vUEsnE1PS9wnuqCmSu75U8g0XIAMtvtdYyGk1N+Bx01erAZpT8DLYtIXFCyaiN28PVu5T1D0T+TQ7xgIH1qenXZR2DOQdf6kpvKEfm7+7bWhCo0N/KFMpmReubyzHDQcq/1qQasxTL+YALQFOjwKqsOTBXbHwZ103AEAcQX4ftBFEOfVli4/1aKIK4dNSZYB7J9Htq707YnsEqo9RLAMh0aOTTYgTx9AoSUDeqGuh/AGkcB7NcS7EEtI6d5YUGylwZh/gF6hqE0jl8kn2m5jMKXL3CRohZvjifue8x/GIjpu5WRabUuhBEbrfTQQaC7taHnt5rvYCGzKZx09TexUzhuz2CL480DRoxSG+P+lCNm1dIg/EZrnGEzXCSr36PlOqS5t5gm8tPkzCmZf2wU15A3ZIYUPmnYLqsn4WmIV7rKmdqt2ctWELUXow3PPiZXBucP9P3xpsYEfF1SB2SGNc= u0_a139@localhost" ]; }; - - home-manager.users.anish.home.stateVersion = "22.05"; - - # home-manager.users.anish.programs.git = { - # userName = "Anish Lakhwara"; - # userEmail = "anish+git@lakhwara.com"; - # delta.enable = true; - # }; - - #home-manager.users.anish = { suites, ... }: { - # imports = suites.gui; - #}; } diff --git a/modules/nixos/wallabag.nix b/modules/nixos/wallabag.nix index 0c7c922c..55f93ec1 100644 --- a/modules/nixos/wallabag.nix +++ b/modules/nixos/wallabag.nix @@ -89,7 +89,7 @@ in services.phpfpm.pools."${poolName}" = { user = "${cfg.user}"; group = "nginx"; - phpPackage = pkgs.php74; + phpPackage = pkgs.php; settings = { "listen.owner" = "nginx"; "listen.group" = "nginx"; @@ -155,7 +155,7 @@ in wantedBy = [ "multi-user.target" ]; before = [ "phpfpm-wallabag.service" ]; after = [ "mysql.service" "postgresql.service" ]; - path = with pkgs; [ coreutils php74 php74Packages.composer ]; + path = with pkgs; [ coreutils php phpPackages.composer ]; serviceConfig = { User = cfg.user;