From 6b366fc24a5c80dc5621d9a2335bebc2f8cdfe0f Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Wed, 15 Jan 2025 11:07:26 +0000 Subject: [PATCH] Re-add flake-utils Signed-off-by: Nikolaos Karaolidis --- flake.lock | 34 ++++++++++++++ flake.nix | 47 +++++++++++-------- .../user/console/nix-develop/default.nix | 9 +++- .../user/console/nix-direnv/default.nix | 9 +++- 4 files changed, 76 insertions(+), 23 deletions(-) diff --git a/flake.lock b/flake.lock index 15ab3d2..e1a2fd5 100644 --- a/flake.lock +++ b/flake.lock @@ -119,6 +119,24 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -197,6 +215,7 @@ "ags": "ags", "astal": "astal_2", "disko": "disko", + "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nur": "nur", @@ -245,6 +264,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 66249c1..f33946b 100644 --- a/flake.nix +++ b/flake.nix @@ -59,43 +59,52 @@ url = "github:Gerg-L/spicetify-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + + flake-utils = { + url = "github:numtide/flake-utils"; + }; }; outputs = { self, nixpkgs, ... }@inputs: - let - pkgs = nixpkgs.legacyPackages."x86_64-linux"; - in { nixosConfigurations = { - installer = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; + installer = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; modules = [ ./hosts/installer ]; + specialArgs = { inherit inputs system; }; }; - eirene = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; + eirene = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; modules = [ ./hosts/eirene ]; + specialArgs = { inherit inputs system; }; }; - elara = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; + elara = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; modules = [ ./hosts/elara ]; + specialArgs = { inherit inputs system; }; }; }; + } + // inputs.flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells = { + bun = import ./hosts/common/shells/bun { inherit pkgs; }; + go = import ./hosts/common/shells/go { inherit pkgs; }; + java = import ./hosts/common/shells/java { inherit pkgs; }; + nix = import ./hosts/common/shells/nix { inherit pkgs; }; + nodejs = import ./hosts/common/shells/nodejs { inherit pkgs; }; + python = import ./hosts/common/shells/python { inherit pkgs; }; + }; - devShells = { - bun = import ./hosts/common/shells/bun { inherit pkgs; }; - go = import ./hosts/common/shells/go { inherit pkgs; }; - java = import ./hosts/common/shells/java { inherit pkgs; }; - nix = import ./hosts/common/shells/nix { inherit pkgs; }; - nodejs = import ./hosts/common/shells/nodejs { inherit pkgs; }; - python = import ./hosts/common/shells/python { inherit pkgs; }; - }; + formatter = pkgs.nixfmt-rfc-style; + } + ); - formatter."x86_64-linux" = pkgs.nixfmt-rfc-style; - }; } diff --git a/hosts/common/configs/user/console/nix-develop/default.nix b/hosts/common/configs/user/console/nix-develop/default.nix index 7c06794..232e781 100644 --- a/hosts/common/configs/user/console/nix-develop/default.nix +++ b/hosts/common/configs/user/console/nix-develop/default.nix @@ -2,7 +2,12 @@ user ? throw "user argument is required", home ? throw "home argument is required", }: -{ lib, inputs, ... }: +{ + lib, + inputs, + system, + ... +}: { home-manager.users.${user}.programs.zsh = { shellAliases.nd = "nix-develop"; @@ -10,7 +15,7 @@ initExtra = let devShells = lib.strings.concatStringsSep " " ( - lib.attrsets.mapAttrsToList (key: _: key) inputs.self.devShells + lib.attrsets.mapAttrsToList (key: _: key) inputs.self.devShells.${system} ); in '' diff --git a/hosts/common/configs/user/console/nix-direnv/default.nix b/hosts/common/configs/user/console/nix-direnv/default.nix index 050990a..ee64533 100644 --- a/hosts/common/configs/user/console/nix-direnv/default.nix +++ b/hosts/common/configs/user/console/nix-direnv/default.nix @@ -2,7 +2,12 @@ user ? throw "user argument is required", home ? throw "home argument is required", }: -{ lib, inputs, ... }: +{ + lib, + inputs, + system, + ... +}: { home-manager.users.${user} = { programs = { @@ -19,7 +24,7 @@ initExtra = let devShells = lib.strings.concatStringsSep " " ( - lib.attrsets.mapAttrsToList (key: _: key) inputs.self.devShells + lib.attrsets.mapAttrsToList (key: _: key) inputs.self.devShells.${system} ); in ''