Nix hm #1

Merged
LarssonMartin1998 merged 106 commits from nix-hm into main 2025-02-25 14:13:05 +00:00
4 changed files with 126 additions and 0 deletions
Showing only changes of commit 24186358fa - Show all commits

48
flake.lock generated Normal file
View file

@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1736785676,
"narHash": "sha256-TY0jUwR3EW0fnS0X5wXMAVy6h4Z7Y6a3m+Yq++C9AyE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "fc52a210b60f2f52c74eac41a8647c1573d2071d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1736883708,
"narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eb62e6aa39ea67e0b8018ba8ea077efe65807dc8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

62
flake.nix Normal file
View file

@ -0,0 +1,62 @@
{
description = "LarssonMartin1998's dotfiles configured with Home Manager";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }:
let
lib = nixpkgs.lib;
# supportedSystems = [
# "x86_64-linux"
# "aarch64-linux"
# "aarch64-darwin"
# ];
makeHomeConfig = {
name,
system,
extraModules ? []
}:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { inherit system; };
modules = [
./nix/home.nix
./nix/local_machine.nix
]
++ extraModules
++ lib.optional (builtins.match ".*-darwin$" system != null) ./nix/darwin.nix
++ lib.optional (builtins.match ".*-linux$" system != null) ./nix/linux.nix;
};
in {
homeConfigurations = {
"wsl" = makeHomeConfig {
name = "wsl";
system = "x86_64-linux";
extraModules = [ ./nix/wsl.nix ];
};
"linux-x86" = makeHomeConfig {
name = "linux-x86";
system = "x86_64-linux";
};
"linux-aarch64" = makeHomeConfig {
name = "linux-aarch64";
system = "aarch64-linux";
};
"darwin-aarch64" = makeHomeConfig {
name = "darwin-aarch64";
system = "aarch64-darwin";
};
};
};
}

5
nix/home.nix Normal file
View file

@ -0,0 +1,5 @@
{ ... }: {
home = {
stateVersion = "24.05";
};
}

11
nix/local_machine.nix Normal file
View file

@ -0,0 +1,11 @@
{ ... }: {
# local-machine.nix
# This is a template file that is committed to git with minimal changes.
# In order to use this and remain pure, each machine needs to create a local branch, i.e `machine-wsl` and set these variables
# accordingly, and then commit it.
home = {
# Stub values for demonstration. Override these in local branch.
username = "nixos";
homeDirectory = "/home/nixos";
};
}