aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2026-03-21 12:03:43 +0100
committerGitHub <noreply@github.com>2026-03-21 12:03:43 +0100
commitecfe68dbe12dfdd58125e0f0bcd047832189b04a (patch)
treef725d2ce55b0d8c634499142169856e6f1cd24d6
parent011486787f639f2d2474bbaf5a6ef3d77fb45a43 (diff)
downloaddotfiles-ecfe68dbe12dfdd58125e0f0bcd047832189b04a.tar.gz
dotfiles-ecfe68dbe12dfdd58125e0f0bcd047832189b04a.zip
Extend dotfiles to support Linux via standalone home-manager (#6)
-rw-r--r--README.md22
-rw-r--r--flake.nix12
-rw-r--r--modules/home/default.nix2
-rw-r--r--modules/home/git.nix7
4 files changed, 35 insertions, 8 deletions
diff --git a/README.md b/README.md
index 3ac45ac..8f41851 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# dotfiles
-My Development Setup, managed with [Nix](https://nixos.org), [nix-darwin](https://github.com/LnL7/nix-darwin), and [home-manager](https://github.com/nix-community/home-manager).
+My Development Setup, managed with [Nix](https://nixos.org), [nix-darwin](https://github.com/LnL7/nix-darwin), and [home-manager](https://github.com/nix-community/home-manager). Works on macOS and Linux.
## Quickstart
@@ -20,6 +20,8 @@ git submodule update --init --recursive
### 3. Apply the configuration
+#### macOS
+
On first run, bootstrap nix-darwin:
```shell
@@ -32,18 +34,30 @@ On subsequent runs:
darwin-rebuild switch --flake .#default
```
+#### Linux
+
+Install [home-manager](https://github.com/nix-community/home-manager) as a standalone tool and apply the configuration:
+
+```shell
+# x86_64 (most common)
+home-manager switch --flake .#simenandre
+
+# aarch64 (ARM64, e.g. Raspberry Pi or ARM cloud instances)
+home-manager switch --flake .#simenandre@aarch64-linux
+```
+
## Structure
```
-flake.nix # Entry point – nix-darwin + home-manager
+flake.nix # Entry point – nix-darwin (macOS) + home-manager (macOS & Linux)
modules/
darwin/
default.nix # System-level configuration (nix settings, core packages)
homebrew.nix # Homebrew packages (taps, brews, casks, Mac App Store)
macos.nix # macOS system defaults (replaces macos/macos script)
home/
- default.nix # home-manager entry point
- git.nix # Git configuration (programs.git)
+ default.nix # home-manager entry point (platform-aware home directory)
+ git.nix # Git configuration (platform-aware SSH signing path)
zsh.nix # Zsh configuration files
starship.nix # Starship prompt configuration
tmux.nix # Tmux configuration
diff --git a/flake.nix b/flake.nix
index fa2e203..0e5bab4 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,5 +1,5 @@
{
- description = "Simen Andre's macOS configuration";
+ description = "Simen Andre's dotfiles configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
@@ -35,5 +35,15 @@
}
];
};
+
+ homeConfigurations."simenandre" = home-manager.lib.homeManagerConfiguration {
+ pkgs = nixpkgs.legacyPackages."x86_64-linux";
+ modules = [ ./modules/home ];
+ };
+
+ homeConfigurations."simenandre@aarch64-linux" = home-manager.lib.homeManagerConfiguration {
+ pkgs = nixpkgs.legacyPackages."aarch64-linux";
+ modules = [ ./modules/home ];
+ };
};
}
diff --git a/modules/home/default.nix b/modules/home/default.nix
index 1c0ae0e..bf1900d 100644
--- a/modules/home/default.nix
+++ b/modules/home/default.nix
@@ -11,7 +11,7 @@
home = {
username = "simenandre";
- homeDirectory = "/Users/simenandre";
+ homeDirectory = if pkgs.stdenv.isDarwin then "/Users/simenandre" else "/home/simenandre";
# Do not change this after the first installation
stateVersion = "24.11";
};
diff --git a/modules/home/git.nix b/modules/home/git.nix
index b42161e..e79a760 100644
--- a/modules/home/git.nix
+++ b/modules/home/git.nix
@@ -1,4 +1,4 @@
-{ ... }:
+{ pkgs, ... }:
{
programs.git = {
@@ -40,7 +40,10 @@
merge.log = true;
push.autoSetupRemote = true;
gpg.format = "ssh";
- "gpg \"ssh\"".program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
+ "gpg \"ssh\"".program =
+ if pkgs.stdenv.isDarwin
+ then "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
+ else "/opt/1Password/op-ssh-sign";
github.user = "simenandre";
pull.rebase = true;
"url \"ssh://git@github.com/\"".insteadOf = "https://github.com/";