diff --git a/devShells/flake-module.nix b/devShells/flake-module.nix new file mode 100644 index 0000000..10ee6cb --- /dev/null +++ b/devShells/flake-module.nix @@ -0,0 +1,25 @@ +{ + perSystem = + { + inputs', + pkgs, + ... + }: + { + devShells.default = pkgs.mkShellNoCC { + packages = [ + inputs'.agenix.packages.default + inputs'.clan-core.packages.clan-cli + pkgs.nil # Nix language server + pkgs.nixfmt-rfc-style + pkgs.opentofu + pkgs.terraform-ls + pkgs.deploy-rs + pkgs.zsh + ]; + shellhook = '' + exec zsh + ''; + }; + }; +} diff --git a/flake.lock b/flake.lock index cb98a1d..6d022ed 100644 --- a/flake.lock +++ b/flake.lock @@ -27,7 +27,9 @@ "inputs": { "data-mesher": "data-mesher", "disko": "disko", - "flake-parts": "flake-parts", + "flake-parts": [ + "flake-parts" + ], "nix-darwin": "nix-darwin", "nix-select": "nix-select", "nixos-facter-modules": "nixos-facter-modules", @@ -186,16 +188,15 @@ "flake-parts": { "inputs": { "nixpkgs-lib": [ - "clan-core", "nixpkgs" ] }, "locked": { - "lastModified": 1748821116, - "narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=", + "lastModified": 1749398372, + "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1", + "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", "type": "github" }, "original": { @@ -567,6 +568,7 @@ "agenix": "agenix", "clan-core": "clan-core", "disko": "disko_2", + "flake-parts": "flake-parts", "home-manager": "home-manager_2", "ignis": "ignis", "impermanence": "impermanence", diff --git a/flake.nix b/flake.nix index 3a9c468..cd6a11f 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,7 @@ inputs@{ nixpkgs, clan-core, + flake-parts, home-manager, impermanence, nixos-generators, @@ -12,14 +13,22 @@ self, ... }: - let - clan = clan-core.lib.buildClan { - self = self; + flake-parts.lib.mkFlake { inherit inputs; } ({ + imports = [ + inputs.clan-core.flakeModules.default + inputs.nix-topology.flakeModule + + ./devShells/flake-module.nix + ]; + + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + clan = { meta.name = "blossom"; - specialArgs = { - inherit inputs self; - inherit (import ./parts) keys; - }; + inventory = { instances = { "rpqt-admin" = { @@ -59,129 +68,73 @@ }; }; }; - in - { - inherit (clan) clanInternals nixosConfigurations; - devShells = - nixpkgs.lib.genAttrs - [ - "x86_64-linux" - "aarch64-linux" - ] - ( - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - default = pkgs.mkShell { - packages = [ - inputs.agenix.packages.${system}.default - clan-core.packages.${system}.clan-cli - pkgs.nil # Nix language server - pkgs.nixfmt-rfc-style - pkgs.opentofu - pkgs.terraform-ls - pkgs.deploy-rs - pkgs.zsh - ]; - shellhook = '' - exec zsh - ''; - }; - } - ); - - topology = - nixpkgs.lib.genAttrs - [ - "x86_64-linux" - "aarch64-linux" - ] - ( - system: - let - pkgs = import nixpkgs { - inherit system; - overlays = [ inputs.nix-topology.overlays.default ]; - }; - in - import inputs.nix-topology { - inherit pkgs; - modules = [ - { inherit (self) nixosConfigurations; } - ./topology.nix - ]; - } - ); - - packages.aarch64-linux.genepi-installer-sd-image = nixos-generators.nixosGenerate { - specialArgs = { - inherit inputs; - inherit (import ./parts) keys; - }; - system = "aarch64-linux"; - format = "sd-aarch64-installer"; - modules = [ - nixos-hardware.nixosModules.raspberry-pi-4 - ./system/core - ./machines/genepi/network.nix - ./machines/genepi/hardware-configuration.nix - { networking.hostName = "genepi"; } - { sdImage.compressImage = false; } - { - nixpkgs.overlays = [ - (final: super: { - makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); - }) - ]; - } + perSystem = _: { + topology.modules = [ + ./topology.nix ]; }; - }; + + flake = { + packages.aarch64-linux.genepi-installer-sd-image = nixos-generators.nixosGenerate { + specialArgs = { + inherit inputs; + }; + system = "aarch64-linux"; + format = "sd-aarch64-installer"; + modules = [ + nixos-hardware.nixosModules.raspberry-pi-4 + ./system/core + ./machines/genepi/network.nix + ./machines/genepi/hardware-configuration.nix + { networking.hostName = "genepi"; } + { sdImage.compressImage = false; } + { + nixpkgs.overlays = [ + (final: super: { + makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); + }) + ]; + } + ]; + }; + }; + }); inputs = { - nixpkgs = { - url = "github:nixos/nixpkgs?ref=nixos-unstable"; - }; - disko = { - url = "github:nix-community/disko"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - impermanence = { - url = "github:nix-community/impermanence"; - }; - nixos-hardware = { - url = "github:NixOS/nixos-hardware/master"; - }; - nixos-generators = { - url = "github:nix-community/nixos-generators"; - }; - agenix = { - url = "github:ryantm/agenix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - clan-core = { - url = "git+https://git.clan.lol/clan/clan-core"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - ignis = { - url = "github:ignis-sh/ignis"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nix-topology = { - url = "github:oddlama/nix-topology"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - matugen = { - url = "github:InioX/Matugen"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; + + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + impermanence.url = "github:nix-community/impermanence"; + + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + + nixos-generators.url = "github:nix-community/nixos-generators"; + + agenix.url = "github:ryantm/agenix"; + agenix.inputs.nixpkgs.follows = "nixpkgs"; + + clan-core.url = "git+https://git.clan.lol/clan/clan-core"; + clan-core.inputs.nixpkgs.follows = "nixpkgs"; + clan-core.inputs.flake-parts.follows = "flake-parts"; + + ignis.url = "github:ignis-sh/ignis"; + ignis.inputs.nixpkgs.follows = "nixpkgs"; + + nix-topology.url = "github:oddlama/nix-topology"; + nix-topology.inputs.nixpkgs.follows = "nixpkgs"; + + matugen.url = "github:InioX/Matugen"; + matugen.inputs.nixpkgs.follows = "nixpkgs"; + + flake-parts.url = "github:hercules-ci/flake-parts"; + flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; + }; nixConfig = { diff --git a/machines/crocus/configuration.nix b/machines/crocus/configuration.nix index 49f1674..49fcce0 100644 --- a/machines/crocus/configuration.nix +++ b/machines/crocus/configuration.nix @@ -1,5 +1,5 @@ { - inputs, + self, modulesPath, config, ... @@ -9,7 +9,7 @@ (modulesPath + "/profiles/qemu-guest.nix") # ./radicle.nix ../../system - inputs.clan-core.clanModules.state-version + self.inputs.clan-core.clanModules.state-version ../../modules/remote-builder.nix ../../modules/borgbackup.nix ./topology.nix diff --git a/machines/genepi/builder.nix b/machines/genepi/builder.nix index eeab549..510a932 100644 --- a/machines/genepi/builder.nix +++ b/machines/genepi/builder.nix @@ -1,4 +1,6 @@ -{ keys, ... }: +let + keys = import ../../parts/keys.nix; +in { imports = [ ../../modules/remote-builder.nix diff --git a/machines/genepi/configuration.nix b/machines/genepi/configuration.nix index 5831449..576dc27 100644 --- a/machines/genepi/configuration.nix +++ b/machines/genepi/configuration.nix @@ -1,10 +1,10 @@ { - inputs, + self, ... }: { imports = [ - inputs.agenix.nixosModules.default + self.inputs.agenix.nixosModules.default ./acme.nix ./boot.nix ./builder.nix @@ -24,10 +24,10 @@ ../../system ../../modules/borgbackup.nix - inputs.clan-core.clanModules.state-version - inputs.clan-core.clanModules.trusted-nix-caches + self.inputs.clan-core.clanModules.state-version + self.inputs.clan-core.clanModules.trusted-nix-caches - inputs.home-manager.nixosModules.home-manager + self.inputs.home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; diff --git a/machines/genepi/hardware-configuration.nix b/machines/genepi/hardware-configuration.nix index 182d149..3cc97f1 100644 --- a/machines/genepi/hardware-configuration.nix +++ b/machines/genepi/hardware-configuration.nix @@ -1,7 +1,7 @@ -{ inputs, pkgs, ... }: +{ self, pkgs, ... }: { imports = [ - inputs.nixos-hardware.nixosModules.raspberry-pi-4 + self.inputs.nixos-hardware.nixosModules.raspberry-pi-4 ]; nixpkgs.hostPlatform = "aarch64-linux"; diff --git a/machines/haze/configuration.nix b/machines/haze/configuration.nix index 64ed0a1..e2a0b34 100644 --- a/machines/haze/configuration.nix +++ b/machines/haze/configuration.nix @@ -1,11 +1,11 @@ { - inputs, + self, ... }: { imports = [ # inputs.disko.nixosModules.disko - inputs.agenix.nixosModules.default + self.inputs.agenix.nixosModules.default ./boot.nix ./chat.nix ./firefox.nix @@ -22,15 +22,15 @@ ./video.nix ../../system - inputs.clan-core.clanModules.state-version - inputs.clan-core.clanModules.trusted-nix-caches + self.inputs.clan-core.clanModules.state-version + self.inputs.clan-core.clanModules.trusted-nix-caches - inputs.home-manager.nixosModules.home-manager + self.inputs.home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.rpqt = ./home.nix; - home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.extraSpecialArgs = { inherit (self) inputs; }; } ]; diff --git a/machines/haze/niri.nix b/machines/haze/niri.nix index b5de695..4952297 100644 --- a/machines/haze/niri.nix +++ b/machines/haze/niri.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: +{ self, pkgs, ... }: { programs.niri.enable = true; @@ -11,8 +11,8 @@ tofi wl-gammarelay-rs xwayland-satellite - inputs.ignis.packages.${pkgs.system}.ignis - inputs.matugen.packages.${pkgs.system}.default + self.inputs.ignis.packages.${pkgs.system}.ignis + self.inputs.matugen.packages.${pkgs.system}.default ]; environment.sessionVariables.NIXOS_OZONE_WL = "1"; diff --git a/modules/borgbackup.nix b/modules/borgbackup.nix index 63b59a7..172e76e 100644 --- a/modules/borgbackup.nix +++ b/modules/borgbackup.nix @@ -1,4 +1,4 @@ -{ config, inputs, ... }: +{ config, self, ... }: let user = "u422292"; sub-user = "${user}"; @@ -7,7 +7,7 @@ in { imports = [ ./storagebox.nix - inputs.clan-core.clanModules.borgbackup + self.inputs.clan-core.clanModules.borgbackup ]; clan.borgbackup.destinations."storagebox-${config.networking.hostName}" = { diff --git a/system/core/users.nix b/system/core/users.nix index bf55e6b..e126c6c 100644 --- a/system/core/users.nix +++ b/system/core/users.nix @@ -1,5 +1,5 @@ { - keys, + config, lib, pkgs, ... @@ -17,7 +17,7 @@ shell = pkgs.zsh; - openssh.authorizedKeys.keys = [ keys.rpqt.haze ]; + openssh.authorizedKeys.keys = [ (import ../../parts/keys.nix).rpqt.haze ]; extraGroups = [ "wheel" diff --git a/system/network/default.nix b/system/network/default.nix index 3f791d2..5b74a30 100644 --- a/system/network/default.nix +++ b/system/network/default.nix @@ -1,7 +1,7 @@ -{ inputs, ... }: +{ self, ... }: { imports = [ - inputs.nix-topology.nixosModules.default + self.inputs.nix-topology.nixosModules.default ./tailscale.nix ]; }