refactor: Move nix outside of .config dir

Technically not a config but a compose file, so I think it's better to
have outside of `.config` dir
This commit is contained in:
Ahmad Ansori Palembani 2024-11-05 13:53:13 +07:00
parent 3484b4154a
commit 93a26accd1
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
22 changed files with 0 additions and 0 deletions

67
nix/users/default.nix Normal file
View file

@ -0,0 +1,67 @@
{ inputs, nixpkgs-stable, nixpkgs-unstable, home-manager, nur, vars, ... }:
let
mkSystem = import ../lib/mkSystem.nix;
mkBrew = import ../overlays/darwin/brew.nix;
in
{
# Host list
# Build with: `home-manager build --flake .#<user>@<host>`
# e.g. `home-manager build --flake .#"ziro@ThiccBook-Pro"`
# Switch to current build: `home-manager switch --flake .#<user>@<host>`
#
# If you're feeling lucky `home-manager build --flake .` or
# `home-manager switch --flake .` should be enough, since home-manager will
# search the correct <user>@<host> on its own.
#
# You may need to run `scutil --set HostName <host>` if home-manager can't
# find your <user>@<host>.
"ziro@ThiccBook-Pro" =
let
system = "x86_64-darwin";
inherit (
mkSystem {
arch = system;
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
extraOverlays = [
inputs.firefox-darwin.overlay
(mkBrew { inherit system; brew-api = inputs.brew-api; nixpkgs = nixpkgs-stable; })
];
nur = nur;
}
) pkgs pkgs-unstable;
vars.floorp.verticalTabHoverWidthInEm = 28;
in
home-manager.lib.homeManagerConfiguration {
pkgs = pkgs-unstable; # FIXME: switch to stable when 24.11 become stable
extraSpecialArgs = { inherit inputs pkgs pkgs-unstable home-manager vars; };
modules = [
./ziro
./ziro/darwin.nix
../modules/home-manager/floorp.nix
];
};
"ziro@potato" =
let
inherit (
mkSystem {
arch = "x86_64-linux";
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
nur = nur;
}
) system pkgs pkgs-unstable;
in
home-manager.lib.homeManagerConfiguration {
pkgs = pkgs-unstable; # FIXME: switch to stable when 24.11 become stable
extraSpecialArgs = { inherit inputs pkgs pkgs-unstable home-manager vars; };
modules = [
./ziro
./ziro/linux.nix
../modules/home-manager/floorp.nix
];
};
}

50
nix/users/ziro/darwin.nix Normal file
View file

@ -0,0 +1,50 @@
{ pkgs, pkgs-unstable, config, vars, lib, ... }:
{
home.homeDirectory = "/Users/ziro";
home.packages = lib.mkAfter
[
pkgs.casks.vscodium
];
programs.browserpass = {
enable = true;
browsers = [ "brave" "chrome" ]; # Arc and Chrome share the same `Application Support` dir, not sure why tbh.
};
home.file."Library/Application Support/Floorp/native-messaging-hosts/passff.json".source = "${pkgs.passff-host}/share/passff-host/passff.json";
# Swap CapsLock with Esc for better vi-mode experience.
launchd.agents.CapsEscSwap = {
enable = true;
config = {
ProgramArguments = [
"/usr/bin/hidutil"
"property"
"--set"
''{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029},{"HIDKeyboardModifierMappingSrc":0x700000029,"HIDKeyboardModifierMappingDst":0x700000039}]}''
];
RunAtLoad = true;
};
};
home.sessionVariables.MOZ_LEGACY_PROFILES = 1;
home.activation.applications = let
env = pkgs.buildEnv {
name = "home-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
echo "setting up ${config.home.homeDirectory}/Applications..." >&2
rm -rf "${config.home.homeDirectory}/Applications/Nix Home Manager Apps"
mkdir -p "${config.home.homeDirectory}/Applications/Nix Home Manager Apps"
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read src; do
app_name=$(basename "$src")
echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "${config.home.homeDirectory}/Applications/Nix Home Manager Apps/$app_name"
done
'';
}

View file

@ -0,0 +1,48 @@
{ pkgs, pkgs-unstable, config, vars, ... }:
let
username = "ziro";
userChrome = builtins.replaceStrings ["/*ZI:VERTICAL-TAB-HOVER-WIDTH-IN-EM*/"] ["${builtins.toString vars.floorp.verticalTabHoverWidthInEm}em"] (builtins.readFile ../../files/floorp/ziro-userChrome.css);
settings = {
"browser.toolbars.bookmarks.visibility" = "newtab";
"floorp.browser.sidebar.is.displayed" = false;
"floorp.browser.tabbar.settings" = 2;
"floorp.browser.tabs.verticaltab" = true;
"floorp.verticaltab.hover.enabled" = true;
"floorp.tabbar.style" = 2;
"network.dns.disableIPv6" = true;
"sidebar.position_start" = false;
"signon.management.page.breach-alerts.enabled" = false;
"signon.rememberSignons" = false;
"extensions.autoDisableScopes" = 0; # Auto enable extensions
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
passff
ublock-origin
];
in {
home = {
inherit username;
packages =
[
pkgs.passff-host
];
};
programs.floorp.profiles.${username} = {
inherit userChrome settings extensions;
};
programs.floorp.profiles.null = {
id = 1;
inherit userChrome settings extensions;
};
xdg.configFile = {
"nix/nix.conf".text =
''
experimental-features = nix-command flakes
'';
};
home.stateVersion = "24.11";
}

7
nix/users/ziro/linux.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs, pkgs-unstable, config, vars, ... }:
{
home.homeDirectory = "/home/ziro";
home.file.".floorp/native-messaging-hosts/passff.json".source = "${pkgs.passff-host}/share/passff-host/passff.json";
}