Skip to content

Commit

Permalink
feat(nix): mkHome
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamHsieh committed Sep 5, 2024
1 parent 5ba2ddc commit 4374726
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
# os: [ubuntu-latest, macos-latest]
# target: [william, nixos-local, macos-local]
include:
Expand Down
33 changes: 1 addition & 32 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,43 +43,12 @@

outputs = inputs @ { self, nixpkgs, home-manager, ... }:
with self.lib;
let
system = "x86_64-linux";
foreachSystem = genAttrs [ "x86_64-linux" "aarch64-darwin" ];

username = (import ./home/config.nix).user;

# https://github.com/nix-community/home-manager/issues/2942#issuecomment-1378627909
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
packageOverrides = pkgs: {
unstable = import inputs.nixpkgs-unstable {
inherit (pkgs) system config;
};
};
};
};

inherit (self) outputs;
in
{
lib = import ./lib { inherit inputs; } // inputs.nixpkgs.lib;

# packages.${system}.default = home-manager.defaultPackage.${system};

homeConfigurations = {
${username} = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs outputs; };

modules = [
./home
];
};
};
homeConfigurations = mkHome { };

nixosConfigurations = mkSystem {
type = "nixos";
Expand Down
12 changes: 12 additions & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ in
{
stateVersion = "${builtins.elemAt (lib.splitString "-" lockfile.nodes.home-manager.original.ref) 1}";

mkHome = { system ? "x86_64-linux" }:
{
${dotfiles.home.username} = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = pkgsBySystem.${system};
extraSpecialArgs = { inherit inputs; };

modules = [
./home
];
};
};

mkSystem = { type }:
let
# TODO: assert type is either "darwin" or "nixos"
Expand Down

0 comments on commit 4374726

Please sign in to comment.