diff --git a/flake.lock b/flake.lock index b2dc793..4841c0b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1683354017, + "narHash": "sha256-r0BrHDaljUKyQS5FgA4P9xgK+dGa8L0XDL0vBdriEM8=", + "owner": "nix-community", + "repo": "fenix", + "rev": "65fdcbdc0bf35510a013d8a0883b0fa7a4ecd2a8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -38,9 +59,27 @@ }, "root": { "inputs": { + "fenix": "fenix", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1683321754, + "narHash": "sha256-qvyrgObeXw+h+P0VAvaARjRUWn5Ey1ckbs+1El2dc0Y=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "a4966c92829f945d3846eb0ca0e240ac7f7c8c60", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 9bb2242..426c191 100644 --- a/flake.nix +++ b/flake.nix @@ -17,27 +17,33 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { nixpkgs, home-manager, + fenix, ... }: + let importConfiguration = directory: let - hostPlatform = import (directory + "/platform.nix"); - # The folder name is the host name of the machine. - hostName = builtins.baseNameOf directory; - userName = import (directory + "/username.nix"); + hostPlatform = import (directory + "/platform.nix"); + # The folder name is the host name of the machine. + hostName = builtins.baseNameOf directory; + userName = import (directory + "/username.nix"); in - { nixosConfigurations.${hostName} = nixpkgs.lib.nixosSystem { specialArgs = { - lib = nixpkgs.lib; + lib = nixpkgs.lib; pkgs = import nixpkgs { system = hostPlatform; @@ -48,16 +54,21 @@ homeManagerConfiguration = attrs: { home-manager.users.${userName} = attrs; }; + + inherit fenix; }; modules = [ directory home-manager.nixosModules.home-manager - # Extra configuration derived from the metadata. { networking.hostName = builtins.baseNameOf directory; + nixpkgs.hostPlatform = hostPlatform; + nixpkgs.overlays = [ + fenix.overlays.default + ]; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; diff --git a/machines/asus/nixpkgs/default.nix b/machines/asus/nixpkgs/default.nix index 4200ba0..ebd9960 100644 --- a/machines/asus/nixpkgs/default.nix +++ b/machines/asus/nixpkgs/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... } @ args: +{ pkgs, fenix, ... } @ args: { environment.systemPackages = import ./packages.nix args; diff --git a/machines/asus/nixpkgs/packages.nix b/machines/asus/nixpkgs/packages.nix index 93b058e..8c5f0bf 100644 --- a/machines/asus/nixpkgs/packages.nix +++ b/machines/asus/nixpkgs/packages.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: with pkgs; [] +{ pkgs, fenix, ... }: with pkgs; [] ++ [ # APPLICATIONS firefox @@ -53,6 +53,14 @@ poetry ] +++ [ (fenix.complete.withComponents [ # RUST + "rustc" + "rust-src" + "cargo" + "rustfmt" + "clippy" +]) ] + ++ [ # SHELLS # nushell # Declared in nushell/. starship