diff --git a/flake.nix b/flake.nix index e541335..40525ab 100644 --- a/flake.nix +++ b/flake.nix @@ -21,100 +21,96 @@ colmena.inputs.stable.follows = ""; }; - outputs = - { - self, - nixpkgs, - colmena, - home-manager, - treefmt-nix, - ... - }@inputs: - let - inherit (self) outputs; + outputs = { + self, + nixpkgs, + colmena, + home-manager, + treefmt-nix, + ... + } @ inputs: let + inherit (self) outputs; - systems = [ - "aarch64-linux" - "x86_64-linux" - ]; - forAllSystems = nixpkgs.lib.genAttrs systems; - pkgs = forAllSystems ( - system: + systems = [ + "aarch64-linux" + "x86_64-linux" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + pkgs = forAllSystems ( + system: import nixpkgs { inherit system; config.allowUnfree = true; } - ); + ); - # https://github.com/zhaofengli/colmena/issues/60#issuecomment-2585780016 - mkColmenaHive = - nixpkgs: nodeDeployments: - let - confs = inputs.self.nixosConfigurations; - colmenaConf = { - meta = { - inherit nixpkgs; - nodeNixpkgs = builtins.mapAttrs (_name: value: value.pkgs) confs; - nodeSpecialArgs = builtins.mapAttrs (_name: value: value._module.specialArgs) confs; - }; - } - // builtins.mapAttrs (nodeName: value: { - imports = value._module.args.modules; - deployment = nodeDeployments.${nodeName} or { }; - }) confs; - in - inputs.colmena.lib.makeHive colmenaConf; - - treefmtEval = forAllSystems (system: treefmt-nix.lib.evalModule pkgs.${system} ./treefmt.nix); + # https://github.com/zhaofengli/colmena/issues/60#issuecomment-2585780016 + mkColmenaHive = nixpkgs: nodeDeployments: let + confs = inputs.self.nixosConfigurations; + colmenaConf = + { + meta = { + inherit nixpkgs; + nodeNixpkgs = builtins.mapAttrs (_name: value: value.pkgs) confs; + nodeSpecialArgs = builtins.mapAttrs (_name: value: value._module.specialArgs) confs; + }; + } + // builtins.mapAttrs (nodeName: value: { + imports = value._module.args.modules; + deployment = nodeDeployments.${nodeName} or {}; + }) + confs; in - { - packages = forAllSystems (system: import ./pkgs pkgs.${system}); + inputs.colmena.lib.makeHive colmenaConf; - colmenaHive = mkColmenaHive pkgs.x86_64-linux { - apteryx = { - targetUser = "colmena-deploy"; - }; - athene = { - allowLocalDeployment = true; - targetHost = null; - }; - strigidae = { - targetUser = "colmena-deploy"; - targetHost = "auth.slug.gay"; - }; + treefmtEval = forAllSystems (system: treefmt-nix.lib.evalModule pkgs.${system} ./treefmt.nix); + in { + packages = forAllSystems (system: import ./pkgs pkgs.${system}); + + colmenaHive = mkColmenaHive pkgs.x86_64-linux { + apteryx = { + targetUser = "colmena-deploy"; + }; + athene = { + allowLocalDeployment = true; + targetHost = null; }; + strigidae = { + targetUser = "colmena-deploy"; + targetHost = "auth.slug.gay"; + }; + }; - formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper); - checks = forAllSystems (system: { - formatting = treefmtEval.${system}.config.build.check self; - }); - nixosConfigurations = import ./nixos { inherit inputs outputs; }; - overlays = import ./overlays { inherit inputs; }; - templates = import ./templates { }; + formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper); + checks = forAllSystems (system: { + formatting = treefmtEval.${system}.config.build.check self; + }); + nixosConfigurations = import ./nixos {inherit inputs outputs;}; + overlays = import ./overlays {inherit inputs;}; + templates = import ./templates {}; - devShells = forAllSystems ( - system: - let - pkgs' = pkgs.${system}; - colmena' = colmena.packages.${system}.colmena; - in - { - default = pkgs'.mkShell { - buildInputs = [ pkgs'.bashInteractive ]; - packages = - (builtins.attrValues { - inherit (pkgs') - age - just - nix-output-monitor - nvd - opentofu - sops - ; - }) - ++ [ colmena' ]; - }; - } - ); - }; + devShells = forAllSystems ( + system: let + pkgs' = pkgs.${system}; + colmena' = colmena.packages.${system}.colmena; + in { + default = pkgs'.mkShell { + buildInputs = [pkgs'.bashInteractive]; + packages = + (builtins.attrValues { + inherit + (pkgs') + age + just + nix-output-monitor + nvd + opentofu + sops + ; + }) + ++ [colmena']; + }; + } + ); + }; } diff --git a/home-manager/git.nix b/home-manager/git.nix index 760e91b..566f2eb 100644 --- a/home-manager/git.nix +++ b/home-manager/git.nix @@ -1,10 +1,8 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let userName = "Olivia Crain"; userEmail = "olivia@olivia.dev"; -in -{ - home.packages = [ pkgs.difftastic ]; +in { + home.packages = [pkgs.difftastic]; programs.gh.enable = true; programs.jujutsu = { enable = true; diff --git a/nixos/apteryx/caddy.nix b/nixos/apteryx/caddy.nix index 599904a..9752d57 100644 --- a/nixos/apteryx/caddy.nix +++ b/nixos/apteryx/caddy.nix @@ -2,8 +2,7 @@ pkgs, config, ... -}: -{ +}: { services.tailscale = { permitCertUid = config.services.caddy.user; authKeyFile = config.sops.secrets."tailscale/auth_key".path; @@ -48,7 +47,7 @@ mode = "0440"; }; secrets."tailscale/auth_key" = { - reloadUnits = [ "tailscale-autoconnect.service" ]; + reloadUnits = ["tailscale-autoconnect.service"]; }; }; diff --git a/nixos/apteryx/configuration.nix b/nixos/apteryx/configuration.nix index feadb54..abb6b78 100644 --- a/nixos/apteryx/configuration.nix +++ b/nixos/apteryx/configuration.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { imports = [ ./hardware-configuration.nix ../common @@ -22,7 +21,7 @@ AllowHibernation=no ''; - environment.systemPackages = [ pkgs.vlc ]; + environment.systemPackages = [pkgs.vlc]; system.stateVersion = "23.11"; } diff --git a/nixos/apteryx/forgejo.nix b/nixos/apteryx/forgejo.nix index 0593f98..7fee477 100644 --- a/nixos/apteryx/forgejo.nix +++ b/nixos/apteryx/forgejo.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -{ +}: { services.forgejo = { enable = true; package = pkgs.forgejo; # LTS by default @@ -36,7 +35,7 @@ }; }; - services.openssh.settings.AllowUsers = [ config.services.forgejo.user ]; + services.openssh.settings.AllowUsers = [config.services.forgejo.user]; services.caddy.virtualHosts."https://git.slug.gay/".extraConfig = '' import tailscale_service diff --git a/nixos/apteryx/hedgedoc.nix b/nixos/apteryx/hedgedoc.nix index e9c15f6..fb2ec7e 100644 --- a/nixos/apteryx/hedgedoc.nix +++ b/nixos/apteryx/hedgedoc.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{config, ...}: { services.hedgedoc = { enable = true; settings = { @@ -19,7 +18,7 @@ ''; sops = { - secrets."hedgedoc/oidc_client_secret" = { }; + secrets."hedgedoc/oidc_client_secret" = {}; templates."hedgedoc.env".content = '' CMD_OAUTH2_USER_PROFILE_URL=https://auth.slug.gay/oauth2/openid/hedgedoc/userinfo CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR=preferred_username diff --git a/nixos/apteryx/mealie.nix b/nixos/apteryx/mealie.nix index 4bf0ab5..5859556 100644 --- a/nixos/apteryx/mealie.nix +++ b/nixos/apteryx/mealie.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{config, ...}: { services.mealie = { enable = true; settings = { @@ -22,7 +21,7 @@ ''; sops = { - secrets."mealie/oidc_client_secret" = { }; + secrets."mealie/oidc_client_secret" = {}; templates."mealie.env".content = '' OIDC_CLIENT_SECRET=${config.sops.placeholder."mealie/oidc_client_secret"} ''; diff --git a/nixos/apteryx/media-server.nix b/nixos/apteryx/media-server.nix index b6d17ea..099f462 100644 --- a/nixos/apteryx/media-server.nix +++ b/nixos/apteryx/media-server.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { services.jellyfin.enable = true; services.caddy.virtualHosts."https://media.slug.gay/".extraConfig = '' @@ -12,5 +11,5 @@ "video" ]; - environment.systemPackages = [ pkgs.amdgpu_top ]; + environment.systemPackages = [pkgs.amdgpu_top]; } diff --git a/nixos/apteryx/miniflux.nix b/nixos/apteryx/miniflux.nix index 977f2b4..fcc3d8c 100644 --- a/nixos/apteryx/miniflux.nix +++ b/nixos/apteryx/miniflux.nix @@ -1,8 +1,6 @@ -{ config, ... }: -let +{config, ...}: let port = "6613"; -in -{ +in { services.miniflux = { enable = true; config = { @@ -28,7 +26,7 @@ in systemd.services.miniflux.serviceConfig.EnvironmentFile = config.sops.templates."miniflux.env".path; sops = { - secrets."miniflux/oidc_client_secret" = { }; + secrets."miniflux/oidc_client_secret" = {}; templates."miniflux.env" = { content = '' OAUTH2_CLIENT_SECRET=${config.sops.placeholder."miniflux/oidc_client_secret"} diff --git a/nixos/apteryx/users.nix b/nixos/apteryx/users.nix index e234404..ce083a9 100644 --- a/nixos/apteryx/users.nix +++ b/nixos/apteryx/users.nix @@ -3,6 +3,6 @@ isNormalUser = true; home = "/home/slug"; packages = [pkgs.firefox]; - extraGroups = [ "wheel" ]; + extraGroups = ["wheel"]; }; } diff --git a/nixos/athene/configuration.nix b/nixos/athene/configuration.nix index b4bbda7..45bf44c 100644 --- a/nixos/athene/configuration.nix +++ b/nixos/athene/configuration.nix @@ -4,8 +4,7 @@ lib, config, ... -}: -{ +}: { imports = [ inputs.nixos-hardware.nixosModules.framework-16-7040-amd ./hardware-configuration.nix @@ -40,7 +39,8 @@ programs.thunderbird.enable = true; environment.systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) kicad obsidian ; diff --git a/nixos/common/colmena.nix b/nixos/common/colmena.nix index 8dcd847..adb8dff 100644 --- a/nixos/common/colmena.nix +++ b/nixos/common/colmena.nix @@ -2,15 +2,14 @@ lib, config, ... -}: -let - inherit (lib) +}: let + inherit + (lib) mkEnableOption mkIf ; username = "colmena-deploy"; -in -{ +in { options.olivia.colmena.enable = mkEnableOption "colmena update user"; config = mkIf config.olivia.colmena.enable { @@ -21,31 +20,31 @@ in "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC87Km2/XgeYLt9C164Bo6eCRS5iPaI4hCRLPGo9Nw3b colmena deploy" ]; }; - users.groups.${username} = { }; + users.groups.${username} = {}; security.sudo = { extraRules = [ { - users = [ username ]; + users = [username]; commands = [ { command = "/run/current-system/sw/bin/nix-store --no-gc-warning --realise /nix/store/*"; - options = [ "NOPASSWD" ]; + options = ["NOPASSWD"]; } { command = "/run/current-system/sw/bin/nix-env --profile /nix/var/nix/profiles/system --set /nix/store/*"; - options = [ "NOPASSWD" ]; + options = ["NOPASSWD"]; } { command = "/nix/store/*/bin/switch-to-configuration *"; - options = [ "NOPASSWD" ]; + options = ["NOPASSWD"]; } ]; } ]; }; - nix.settings.trusted-users = [ username ]; - services.openssh.settings.AllowUsers = [ username ]; + nix.settings.trusted-users = [username]; + services.openssh.settings.AllowUsers = [username]; }; } diff --git a/nixos/common/desktop.nix b/nixos/common/desktop.nix index bf29f9b..82e7c8d 100644 --- a/nixos/common/desktop.nix +++ b/nixos/common/desktop.nix @@ -3,16 +3,15 @@ config, pkgs, ... -}: -let - inherit (lib) +}: let + inherit + (lib) mkIf mkEnableOption mkDefault ; inherit (builtins) attrValues; -in -{ +in { options.olivia.desktop.enable = mkEnableOption "common desktop settings"; config = mkIf config.olivia.desktop.enable { @@ -42,7 +41,8 @@ in services.dbus.implementation = mkDefault "broker"; environment.systemPackages = attrValues { - inherit (pkgs) + inherit + (pkgs) firefox wl-clipboard-rs fractal @@ -50,6 +50,6 @@ in ; }; - fonts.packages = [ pkgs.berkeley-mono ]; + fonts.packages = [pkgs.berkeley-mono]; }; } diff --git a/nixos/common/nix.nix b/nixos/common/nix.nix index 98ccf82..0ca2dc2 100644 --- a/nixos/common/nix.nix +++ b/nixos/common/nix.nix @@ -5,17 +5,16 @@ inputs, outputs, ... -}: -let - inherit (lib) +}: let + inherit + (lib) mkDefault mkEnableOption mkIf mkAfter ; inherit (builtins) attrValues; -in -{ +in { options.olivia.nix.enable = mkEnableOption "common nix/nixpkgs options"; config = mkIf config.olivia.nix.enable { @@ -26,7 +25,7 @@ in "nix-command" "flakes" ]; - trusted-users = [ "olivia" ]; + trusted-users = ["olivia"]; }; extraOptions = '' builders-use-substitutes = true @@ -40,7 +39,8 @@ in }; nixpkgs = { overlays = mkAfter (attrValues { - inherit (outputs.overlays) + inherit + (outputs.overlays) additions modifications colmena diff --git a/nixos/common/olivia.nix b/nixos/common/olivia.nix index c097fa4..f3bb509 100644 --- a/nixos/common/olivia.nix +++ b/nixos/common/olivia.nix @@ -14,13 +14,12 @@ in { ]; }; - services.openssh = { enable = true; settings = { PermitRootLogin = "no"; PasswordAuthentication = false; - AllowUsers = [ username ]; + AllowUsers = [username]; }; openFirewall = true; }; diff --git a/nixos/default.nix b/nixos/default.nix index a0d871d..42efd76 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -2,20 +2,20 @@ inputs, outputs, ... -}: -let +}: let mkSystem = name: system: { ${name} = inputs.nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs outputs; }; - modules = [ ./${name}/configuration.nix ]; + modules = [./${name}/configuration.nix]; }; }; in -mkSystem "apteryx" "x86_64-linux" -// mkSystem "athene" "x86_64-linux" -# // mkSystem "cardinalis" "x86_64-linux" -// mkSystem "strigidae" "x86_64-linux" + mkSystem "apteryx" "x86_64-linux" + // mkSystem "athene" "x86_64-linux" + # // mkSystem "cardinalis" "x86_64-linux" + // mkSystem "strigidae" "x86_64-linux" # // mkSystem "corvus" "aarch64-linux" 🫡 + diff --git a/nixos/strigidae/configuration.nix b/nixos/strigidae/configuration.nix index 9a081ae..8698299 100644 --- a/nixos/strigidae/configuration.nix +++ b/nixos/strigidae/configuration.nix @@ -3,8 +3,7 @@ modulesPath, pkgs, ... -}: -{ +}: { imports = [ "${modulesPath}/virtualisation/digital-ocean-image.nix" ../common @@ -26,28 +25,26 @@ networking.hostName = "strigidae"; system.stateVersion = "25.05"; - networking.firewall.allowedTCPPorts = [ 443 ]; + networking.firewall.allowedTCPPorts = [443]; services.kanidm = { enableServer = true; package = pkgs.kanidm_1_8; - serverSettings = - let - certDir = config.security.acme.certs."auth.slug.gay".directory; - in - { - bindaddress = "104.131.167.151:443"; - domain = "auth.slug.gay"; - origin = "https://auth.slug.gay"; - tls_chain = "${certDir}/fullchain.pem"; - tls_key = "${certDir}/key.pem"; - }; + serverSettings = let + certDir = config.security.acme.certs."auth.slug.gay".directory; + in { + bindaddress = "104.131.167.151:443"; + domain = "auth.slug.gay"; + origin = "https://auth.slug.gay"; + tls_chain = "${certDir}/fullchain.pem"; + tls_key = "${certDir}/key.pem"; + }; }; - users.users.kanidm.extraGroups = [ "acme" ]; + users.users.kanidm.extraGroups = ["acme"]; systemd.services.kanidm = { - serviceConfig.AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ]; - requires = [ "acme-auth.slug.gay.service" ]; + serviceConfig.AmbientCapabilities = ["CAP_NET_BIND_SERVICE"]; + requires = ["acme-auth.slug.gay.service"]; }; security.acme = { @@ -62,8 +59,8 @@ sops = { secrets = { - porkbunApiKey = { }; - porkbunSecretApiKey = { }; + porkbunApiKey = {}; + porkbunSecretApiKey = {}; }; templates."acme.env" = { content = '' @@ -77,7 +74,7 @@ enable = true; exporters.node = { enable = true; - enabledCollectors = [ "systemd" ]; + enabledCollectors = ["systemd"]; }; scrapeConfigs = [ { diff --git a/overlays/default.nix b/overlays/default.nix index 643f176..b054f9f 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,9 +1,8 @@ -{ inputs, ... }: -{ - additions = final: _prev: import ../pkgs { pkgs = final; }; +{inputs, ...}: { + additions = final: _prev: import ../pkgs {pkgs = final;}; modifications = final: prev: { - tpm2-pkcs11 = prev.tpm2-pkcs11.override { fapiSupport = false; }; + tpm2-pkcs11 = prev.tpm2-pkcs11.override {fapiSupport = false;}; }; colmena = inputs.colmena.overlays.default;