[feat] Fix the nix config for desktop

This commit is contained in:
uttarayan21
2024-02-18 00:35:42 +05:30
parent 6d0526ab07
commit e94126de33
8 changed files with 450 additions and 84 deletions

View File

@@ -2,33 +2,46 @@
description = "Home Manager configuration of fs0c131y";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
# flake-utils.url = "github:numtide/flake-utils";
anyrun = {
url = "github:Kirottu/anyrun";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
# nixos,
home-manager,
nix-darwin,
flake-utils,
anyrun,
neovim-nightly-overlay,
...
} @ inputs: let
devices = [
config_devices = [
{
name = "mirai";
system = "x86_64-linux";
user = "fs0c131y";
}
{
name = "ryu";
system = "x86_64-linux";
user = "servius";
isNix = true;
}
{
name = "genzai";
system = "x86_64-linux";
@@ -45,15 +58,69 @@
user = "deck";
}
];
linux = builtins.filter (x: x.system == "x86_64-linux") devices;
darwin = builtins.filter (x: x.system == "aarch64-darwin") devices;
mkDevice = {device, ...}: {
isLinux = !isNull (builtins.match ".*-linux" device.system);
isNix =
if (builtins.hasAttr "isNix" device)
then device.isNix
else false;
isMac = !isNull (builtins.match ".*-darwin" device.system);
system = device.system;
name = device.name;
user = device.user;
};
devices = builtins.map (device: mkDevice {inherit device;}) config_devices;
nixos_devices = builtins.filter (x: x.isNix) devices;
linux_devices = builtins.filter (x: x.isLinux) devices;
darwin_devices = builtins.filter (x: x.isMac) devices;
anyrun-overlay = final: prev: {
anyrun = inputs.anyrun.packages.${prev.system}.anyrun;
};
overlays = [
inputs.neovim-nightly-overlay.overlay
anyrun-overlay
# inputs.anyrun.overlays
];
in {
nixosConfigurations =
builtins.listToAttrs
(builtins.map
(device: {
name = device.name;
value = nixpkgs.lib.nixosSystem {
system = device.system;
# system.packages = [anyrun.packages.${device.system}.anyrun];
specialArgs = {inherit device;};
modules = [
{nixpkgs.overlays = overlays;}
./nixos/configuration.nix
home-manager.nixosModules.home-manager
{
nixpkgs.config.allowUnfree = true;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
inherit device;
};
users.${device.user}.imports = [./common/home.nix];
};
}
];
};
})
nixos_devices);
homeConfigurations = builtins.listToAttrs (builtins.map
(device: {
name = device.user;
value = let
pkgs = nixpkgs.legacyPackages.${device.system};
overlays = [inputs.neovim-nightly-overlay.overlay];
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
@@ -61,6 +128,7 @@
inherit device;
};
modules = [
{nixpkgs.overlays = overlays;}
./common/home.nix
{
nixpkgs.overlays = overlays;
@@ -68,7 +136,7 @@
];
};
})
linux);
linux_devices);
darwinConfigurations =
builtins.listToAttrs
@@ -77,15 +145,14 @@
name = device.name;
value = let
pkgs = nixpkgs.legacyPackages.${device.system};
overlays = [inputs.neovim-nightly-overlay.overlay];
in
nix-darwin.lib.darwinSystem {
inherit pkgs;
modules = [
{nixpkgs.overlays = overlays;}
./darwin
home-manager.darwinModules.home-manager
{
nixpkgs.overlays = overlays;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
@@ -98,6 +165,6 @@
];
};
})
darwin);
darwin_devices);
};
}