Attempt 2

This commit is contained in:
Benson Chu 2024-01-06 11:43:06 -06:00
parent 7b106dac22
commit 6b9ff1b8cb
7 changed files with 42 additions and 79 deletions

View file

@ -16,6 +16,7 @@
outputs = { self, nixpkgs, unstable, home-manager, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
unstable-overlay = final: prev: {
unstable = import unstable {
inherit system;
@ -63,5 +64,11 @@
# system = "x86_64-linux";
# modules = [ ./hosts/NixFrame/configuration.nix ];
# };
homeConfigurations."benson" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
specialArgs = { inherit inputs };
modules = [ ./home/home.nix ];
};
};
}

View file

@ -1,48 +0,0 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1704358952,
"narHash": "sha256-yazDFmdyKr0JGMqmzQ5bYOW5FWvau8oFvsQ8eSB2f3A=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c36cb65c4a0ba17ab9262ab3c30920429348746c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1704194953,
"narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,29 +0,0 @@
{
description = "Home Manager configuration of benson";
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
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations."benson" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ ./home.nix ];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
};
};
}

View file

@ -1,11 +1,16 @@
{ config, pkgs, ... }:
{
imports = [
./modules/
];
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "benson";
home.homeDirectory = "/home/benson";
my.bash-config.enable = true;
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.

30
home/modules/default.nix Normal file
View file

@ -0,0 +1,30 @@
# What's the difference between lib and pkg?
{ config, lib, ... }:
{
# For each found file/folder, make it an absolute path by adding
# "./." to the front.
imports = map (x: ./. + "/${x}") (
lib.attrNames (
# Don't include default.nix, and files that don't end with
# .nix. This means every subfolder MUST have a
# default.nix.
#
# Perhaps, there's a way to do a tree traversal and grab ALL
# .nix files?
lib.filterAttrs
(
n: t: n != "default.nix" && (
t == "directory" || lib.hasSuffix ".nix" n
)
)
# Extract all files and folders in module directory. Returns
# an attribute map with file name as key, and file type as
# value.
#
# For some reason, the current directory is denoted as "./."
# instead of "./". Why?
(builtins.readDir ./.)
)
);
}

View file

@ -16,8 +16,6 @@ in
networking.hostName = "NixFrame"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
my.bash-config.enable = true;
home-manager.users.benson = { ... }: {
home.stateVersion = "23.11";
};