From 9a52eff1c92d63ea7309a4b0768f572973b5a6e6 Mon Sep 17 00:00:00 2001 From: Mel Date: Mon, 4 Nov 2024 03:26:19 +0100 Subject: Add basic renard server config Signed-off-by: Mel --- flake.nix | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index c0adac4..3b0b980 100644 --- a/flake.nix +++ b/flake.nix @@ -19,43 +19,51 @@ outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, ... }: let - system = "x86_64-linux"; + systems = { + x86 = "x86_64-linux"; + arm = "aarch64-linux"; + }; - machines = [ - "corsac" + machines = with systems; [ + { name = "corsac"; system = x86; } + { name = "lapin"; system = arm; } + { name = "renard"; system = x86; } ]; - packageSets = let + packageSetsForSystem = system: let pkgsInputs = { inherit system; config = import ./config.nix; }; in rec { pkgs = import nixpkgs pkgsInputs; unstablePkgs = import nixpkgs-unstable pkgsInputs; - auxiliaryPkgs = import ./pkgs { inherit pkgs unstablePkgs; }; + auxiliaryPkgs = import ./pkgs { inherit system pkgs unstablePkgs; }; }; + inherit (nixpkgs) lib; in { - nixosConfigurations = nixpkgs.lib.genAttrs machines - (machine: nixpkgs.lib.nixosSystem { - inherit system; + nixosConfigurations = lib.mergeAttrsList (map (machine: { + ${machine.name} = nixpkgs.lib.nixosSystem { + inherit (machine) system; - specialArgs = inputs // packageSets // { - me = machine; + specialArgs = inputs // (packageSetsForSystem machine.system) // { + me = machine.name; security = import ./security.nix; + util = import ./util.nix { inherit lib; }; }; modules = [ - ./machines/${machine} + ./machines/${machine.name} home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.mel = import ./machines/${machine}/home.nix; + home-manager.users.mel = import ./machines/${machine.name}/home.nix; } ]; - } - ); + }; + }) machines); # compatibility wrapper for nixos-option - legacyPackages.${system} = with packageSets; pkgs.recurseIntoAttrs pkgs; + legacyPackages = lib.genAttrs (lib.attrValues systems) + (system: with packageSetsForSystem system; pkgs.recurseIntoAttrs pkgs); }; } -- cgit 1.4.1