diff --git a/README.md b/README.md index b2741b0..8b157eb 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,15 @@ Then I created [superior dotfiles](https://github.com/szymon-jozef/superior_dotf As of today I'm using this repo with home manager. I'm still trying stuff out, but it looks pretty good right now. # How to try this out? -I guess you should [install home manager](https://nix-community.github.io/home-manager/index.xhtml#sec-install-standalone). You can do it on *any* distro! Then you just copy this repo to `~/.config/home-manager` and run +I guess you should [install home manager](https://nix-community.github.io/home-manager/index.xhtml#sec-install-standalone). You can do it on *any* distro, but I only use Arch, so I don't guarantee it will work elsewhere. To try it out just copy this repo to `~/.config/home-manager`, cd there and then run: +## On NixOS ```bash -home-manager switch -b backup +home-manager switch --flake .#nixos -b backup +``` +## On Arch +```bash +home-manager switch --flake .#arch -b backup ``` - --- I hope you'll enjoy it, if you for whatever reason want to try this random ass dotfiles found on the internet… diff --git a/flake.nix b/flake.nix index 65eefd4..4672dd2 100644 --- a/flake.nix +++ b/flake.nix @@ -18,17 +18,42 @@ catppuccin, ... }: + + let + user = "szymon"; + # for git + email = "szymon_jozef@proton.me"; + full_name = "Szymon P"; + in { + homeConfigurations = { + "arch" = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { system = "x86_64-linux"; }; + extraSpecialArgs = { + isNixOS = false; + username = user; + email = email; + full_name = full_name; + }; + modules = [ + ./home.nix + catppuccin.homeModules.catppuccin + ]; - homeConfigurations."szymon" = home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { - system = "x86_64-linux"; }; - - modules = [ - ./home.nix - catppuccin.homeModules.catppuccin - ]; + "nixos" = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { system = "x86_64-linux"; }; + extraSpecialArgs = { + isNixOS = true; + username = user; + email = email; + full_name = full_name; + }; + modules = [ + ./home.nix + catppuccin.homeModules.catppuccin + ]; + }; }; }; } diff --git a/home.nix b/home.nix index 3075459..5c44840 100644 --- a/home.nix +++ b/home.nix @@ -1,10 +1,17 @@ -{ config, pkgs, ... }: +{ + pkgs, + isNixOS, + username, + ... +}: { # Home Manager needs a bit of information about you and the paths it should # manage. - home.username = "szymon"; - home.homeDirectory = "/home/szymon"; + home.username = username; + home.homeDirectory = "/home/${username}"; + + home.file."test-os.txt".text = if isNixOS then "this is nixos" else "this is arch"; nix = { package = pkgs.nix; @@ -60,10 +67,6 @@ VISUAL = "nvim"; }; - home.sessionPath = [ - "/home/szymon/.lmstudio/bin" - ]; - # Let Home Manager install and manage itself. programs.home-manager.enable = true; } diff --git a/modules/ashell.nix b/modules/ashell.nix index f7841d3..c1a6ae8 100644 --- a/modules/ashell.nix +++ b/modules/ashell.nix @@ -1,9 +1,9 @@ -{ ... }: +{ lib, isNixOS, ... }: { programs.ashell = { enable = true; - package = null; + package = lib.mkIf (!isNixOS) null; settings = { outputs = { Targets = [ "DP-1" ]; diff --git a/modules/atuin.nix b/modules/atuin.nix index 9a2da15..1dd8652 100644 --- a/modules/atuin.nix +++ b/modules/atuin.nix @@ -1,4 +1,4 @@ -{ pgks, ... }: +{ ... }: { programs.atuin = { diff --git a/modules/fish.nix b/modules/fish.nix index b31e425..837e20c 100644 --- a/modules/fish.nix +++ b/modules/fish.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ isNixOS, ... }: { programs.fish = { @@ -42,7 +42,9 @@ set -l rel_file (realpath --relative-to=$config_dir $file) - if home-manager switch -b backup + if home-manager switch --flake "$config_dir#${ + if isNixOS then "nixos" else "arch" + }" -b backup git add -A set commit_msg "update: $rel_file" git commit -m "$commit_msg" diff --git a/modules/git.nix b/modules/git.nix index e549d5f..2675194 100644 --- a/modules/git.nix +++ b/modules/git.nix @@ -1,4 +1,9 @@ -{ pkgs, ... }: +{ + pkgs, + full_name, + email, + ... +}: { home.packages = with pkgs; [ @@ -9,8 +14,8 @@ enable = true; settings = { user = { - name = "Szymon P"; - email = "szymon_jozef@proton.me"; + name = full_name; + email = email; }; init.defaultBranch = "master"; push.autoSetupRemote = true; @@ -18,7 +23,7 @@ }; signing = { - key = "szymon_jozef@proton.me"; + key = email; signByDefault = true; }; diff --git a/modules/kitty.nix b/modules/kitty.nix index 57c13b1..a579f42 100644 --- a/modules/kitty.nix +++ b/modules/kitty.nix @@ -1,9 +1,9 @@ -{ lib, ... }: +{ lib, isNixOS, ... }: { - programs.kitty = lib.mkForce { + programs.kitty = { enable = true; - package = null; + package = lib.mkIf (!isNixOS) null; settings = { confirm_os_window_close = 0; dynamic_background_opacity = true; diff --git a/modules/satty.nix b/modules/satty.nix index efa9718..55fc9aa 100644 --- a/modules/satty.nix +++ b/modules/satty.nix @@ -1,15 +1,20 @@ -{ ... }: +{ + lib, + isNixOS, + username, + ... +}: { programs.satty = { enable = true; - package = null; + package = lib.mkIf (!isNixOS) null; settings = { general = { fullscreen = true; early-exit = true; initial-tool = "crop"; - output-filename = "/home/szymon/Obrazy/zrzuty/%d-%m-%Y_%H:%M:%S.png"; + output-filename = "/home/${username}/Obrazy/zrzuty/%d-%m-%Y_%H:%M:%S.png"; save-after-copy = true; disable-notifications = false; actions-on-escape = [ "exit" ]; diff --git a/modules/ssh.nix b/modules/ssh.nix index af2cdda..5a8e017 100644 --- a/modules/ssh.nix +++ b/modules/ssh.nix @@ -1,4 +1,4 @@ -{ args, ... }: +{ username, ... }: { services.ssh-agent.enable = true; @@ -10,13 +10,13 @@ matchBlocks = { "dmowski" = { hostname = "192.168.0.30"; - user = "szymon"; + user = username; port = 22; identityFile = "~/.ssh/dmowski"; }; "aur.archlinux.org" = { - user = "szymon"; + user = username; identityFile = "~/.ssh/aur"; }; diff --git a/modules/yazi.nix b/modules/yazi.nix index f5edc51..82d46e9 100644 --- a/modules/yazi.nix +++ b/modules/yazi.nix @@ -1,4 +1,4 @@ -{ pgks, ... }: +{ ... }: { programs.yazi = {