From df2f0d4442403e9dcce4e75bcb8d013156b97259 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 5 Oct 2024 13:54:05 +0200 Subject: [PATCH] flake: refactor, bye srid Refactor flake to work without nixos-flake and use native NixOS module system. This is because of recent changes to nixos-flake, like renaming it to nixos-unified and changing the API without a changelog or guide how to update. --- flake.lock | 16 ---------- flake.nix | 2 -- hosts/default.nix | 77 +++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 64 insertions(+), 31 deletions(-) diff --git a/flake.lock b/flake.lock index 1b44a1a..6cf7d74 100644 --- a/flake.lock +++ b/flake.lock @@ -318,21 +318,6 @@ "type": "github" } }, - "nixos-flake": { - "locked": { - "lastModified": 1728073820, - "narHash": "sha256-H6DC2OCW8BKzja+1oHGTjw9EN5w+4Op9PnVjKL8EJbI=", - "owner": "srid", - "repo": "nixos-flake", - "rev": "47a26bc9118d17500bbe0c4adb5ebc26f776cc36", - "type": "github" - }, - "original": { - "owner": "srid", - "repo": "nixos-flake", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1728067476, @@ -373,7 +358,6 @@ "keycloak-theme-pub-solar": "keycloak-theme-pub-solar", "maunium-stickerpicker": "maunium-stickerpicker", "nix-darwin": "nix-darwin", - "nixos-flake": "nixos-flake", "nixpkgs": "nixpkgs", "simple-nixos-mailserver": "simple-nixos-mailserver", "unstable": "unstable" diff --git a/flake.nix b/flake.nix index 49fa80c..a417b49 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,6 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; flake-parts.url = "github:hercules-ci/flake-parts"; - nixos-flake.url = "github:srid/nixos-flake"; deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.inputs.nixpkgs.follows = "nixpkgs"; @@ -51,7 +50,6 @@ ]; imports = [ - inputs.nixos-flake.flakeModule ./logins ./lib ./overlays diff --git a/hosts/default.nix b/hosts/default.nix index b3bc145..05d9258 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,9 +1,35 @@ -{ self, ... }: +{ + self, + inputs, + config, + ... +}: { flake = { - nixosConfigurations = { - nachtigall = self.nixos-flake.lib.mkLinuxSystem { + nixosModules = { + home-manager = { imports = [ + inputs.home-manager.nixosModules.home-manager + ({ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + flake = { + inherit self inputs config; + }; + }; + }) + ]; + }; + }; + nixosConfigurations = { + nachtigall = self.inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + flake = { + inherit self inputs config; + }; + }; + modules = [ self.inputs.agenix.nixosModules.default self.nixosModules.home-manager ./nachtigall @@ -43,8 +69,13 @@ ]; }; - metronom = self.nixos-flake.lib.mkLinuxSystem { - imports = [ + metronom = self.inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + flake = { + inherit self inputs config; + }; + }; + modules = [ self.inputs.agenix.nixosModules.default self.nixosModules.home-manager ./metronom @@ -60,8 +91,13 @@ ]; }; - tankstelle = self.nixos-flake.lib.mkLinuxSystem { - imports = [ + tankstelle = self.inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + flake = { + inherit self inputs config; + }; + }; + modules = [ self.inputs.agenix.nixosModules.default self.nixosModules.home-manager ./tankstelle @@ -73,8 +109,13 @@ ]; }; - trinkgenossin = self.nixos-flake.lib.mkLinuxSystem { - imports = [ + trinkgenossin = self.inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + flake = { + inherit self inputs config; + }; + }; + modules = [ self.inputs.agenix.nixosModules.default self.nixosModules.home-manager ./trinkgenossin @@ -94,8 +135,13 @@ ]; }; - delite = self.nixos-flake.lib.mkLinuxSystem { - imports = [ + delite = self.inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + flake = { + inherit self inputs config; + }; + }; + modules = [ self.inputs.agenix.nixosModules.default self.inputs.disko.nixosModules.disko self.nixosModules.home-manager @@ -111,8 +157,13 @@ ]; }; - blue-shell = self.nixos-flake.lib.mkLinuxSystem { - imports = [ + blue-shell = self.inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + flake = { + inherit self inputs config; + }; + }; + modules = [ self.inputs.agenix.nixosModules.default self.inputs.disko.nixosModules.disko self.nixosModules.home-manager