From c9024ba8b701d94f81c7e7c66f2fe602ede2efcb Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 25 Oct 2024 14:44:25 -0700 Subject: [PATCH] refactor: pointless abstraction for fun --- flake.nix | 34 ++++++++++++---------------------- lib/buildLiminalOS.nix | 13 +++++++++++++ 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 lib/buildLiminalOS.nix diff --git a/flake.nix b/flake.nix index 2a1fff7..8da1bb1 100755 --- a/flake.nix +++ b/flake.nix @@ -90,6 +90,9 @@ flake-parts, ... }: + let + buildLiminalOS = import ./lib/buildLiminalOS.nix; + in flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" @@ -98,30 +101,17 @@ ]; flake = { nixosConfigurations = { - demeter = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - }; - modules = [ - ./hosts/demeter - ]; + demeter = buildLiminalOS { + inherit inputs nixpkgs; + systemModule = ./hosts/demeter; }; - - callisto = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - }; - modules = [ - ./hosts/callisto - ]; + callisto = buildLiminalOS { + inherit nixpkgs inputs; + systemModule = ./hosts/callisto; }; - adrastea = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - }; - modules = [ - ./hosts/adrastea - ]; + adrastea = buildLiminalOS { + inherit inputs nixpkgs; + systemModule = ./hosts/adrastea; }; }; darwinConfigurations.phobos = nix-darwin.lib.darwinSystem { diff --git a/lib/buildLiminalOS.nix b/lib/buildLiminalOS.nix new file mode 100644 index 0000000..90b7046 --- /dev/null +++ b/lib/buildLiminalOS.nix @@ -0,0 +1,13 @@ +{ + nixpkgs, + inputs, + systemModule, +}: +nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + }; + modules = [ + systemModule + ]; +}