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": {
"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": {
"nixpkgs": [
"schizofox",
@ -749,7 +729,6 @@
"root": {
"inputs": {
"helix": "helix",
"home-manager": "home-manager",
"hyprland": "hyprland",
"hyprland-plugins": "hyprland-plugins",
"hyprsplit": "hyprsplit",
@ -787,7 +766,7 @@
"inputs": {
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"home-manager": "home-manager_2",
"home-manager": "home-manager",
"nixpak": "nixpak",
"nixpkgs": [
"nixpkgs"

View file

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

View file

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

View file

@ -9,6 +9,7 @@
difftastic
distrobox
element-desktop
equibop
evince
eza
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 = [
# ./home-manager.nix
./system.nix
./xdg.nix
# ./xdg.nix
./git.nix
./users.nix
];

View file

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

View file

@ -186,16 +186,6 @@ in {
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,39 +6,10 @@
...
}: let
cfg = config.modules.system.programs.editors.helix;
inherit (config.modules.other.system) username;
inherit (lib) mkIf getExe;
inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix;
wrapped-helix = pkgs.symlinkJoin {
name = "helix-wrapped";
paths = with pkgs; [
helix
# C/C++
clang-tools
# Markdown
marksman
# Nix
nil
lldb_19
# Bash
bash-language-server
# Shell
shellcheck
];
};
in {
imports = [./languages.nix];
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.helix = {
enable = true;
package = wrapped-helix;
settings = {
toml = pkgs.formats.toml {};
helix-config = {
theme = "catppuccin_mocha";
editor = {
cursorline = false;
@ -72,7 +43,7 @@ in {
};
keys = {
normal = {
space.g = [":new" ":insert-output ${getExe pkgs.lazygit}" ":buffer-close!" ":redraw"];
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";
@ -88,7 +59,220 @@ in {
};
};
};
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 {
name = "helix-wrapped";
paths = with pkgs; [
helix
# typst lsp
tinymist
# C/C++
clang-tools
# Markdown
marksman
# Nix
nil
lldb_19
# Bash
bash-language-server
# Shell
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 {
config = mkIf cfg.enable {
environment.systemPackages = [
wrapped-helix
];
};
}

View file

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

View file

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