Migrate to nix flakes

This commit is contained in:
Spotlight 2023-07-04 03:35:37 -05:00
parent e88bd7593f
commit e237c5dd4b
8 changed files with 326 additions and 201 deletions

51
flake.nix Normal file
View file

@ -0,0 +1,51 @@
{
description = "Spotlight's dotfiles";
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";
};
};
outputs = { nixpkgs, home-manager, ... }:
let
homeManager = { system, specialArgs ? {
dotfilesOnly = false;
} }:
home-manager.lib.homeManagerConfiguration {
modules = [
./home/home.nix
];
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = specialArgs;
};
in {
packages = {
# We currently assume that all x86_64-linux devices only
# require dotfiles. For now, this is mostly true :)
x86_64-linux.homeConfigurations.spotlight = homeManager {
system = "x86_64-linux";
specialArgs.dotfilesOnly = true;
};
# Similarly (as of writing), all aarch64 Linux devices are headless
# and primarily managed by other distro package managers.
# This should likely be dealt with in the future!
aarch64-linux.homeConfigurations.spotlight = homeManager {
system = "aarch64-linux";
specialArgs.dotfilesOnly = true;
};
# For all architecture variants of Darwin, we don't want only dotfiles.
aarch64-darwin.homeConfigurations.spot = homeManager {
system = "aarch64-darwin";
};
x86_64-darwin.homeConfigurations.spot = homeManager {
system = "x86_64-darwin";
};
};
};
}