Skip to content

Commit

Permalink
docs/examples: add flake-parts (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruixi-rebirth authored May 1, 2024
1 parent b1aa92b commit 891b548
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 34 deletions.
3 changes: 3 additions & 0 deletions nixd/docs/editors/nvim-lsp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ let
home_manager = {
expr = '(builtins.getFlake "/tmp/NixOS_Home-Manager").homeConfigurations."user@hostname".options',
},
flake_parts = {
expr = 'let flake = builtins.getFlake ("/tmp/NixOS_Home-Manager"); in flake.debug.options // flake.currentSystem.options',
},
},
},
},
Expand Down
49 changes: 43 additions & 6 deletions nixd/docs/examples/NixOS_Home-Manager/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 37 additions & 28 deletions nixd/docs/examples/NixOS_Home-Manager/flake.nix
Original file line number Diff line number Diff line change
@@ -1,43 +1,52 @@
{
description = "A simple flake for NixOS and Home Manager";
description = "A simple flake for NixOS and Home Manager using flake-parts";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
};

outputs = { self, nixpkgs, home-manager, ... }:
{
nixosConfigurations = {
hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }: {
networking.hostName = "hostname";
environment.systemPackages = with pkgs; [
nixd
];
})
];
outputs = inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
debug = true;

systems = [ "x86_64-linux" ];

perSystem = { config, ... }: { };

flake = {
nixosConfigurations = {
hostname = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }: {
networking.hostName = "hostname";
environment.systemPackages = with pkgs; [
nixd
];
})
];
};
};
};

homeConfigurations = {
"user@hostname" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
{
home.stateVersion = "24.05";
home.username = "user";
home.homeDirectory = "/home/user";
}
({ pkgs, ... }: {
wayland.windowManager.hyprland.enable = true;
})
];
homeConfigurations = {
"user@hostname" = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
modules = [
{
home.stateVersion = "24.05";
home.username = "user";
home.homeDirectory = "/home/user";
}
({ pkgs, ... }: {
wayland.windowManager.hyprland.enable = true;
})
];
};
};
};
};
Expand Down

0 comments on commit 891b548

Please sign in to comment.