HOME-MANAGER-FREE

This commit is contained in:
Charlie Root 2024-11-05 23:30:23 +01:00
commit a0c0278ae8
Signed by: faukah
SSH key fingerprint: SHA256:jpYIt4Vkz1NBTQcks/N9OPTfTFxE6KF2W/rV7hrfrIw
11 changed files with 263 additions and 212 deletions

23
flake.lock generated
View file

@ -279,26 +279,6 @@
} }
}, },
"home-manager": { "home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1730633670,
"narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"schizofox", "schizofox",
@ -749,7 +729,6 @@
"root": { "root": {
"inputs": { "inputs": {
"helix": "helix", "helix": "helix",
"home-manager": "home-manager",
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprland-plugins": "hyprland-plugins", "hyprland-plugins": "hyprland-plugins",
"hyprsplit": "hyprsplit", "hyprsplit": "hyprsplit",
@ -787,7 +766,7 @@
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"home-manager": "home-manager_2", "home-manager": "home-manager",
"nixpak": "nixpak", "nixpak": "nixpak",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"

View file

@ -30,10 +30,6 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Hyprland, my main compositor # Hyprland, my main compositor
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland";

View file

@ -99,9 +99,6 @@ in {
username = "cr"; username = "cr";
}; };
home-manager = {
enable = true;
};
}; };
programs = { programs = {
ssh.enable = true; ssh.enable = true;

View file

@ -9,6 +9,7 @@
difftastic difftastic
distrobox distrobox
element-desktop element-desktop
equibop
evince evince
eza eza
gcc gcc

View file

@ -1,95 +0,0 @@
# This is 1:1 copied from https://github.com/sioodmy/homix.
# I simply put it here because it's not changing in any way anymore and i save myself a flake input this way.
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkOption mkEnableOption types filterAttrs attrValues mkIf mkDerivedConfig;
inherit (builtins) map listToAttrs attrNames;
in {
options = {
homix = mkOption {
default = {};
type = types.attrsOf (types.submodule ({
name,
config,
options,
...
}: {
options = {
path = mkOption {
type = types.str;
description = ''
Path to the file relative to the $HOME directory.
If not defined, name of attribute set will be used.
'';
};
source = mkOption {
type = types.path;
description = "Path of the source file or directory.";
};
text = mkOption {
default = null;
type = types.nullOr types.lines;
description = "Text of the file.";
};
};
config = {
path = lib.mkDefault name;
source = mkIf (config.text != null) (
let
name' = "homix-" + lib.replaceStrings ["/"] ["-"] name;
in
mkDerivedConfig options.text (pkgs.writeText name')
);
};
}));
};
users.users = mkOption {
type = types.attrsOf (types.submodule {
options.homix = mkEnableOption "Enable homix for selected user";
});
};
};
config = let
# list of users managed by homix
users = attrNames (filterAttrs (name: user: user.homix) config.users.users);
homix-link = let
files = map (f: ''
FILE=$HOME/${f.path}
mkdir -p $(dirname $FILE)
ln -sf ${f.source} $FILE
'') (attrValues config.homix);
in
pkgs.writeShellScript "homix-link" ''
#!/bin/sh
${builtins.concatStringsSep "\n" files}
'';
mkService = user: {
name = "homix-${user}";
value = {
wantedBy = ["multi-user.target"];
description = "Setup homix environment for ${user}.";
serviceConfig = {
Type = "oneshot";
User = "${user}";
ExecStart = "${homix-link}";
};
environment = {
# epic systemd momento
HOME = config.users.users.${user}.home;
};
};
};
services = listToAttrs (map mkService users);
in {
systemd.services = services;
};
}

View file

@ -2,7 +2,7 @@ _: {
imports = [ imports = [
# ./home-manager.nix # ./home-manager.nix
./system.nix ./system.nix
./xdg.nix # ./xdg.nix
./git.nix ./git.nix
./users.nix ./users.nix
]; ];

View file

@ -19,7 +19,6 @@ in {
"audio" "audio"
"nix" "nix"
]; ];
homix = true;
shell = self.packages.${pkgs.stdenv.system}.fish; shell = self.packages.${pkgs.stdenv.system}.fish;
# hashedPasswordFile = "/etc/passwords/cr"; # hashedPasswordFile = "/etc/passwords/cr";
}; };

View file

@ -186,16 +186,6 @@ in {
hostInfo = "helix"; hostInfo = "helix";
}; };
}; };
# vscode-css-language-server = {
# command = "${pkgs.nodePackages.vscode-langservers-extracted}/bin/vscode-css-languageserver";
# args = ["--stdio"];
# config = {
# provideFormatter = true;
# css.validate.enable = true;
# scss.validate.enable = true;
# };
# };
}; };
}; };
}; };

View file

@ -6,14 +6,245 @@
... ...
}: let }: let
cfg = config.modules.system.programs.editors.helix; cfg = config.modules.system.programs.editors.helix;
inherit (config.modules.other.system) username;
inherit (lib) mkIf getExe; inherit (lib) mkIf getExe;
inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix; inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix;
toml = pkgs.formats.toml {};
helix-config = {
theme = "catppuccin_mocha";
editor = {
cursorline = false;
color-modes = true;
indent-guides.render = true;
lsp = {
display-inlay-hints = true;
display-messages = true;
};
line-number = "relative";
true-color = true;
auto-format = true;
completion-timeout = 5;
mouse = true;
bufferline = "multiple";
soft-wrap.enable = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
statusline = {
left = ["spinner" "version-control" "diagnostics" "file-name"];
right = ["file-base-name" "file-type" "position" "file-encoding"];
};
gutters.layout = ["diff" "diagnostics" "line-numbers" "spacer"];
inline-diagnostics = {
cursor-line = "hint";
other-lines = "error";
};
};
keys = {
normal = {
space.g = [":new" ":insert-output XDG_CONFIG_HOME=~/.config ${getExe pkgs.lazygit}" ":buffer-close!" ":redraw"];
esc = ["collapse_selection" "keep_primary_selection" "normal_mode"];
A-H = "goto_previous_buffer";
A-L = "goto_next_buffer";
A-w = ":buffer-close";
A-f = ":format";
A-r = ":reload";
A-x = "extend_to_line_bounds";
X = ["extend_line_up" "extend_to_line_bounds"];
};
select = {
A-x = "extend_to_line_bounds";
X = ["extend_line_up" "extend_to_line_bounds"];
};
};
};
helix-languages = {
language = let
extraFormatter = lang: {
command = getExe pkgs.deno;
args = ["fmt" "-" "--ext" lang];
};
in [
{
name = "bash";
auto-format = true;
formatter = {
command = getExe pkgs.shfmt;
args = ["-i" "2"];
};
}
{
name = "clojure";
injection-regex = "(clojure|clj|edn|boot|yuck)";
file-types = ["clj" "cljs" "cljc" "clje" "cljr" "cljx" "edn" "boot" "yuck"];
}
{
name = "cmake";
auto-format = true;
language-servers = ["cmake-language-server"];
formatter = {
command = getExe pkgs.cmake-format;
args = ["-"];
};
}
{
name = "javascript";
auto-format = true;
language-servers = ["dprint" "typescript-language-server"];
}
{
name = "json";
formatter = extraFormatter "json";
}
{
name = "markdown";
auto-format = true;
formatter = extraFormatter "md";
}
{
name = "python";
language-servers = ["pyright"];
formatter = {
command = getExe pkgs.black;
args = ["-" "--quiet" "--line-length 100"];
};
}
{
name = "typescript";
auto-format = true;
language-servers = ["dprint" "typescript-language-server"];
}
{
name = "rust";
debugger = {
command = "${pkgs.lldb_19}/bin/lldb-dap";
name = "lldb";
transport = "stdio";
templates = [
{
name = "binary";
request = "launch";
completion = [
{
name = "binary";
completion = "filename";
}
];
args = {
program = "{0}";
runInTerminal = true;
};
}
];
};
}
{
name = "c";
debugger = {
name = "gdb";
command = "${pkgs.gdb}/bin/gdb";
transport = "stdio";
templates = [
{
name = "binary";
request = "launch";
completion = [
{
name = "binary";
completion = "filename";
}
];
args = {
program = "{0}";
runInTerminal = true;
};
}
];
};
}
];
language-server = {
bash-language-server = {
command = getExe pkgs.bash-language-server;
args = ["start"];
};
clangd = {
command = "${pkgs.clang-tools}/bin/clangd";
clangd.fallbackFlags = ["-std=c++2b"];
};
cmake-language-server = {
command = getExe pkgs.cmake-language-server;
};
dprint = {
command = getExe pkgs.dprint;
args = ["lsp"];
};
nil = {
command = getExe pkgs.nil;
# alejandro
config.nil.formatting.command = ["${getExe pkgs.alejandra}" "-q"];
};
qmlls = {
command = "${pkgs.kdePackages.full}/bin/qmlls";
};
pyright = {
command = "${pkgs.pyright}/bin/pyright-langserver";
args = ["--stdio"];
config = {
reportMissingTypeStubs = false;
analysis = {
typeCheckingMode = "basic";
autoImportCompletions = true;
};
};
};
typescript-language-server = {
command = getExe pkgs.typescript-language-server;
args = ["--stdio"];
config = let
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
in {
typescript-language-server.source = {
addMissingImports.ts = true;
fixAll.ts = true;
organizeImports.ts = true;
removeUnusedImports.ts = true;
sortImports.ts = true;
};
typescript = {inherit inlayHints;};
javascript = {inherit inlayHints;};
hostInfo = "helix";
};
};
};
};
wrapped-helix = pkgs.symlinkJoin { wrapped-helix = pkgs.symlinkJoin {
name = "helix-wrapped"; name = "helix-wrapped";
paths = with pkgs; [ paths = with pkgs; [
helix helix
# typst lsp
tinymist
# C/C++ # C/C++
clang-tools clang-tools
@ -29,66 +260,19 @@
# Shell # Shell
shellcheck shellcheck
]; ];
buildInputs = [pkgs.makeWrapper];
postBuild = ''
mkdir -p $out/config/helix
cp "${toml.generate "config.toml" helix-config}" $out/config/helix/config.toml
cp "${toml.generate "languages.toml" helix-languages}" $out/config/helix/languages.toml
wrapProgram $out/bin/hx --set \
XDG_CONFIG_HOME $out/config
'';
}; };
in { in {
imports = [./languages.nix];
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${username} = { environment.systemPackages = [
programs.helix = { wrapped-helix
enable = true; ];
package = wrapped-helix;
settings = {
theme = "catppuccin_mocha";
editor = {
cursorline = false;
color-modes = true;
indent-guides.render = true;
lsp = {
display-inlay-hints = true;
display-messages = true;
};
line-number = "relative";
true-color = true;
auto-format = true;
completion-timeout = 5;
mouse = true;
bufferline = "multiple";
soft-wrap.enable = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
statusline = {
left = ["spinner" "version-control" "diagnostics" "file-name"];
right = ["file-base-name" "file-type" "position" "file-encoding"];
};
gutters.layout = ["diff" "diagnostics" "line-numbers" "spacer"];
inline-diagnostics = {
cursor-line = "hint";
other-lines = "error";
};
};
keys = {
normal = {
space.g = [":new" ":insert-output ${getExe pkgs.lazygit}" ":buffer-close!" ":redraw"];
esc = ["collapse_selection" "keep_primary_selection" "normal_mode"];
A-H = "goto_previous_buffer";
A-L = "goto_next_buffer";
A-w = ":buffer-close";
A-f = ":format";
A-r = ":reload";
A-x = "extend_to_line_bounds";
X = ["extend_line_up" "extend_to_line_bounds"];
};
select = {
A-x = "extend_to_line_bounds";
X = ["extend_line_up" "extend_to_line_bounds"];
};
};
};
};
};
}; };
} }

View file

@ -9,21 +9,21 @@
cfg = config.modules.usrEnv.programs.launchers.fuzzel; cfg = config.modules.usrEnv.programs.launchers.fuzzel;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${username} = { # home-manager.users.${username} = {
programs.fuzzel = { # programs.fuzzel = {
enable = true; # enable = true;
package = pkgs.fuzzel; # package = pkgs.fuzzel;
settings = { # settings = {
main = { # main = {
terminal = "${pkgs.foot}/bin/foot -e"; # terminal = "${pkgs.foot}/bin/foot -e";
# make fuzzel appear on fullscreen windows # # make fuzzel appear on fullscreen windows
layer = "overlay"; # layer = "overlay";
icon-theme = "Papirus-Dark"; # icon-theme = "Papirus-Dark";
font = "Lexend:weight=regular:size=14"; # font = "Lexend:weight=regular:size=14";
}; # };
# background = "000000"; # # background = "000000";
}; # };
}; # };
}; # };
}; };
} }

View file

@ -14,7 +14,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${username} = { home-manager.users.${username} = {
services.dunst = { services.dunst = {
enable = true; enable = false;
package = pkgs.dunst; package = pkgs.dunst;
settings = { settings = {
global = { global = {