1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 11:07:44 +00:00

Packages: Add rust

This commit is contained in:
RGBCube 2023-05-06 15:29:37 +03:00
parent 1ad15ac013
commit 541767ff37
4 changed files with 67 additions and 9 deletions

39
flake.lock generated
View file

@ -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",

View file

@ -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;

View file

@ -1,4 +1,4 @@
{ pkgs, ... } @ args:
{ pkgs, fenix, ... } @ args:
{
environment.systemPackages = import ./packages.nix args;

View file

@ -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