diff --git a/.gitignore b/.gitignore index 6ae4d14..ded2432 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /.direnv -**/.qmlls.ini +.qmlls.ini diff --git a/default.nix b/default.nix index 0f8f44e..2a8d007 100644 --- a/default.nix +++ b/default.nix @@ -1,5 +1,5 @@ let - inherit (builtins) currentSystem filter mapAttrs; + inherit (builtins) filter mapAttrs; # https://github.com/andir/npins?tab=readme-ov-file#using-the-nixpkgs-fetchers src = import ./npins; @@ -20,10 +20,7 @@ let modules = [ # This is used to pre-emptively set the hostPlatform for nixpkgs. # Also, we set the system hostname here. - { - networking.hostName = hostname; - nixpkgs.hostPlatform = system; - } + { networking.hostName = hostname; } ./hosts/common.nix ./hosts/${hostname} ] diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 5999137..0000000 --- a/flake.lock +++ /dev/null @@ -1,7 +0,0 @@ -{ - "nodes": { - "root": {} - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix index 58f693a..ff42b87 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,12 @@ _: let sources = import ./npins; - nixpkgs = (import sources.flake-compat { src = sources.nixpkgs; }).outputs; + nixpkgs = + (import sources.flake-compat { + src = sources.nixpkgs; + copySourceTreeToStore = false; + useBuiltinsFetchTree = true; + }).outputs; inherit (nixpkgs) lib; pkgsFor = nixpkgs.legacyPackages; inputs = sources; @@ -21,9 +26,7 @@ inherit inputs pkgs sources; }) fish - helix kakoune - nushell ; }) pkgsFor; devShells = lib.mapAttrs (_: pkgs: { diff --git a/hosts/common.nix b/hosts/common.nix index 68f1c62..0405615 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -4,16 +4,11 @@ # which should have a small attack surface. { lib, - self, pkgs, - sources, ... }: let inherit (lib.meta) hiPrioSet; - helix = pkgs.callPackage (self + "/packages/helix") { inherit sources; }; - - fish = pkgs.callPackage (self + "/packages/fish") { inherit sources; }; in { environment.systemPackages = @@ -46,12 +41,10 @@ in zip zoxide ; - inherit fish; } ++ builtins.attrValues (hiPrioSet { - inherit helix; - inherit (pkgs) uutils-coreutils-noprefix; - }); + }) + ++ [ (lib.hiPrio pkgs.uutils-coreutils-noprefix) ]; # helix as the only editor, a reasonable choice. environment.variables.EDITOR = "hx"; } diff --git a/hosts/hermit/programs.nix b/hosts/hermit/programs.nix index eeac268..a370437 100644 --- a/hosts/hermit/programs.nix +++ b/hosts/hermit/programs.nix @@ -1,24 +1,4 @@ { pkgs, ... }: -let - # a newer nil version, for pipes support. - new-nil = pkgs.nil.overrideAttrs (_: { - version = "unstable-18-07-2025"; - - src = pkgs.fetchFromGitHub { - owner = "oxalica"; - repo = "nil"; - rev = "524ae2d67dd84d99a10f409ed6cd8e4e7b3cae3f"; - hash = "sha256-Uy2qzd+fMoBcp4NPSO7DavEC1pGMegmAqoEMvmXbIQU="; - }; - - doInstallCheck = false; - - cargoDeps = pkgs.rustPlatform.fetchCargoVendor { - inherit (new-nil) src; - hash = "sha256-Sljr3ff8hl/qm/0wqc1GXsEr1wWn7NAXmdrd5wHzUX8="; - }; - }); -in { environment.systemPackages = builtins.attrValues { inherit (pkgs) diff --git a/hosts/temperance/hardware-configuration.nix b/hosts/temperance/hardware-configuration.nix index e75c895..8b5836c 100644 --- a/hosts/temperance/hardware-configuration.nix +++ b/hosts/temperance/hardware-configuration.nix @@ -27,6 +27,5 @@ networking.useDHCP = lib.mkDefault true; # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/modules/home/dev/helix.hjem.nix b/modules/home/dev/helix.hjem.nix new file mode 100644 index 0000000..e6e26e0 --- /dev/null +++ b/modules/home/dev/helix.hjem.nix @@ -0,0 +1,492 @@ +{ + lib, + pkgs, + sources, + ... +}: +let + inherit (lib.attrsets) mapAttrs' nameValuePair; + + helix = pkgs.helix.overrideAttrs ( + finalAttrs: previousAttrs: { + version = "25.07.2"; + src = pkgs.fetchzip { + url = "https://github.com/bloxx12/helix/releases/download/${finalAttrs.version}/helix-${finalAttrs.version}-source.tar.xz"; + hash = "sha256-ZNsQwFfPXe6oewajx1tl68W60kVo7q2SuvTgy/o1HKk="; + stripRoot = false; + }; + + doInstallCheck = false; + + cargoDeps = pkgs.rustPlatform.fetchCargoVendor { + inherit (helix) src; + hash = "sha256-3poZSvIrkx8lguxxDeNfngW6+4hH8TV/LHcZx5W5aXg="; + }; + } + ); + + helix-with-plugins = pkgs.helix.overrideAttrs ( + finalAttrs: previousAttrs: { + name = "helix-with-plugins"; + version = "25.07.2"; + src = pkgs.fetchzip { + url = "https://github.com/bloxx12/helix/releases/download/${finalAttrs.version}/helix-${finalAttrs.version}-source.tar.xz"; + hash = "sha256-ZNsQwFfPXe6oewajx1tl68W60kVo7q2SuvTgy/o1HKk="; + stripRoot = false; + }; + + doInstallCheck = false; + + cargoDeps = pkgs.rustPlatform.fetchCargoVendor { + inherit (helix) src; + hash = "sha256-3poZSvIrkx8lguxxDeNfngW6+4hH8TV/LHcZx5W5aXg="; + }; + postInstall = '' + mv $out/bin/hx $out/bin/hxp + ''; + } + ); + + toml = pkgs.formats.toml { }; + + languages = + let + inherit (lib.meta) getExe getExe'; + + nixfmt = pkgs.callPackage "${sources.nixfmt}/default.nix" { }; + + nil = pkgs.rustPlatform.buildRustPackage { + pname = "nil"; + version = "unstable"; + src = sources.nil; + cargoLock = { + lockFile = "${sources.nil}/Cargo.lock"; + allowBuiltinFetchGit = false; + }; + nativeBuildInputs = [ pkgs.nixVersions.latest ]; + + doInstallCheck = false; + meta.mainProgram = "nil"; + }; + + new-deadnix = pkgs.deadnix.overrideAttrs ( + finalAttrs: previousAttrs: { + version = "unstable-15-07-2025"; + src = pkgs.fetchFromGitHub { + owner = "astro"; + repo = "deadnix"; + rev = "d75457b95d7cfa82fcd60970939f76fccfce19e5"; + hash = "sha256-O/z2neAXL8JNkGosvxC+DyZnnJ8zYP9XHApxHVmlzfY="; + }; + + doInstallCheck = false; + + cargoDeps = pkgs.rustPlatform.fetchCargoVendor { + inherit (new-deadnix) src; + hash = "sha256-O8yhqyPflOvQXAA19k1XpbrHysgV5VNWLBX0l5Q5GkM="; + }; + meta.mainProgram = "nil"; + } + ); + in + { + language = + let + mark = 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 = mark "json"; + } + { + name = "markdown"; + auto-format = true; + formatter = mark "md"; + language-servers = [ "taplo" ]; + } + { + name = "nix"; + language-servers = [ "nil" ]; + } + { + name = "qml"; + language-servers = [ "qmlls" ]; + } + { + name = "python"; + auto-format = true; + language-servers = [ + "basedpyright" + "ruff" + ]; + } + { + name = "typescript"; + auto-format = true; + language-servers = [ + "dprint" + "typescript-language-server" + ]; + } + { + name = "rust"; + } + { + name = "c"; + auto-format = true; + language-servers = [ "clangd" ]; + } + { + name = "zig"; + auto-format = true; + } + { + name = "c"; + } + ]; + + language-server = { + bash-language-server = { + command = getExe pkgs.bash-language-server; + args = [ "start" ]; + }; + + rust-analyzer = { + command = getExe pkgs.rust-analyzer; + config.rust-analyzer = { + checkOnSave.command = "clippy"; + procMacro.enable = true; + cargo = { + loadOutDirsFromCheck = true; + features = "all"; + }; + assist = { + preferSelf = true; + }; + check = { + command = "clippy"; + extraArgs = [ + "--" + "-W" + "clippy::pedantic" + "-W" + "clippy::nursery" + "-W" + "clippy::perf" + ]; + }; + lens = { + references = true; + methodReferences = true; + }; + completion.autoimport.enable = true; + experimental.procAttrMacros = true; + interpret.tests = true; + }; + }; + + clangd = { + command = "${pkgs.clang-tools}/bin/clangd"; + clangd.fallbackFlags = [ "-std=c++2b" ]; + }; + + cmake-language-server = { + command = getExe pkgs.cmake-language-server; + }; + + deno-lsp = { + command = getExe pkgs.deno; + args = [ "lsp" ]; + environment.NO_COLOR = "1"; + config.deno = { + enable = true; + lint = true; + unstable = true; + suggest = { + completeFunctionCalls = false; + imports = { + hosts."https://deno.land" = true; + }; + }; + inlayHints = { + enumMemberValues.enabled = true; + functionLikeReturnTypes.enabled = true; + parameterNames.enabled = "all"; + parameterTypes.enabled = true; + propertyDeclarationTypes.enabled = true; + variableTypes.enabled = true; + }; + }; + }; + dprint = { + command = getExe pkgs.dprint; + args = [ "lsp" ]; + }; + + nil = { + command = getExe nil; + config.nil = { + formatting.command = [ "${getExe nixfmt}" ]; + diagnostics = { + bindingEndHintMinLines = 3; + }; + nix.flake = { + autoArchive = true; + # autoEvalInputs = true; + nixpkgsInputName = "nixpkgs"; + }; + }; + }; + deadnix = { + command = getExe new-deadnix; + }; + + typescript-language-server = { + command = getExe pkgs.typescript-language-server; + args = [ "--stdio" ]; + config = { + typescript-language-server.source = { + addMissingImports.ts = true; + fixAll.ts = true; + organizeImports.ts = true; + removeUnusedImports.ts = true; + sortImports.ts = true; + }; + }; + }; + ruff = { + command = getExe pkgs.ruff; + args = [ "server" ]; + }; + + qmlls = { + command = getExe' pkgs.kdePackages.qtdeclarative "qmlls"; + args = [ "-E" ]; + }; + basedpyright.command = "${pkgs.basedpyright}/bin/basedpyright-langserver"; + + vscode-css-language-server = { + command = "${pkgs.vscode-langservers-extracted}/bin/vscode-css-language-server"; + args = [ "--stdio" ]; + config = { + provideFormatter = true; + css.validate.enable = true; + scss.validate.enable = true; + }; + }; + zls = { + command = getExe pkgs.zls; + config = { + enable_build_on_save = true; + build_on_save_args = [ + "check" + "-fincremental" + "--watch" + ]; + enable_autofix = false; + warn_style = true; + highlight_global_var_declarations = true; + }; + }; + }; + }; + + themes = { + rose_pine_transparent = { + inherits = "rose_pine"; + "ui.background" = { }; + }; + rose_pine_dawn_transparent = { + inherits = "rose_pine_dawn"; + "ui.background" = { }; + }; + nightfox_transparent = { + inherits = "nightfox"; + "ui.background" = { }; + }; + nord_transparent = { + inherits = "nord"; + "ui.background" = { }; + }; + }; + + settings = { + theme = "nord"; + editor = { + cursorline = true; + color-modes = true; + true-color = true; + indent-guides.render = true; + lsp = { + enable = true; + auto-signature-help = true; + display-inlay-hints = false; + display-messages = true; + snippets = true; + }; + file-picker = { + hidden = true; + }; + line-number = "relative"; + auto-format = true; + completion-timeout = 5; + mouse = true; + bufferline = "multiple"; + soft-wrap.enable = true; + word-completion = { + enable = true; + trigger-length = 2; + }; + 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" + ":buffer-close!" + ":redraw" + ]; + i = ":toggle lsp.display-inlay-hints"; + }; + 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" + ]; + ";" = "flip_selections"; + "A-;" = "collapse_selection"; + + # Kakoune-like config + H = "extend_char_left"; + J = "extend_line_down"; + K = "extend_line_up"; + L = "extend_char_right"; + }; + select = { + A-x = "extend_to_line_bounds"; + X = [ + "extend_line_up" + "extend_to_line_bounds" + ]; + g = { + e = "goto_file_end"; + }; + }; + }; + }; +in +{ + packages = builtins.attrValues { + inherit helix; + inherit (pkgs) + tinymist + taplo + kdlfmt + gopls + ; + }; + + files = { + ".config/helix/config.toml".source = toml.generate "helix-config.toml" settings; + ".config/helix/languages.toml".source = toml.generate "helix-languages.toml" languages; + + } + // mapAttrs' ( + name: value: + nameValuePair ".config/helix/themes/${name}.toml" { + source = toml.generate "helix-theme-${name}.toml" value; + } + ) themes; + +} diff --git a/modules/home/hjem.mod.nix b/modules/home/hjem.mod.nix new file mode 100644 index 0000000..a6c5e04 --- /dev/null +++ b/modules/home/hjem.mod.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + pkgs, + sources, + ... +}: +let + inherit (builtins) filter; + inherit (config.meta.mainUser) username; + inherit (lib.modules) mkForce; + inherit (lib.filesystem) listFilesRecursive; + inherit (lib.strings) hasSuffix; + +in +{ + + imports = [ (sources.hjem + "/modules/nixos") ]; + + config = { + hjem = { + clobberByDefault = true; + linker = pkgs.smfh; + users.${username} = { + enable = true; + user = username; + directory = config.users.users.${username}.home; + clobberFiles = mkForce true; + }; + extraModules = ((listFilesRecursive ./.) |> filter (hasSuffix ".hjem.nix")); + specialArgs = { + inherit sources; + }; + }; + }; +} diff --git a/modules/home/nushell/completions.nu b/modules/home/nushell/completions.nu new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/modules/home/nushell/completions.nu @@ -0,0 +1 @@ + diff --git a/modules/home/nushell/config.nu b/modules/home/nushell/config.nu new file mode 100644 index 0000000..7ffcf43 --- /dev/null +++ b/modules/home/nushell/config.nu @@ -0,0 +1,300 @@ +#! /usr/bin/env nu + +$env.config = { + bracketed_paste: true + buffer_editor: "hx" + datetime_format: {} + edit_mode: vi + error_style: fancy + float_precision: 2 + footer_mode: 25 + render_right_prompt_on_last_line: false + show_banner: false + use_ansi_coloring: true + use_kitty_protocol: true + + shell_integration: { + osc2: false + osc7: true + osc8: true + osc9_9: false + osc133: true + osc633: true + reset_application_mode: true + } +} + +$env.config.color_config = { + binary: '#b48ead' + block: '#81a1c1' + cell-path: '#e5e9f0' + closure: '#88c0d0' + custom: '#8fbcbb' + duration: '#ebcb8b' + float: '#bf616a' + glob: '#8fbcbb' + int: '#b48ead' + list: '#88c0d0' + nothing: '#bf616a' + range: '#ebcb8b' + record: '#88c0d0' + string: '#a3be8c' + + bool: {|| if $in { '#88c0d0' } else { '#ebcb8b' } } + + datetime: {|| (date now) - $in | + if $in < 1hr { + { fg: '#bf616a' attr: 'b' } + } else if $in < 6hr { + '#bf616a' + } else if $in < 1day { + '#ebcb8b' + } else if $in < 3day { + '#a3be8c' + } else if $in < 1wk { + { fg: '#a3be8c' attr: 'b' } + } else if $in < 6wk { + '#88c0d0' + } else if $in < 52wk { + '#81a1c1' + } else { 'dark_gray' } + } + + filesize: {|e| + if $e == 0b { + '#e5e9f0' + } else if $e < 1mb { + '#88c0d0' + } else {{ fg: '#81a1c1' }} + } + + shape_and: { fg: '#b48ead' attr: 'b' } + shape_binary: { fg: '#b48ead' attr: 'b' } + shape_block: { fg: '#81a1c1' attr: 'b' } + shape_bool: '#88c0d0' + shape_closure: { fg: '#88c0d0' attr: 'b' } + shape_custom: '#a3be8c' + shape_datetime: { fg: '#88c0d0' attr: 'b' } + shape_directory: '#88c0d0' + shape_external: '#88c0d0' + shape_external_resolved: '#88c0d0' + shape_externalarg: { fg: '#a3be8c' attr: 'b' } + shape_filepath: '#88c0d0' + shape_flag: { fg: '#81a1c1' attr: 'b' } + shape_float: { fg: '#bf616a' attr: 'b' } + shape_garbage: { fg: '#FFFFFF' bg: '#FF0000' attr: 'b' } + shape_glob_interpolation: { fg: '#88c0d0' attr: 'b' } + shape_globpattern: { fg: '#88c0d0' attr: 'b' } + shape_int: { fg: '#b48ead' attr: 'b' } + shape_internalcall: { fg: '#88c0d0' attr: 'b' } + shape_keyword: { fg: '#b48ead' attr: 'b' } + shape_list: { fg: '#88c0d0' attr: 'b' } + shape_literal: '#81a1c1' + shape_match_pattern: '#a3be8c' + shape_matching_brackets: { attr: 'u' } + shape_nothing: '#bf616a' + shape_operator: '#ebcb8b' + shape_or: { fg: '#b48ead' attr: 'b' } + shape_pipe: { fg: '#b48ead' attr: 'b' } + shape_range: { fg: '#ebcb8b' attr: 'b' } + shape_raw_string: { fg: '#8fbcbb' attr: 'b' } + shape_record: { fg: '#88c0d0' attr: 'b' } + shape_redirection: { fg: '#b48ead' attr: 'b' } + shape_signature: { fg: '#a3be8c' attr: 'b' } + shape_string: '#a3be8c' + shape_string_interpolation: { fg: '#88c0d0' attr: 'b' } + shape_table: { fg: '#81a1c1' attr: 'b' } + shape_vardecl: { fg: '#81a1c1' attr: 'u' } + shape_variable: '#b48ead' + + foreground: '#e5e9f0' + background: '#2e3440' + cursor: '#e5e9f0' + + empty: '#81a1c1' + header: { fg: '#a3be8c' attr: 'b' } + hints: '#4c566a' + leading_trailing_space_bg: { attr: 'n' } + row_index: { fg: '#a3be8c' attr: 'b' } + search_result: { fg: '#bf616a' bg: '#e5e9f0' } + separator: '#e5e9f0' +} + +$env.config.ls = { + clickable_links: true + use_ls_colors: true +} + +$env.config.rm.always_trash = true + +$env.config.table = { + header_on_separator: true + footer_inheritance: true + index_mode: always + mode: compact + missing_value_symbol: kek + padding: {left: 1 right: 1} + show_empty: false + trim: { + methodology: wrapping + truncating_suffix: "..." + wrapping_try_keep_words: true + } +} + +$env.config.explore = { + command_bar_text: {fg: "#C4C9C6"} + highlight: {fg: black bg: yellow} + status: { + error: {fg: white bg: red} + warn: {} + info: {} + } + status_bar_background: {fg: "#1D1F21" bg: "#C4C9C6"} + table: { + split_line: {fg: "#404040"} + selected_cell: {bg: light_blue} + selected_row: {} + selected_column: {} + } +} + +$env.config.history = { + file_format: sqlite + isolation: false + max_size: 100_000 + sync_on_enter: true +} + +$env.config.cursor_shape = { + vi_insert: line + vi_normal: block +} + +$env.config.hooks = { + command_not_found: {|| } + + pre_execution: [ + { + let prompt = commandline | str trim + + if ($prompt | is-empty) { + return + } + + print $"(ansi title)($prompt) — nu(char bel)" + } + ] + + env_change: { + PWD: [ + {|| + if not ($env.PWD | path join .envrc | path exists) { + return + } + if (which direnv | is-empty) { + return + } + + direnv export json | from json | default {} | load-env + $env.PATH = $env.PATH | split row (char env_sep) + } + ] + } +} + +let menus = [ + { + name: completion_menu + only_buffer_difference: false + marker: $"(ansi yellow)╋ " + type: { + layout: ide + min_completion_width: 0 + max_completion_width: 150 + max_completion_height: 25 + padding: 0 + border: false + cursor_offset: 0 + description_mode: "prefer_right" + min_description_width: 0 + max_description_width: 50 + max_description_height: 10 + description_offset: 1 + correct_cursor_pos: true + } + style: { + text: white + selected_text: white_reverse + description_text: yellow + match_text: { attr: u } + selected_match_text: { attr: ur } + } + } + { + name: history_menu + only_buffer_difference: true + marker: $env.PROMPT_INDICATOR + type: { + layout: list + page_size: 10 + } + style: { + text: white + selected_text: white_reverse + } + } +] + +$env.config.menus = $env.config.menus +| where name not-in ($menus | get name) +| append $menus + +$env.config.keybindings ++= [ + { + name: copy_commandline + modifier: alt + keycode: char_c + mode: [vi_normal vi_insert] + event: { + send: executehostcommand + cmd: 'commandline | nu-highlight | $"```ansi\n($in)\n```" | wl-copy $in' + } + } +] + +let env_vars_file = '/tmp/nushell-env-vars' +if not ($env_vars_file | path exists) { + open /etc/profile + | lines + | select 11 + | str trim + | split column ' ' del path + | get path.0 + | open $in + | str trim + | lines + | parse 'export {name}="{value}"' + | transpose --header-row --as-record + | tee { load-env $in } + | to nuon + | save --force $env_vars_file +} else { + open $env_vars_file + | from nuon + | load-env $in +} + +def switch [] { + nh os switch --file ($env.NH_FLAKE | path join default.nix) (open /etc/hostname | str trim) +} + +# fix sudo by prepending /run/wrappers/bin to the PATH. +$env.PATH = ($env.PATH | split row (char esep) | prepend '/run/wrappers/bin') +$env.PATH = ($env.PATH | split row (char esep) | prepend '/etc/profiles/per-user/cr/bin') + +carapace _carapace nushell +| save -f ($nu.user-autoload-dirs | path join carapace.nu) + +source ./prompt.nu +source ./zoxide.nu diff --git a/modules/home/nushell/nu.hjem.nix b/modules/home/nushell/nu.hjem.nix new file mode 100644 index 0000000..6ffa828 --- /dev/null +++ b/modules/home/nushell/nu.hjem.nix @@ -0,0 +1,22 @@ +{ + pkgs, + ... +}: +{ + + packages = with pkgs; [ + nushell + inshellisense + carapace + ]; + environment.sessionVariables = { + CARAPACE_BRIDGES = "inshellisense,carapace,clap,bash"; + CARAPACE_MATCH = 1; + }; + + files = { + ".config/nushell/config.nu".source = ./config.nu; + ".config/nushell/prompt.nu".source = ./prompt.nu; + ".config/nushell/zoxide.nu".source = ./zoxide.nu; + }; +} diff --git a/packages/nushell/prompt.nu b/modules/home/nushell/prompt.nu similarity index 100% rename from packages/nushell/prompt.nu rename to modules/home/nushell/prompt.nu diff --git a/modules/home/nushell/zoxide.nu b/modules/home/nushell/zoxide.nu new file mode 100644 index 0000000..a2bf5d7 --- /dev/null +++ b/modules/home/nushell/zoxide.nu @@ -0,0 +1,54 @@ +# Initialize hook to add new entries to the database. +export-env { + $env.config = ( + $env.config? + | default {} + | upsert hooks { default {} } + | upsert hooks.env_change { default {} } + | upsert hooks.env_change.PWD { default [] } + ) + let __zoxide_hooked = ( + $env.config.hooks.env_change.PWD | any { try { get __zoxide_hook } catch { false } } + ) + if not $__zoxide_hooked { + $env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD | append { + __zoxide_hook: true, + code: {|_, dir| zoxide add -- $dir} + }) + } +} + +def zoxide_completions [context: string] { + let parts = $context | split row " " | skip 1 + { + options: { + sort: false, + completion_algorithm: substring, + case_sensitive: false, + }, + completions: (^zoxide query --list --exclude $env.PWD -- ...$parts | lines | first 10) + } +} + +# Jump to a directory using only keywords. +def --env --wrapped __zoxide_z [...rest: string@zoxide_completions] { + let path = match $rest { + [] => {'~'}, + [ '-' ] => {'-'}, + [ $arg ] if ($arg | path expand | path type) == 'dir' => {$arg} + _ => { + zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n" + } + } + cd $path +} + +# Jump to a directory using interactive search. +def --env --wrapped __zoxide_zi [...rest:string] { + cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")' +} + +# ============================================================================= +alias z = __zoxide_z +alias zi = __zoxide_zi + diff --git a/modules/programs/gui/ghostty.mod.nix b/modules/home/programs/ghostty.hjem.nix similarity index 69% rename from modules/programs/gui/ghostty.mod.nix rename to modules/home/programs/ghostty.hjem.nix index 121edee..8f95e1c 100644 --- a/modules/programs/gui/ghostty.mod.nix +++ b/modules/home/programs/ghostty.hjem.nix @@ -1,6 +1,6 @@ { - config, lib, + osConfig, pkgs, ... }: @@ -10,8 +10,7 @@ let inherit (lib.attrsets) mapAttrsToList; inherit (lib.strings) concatStringsSep; - inherit (config.meta.mainUser.defaultShell) name package; - inherit (config.modules.style.colorScheme) slug; + inherit (osConfig.meta.mainUser.defaultShell) name package; # Shell integration for ghostty only supports # bash, fish and zsh for now. @@ -30,11 +29,9 @@ let ghostty-settings = { font-size = 14; font-family = "JetBrainsMonoNerdFont"; - # font-style-bold = JetBrainsMono NF Regular; - # font-style-bold-italic = JetBrainsMono NF Italic; app-notifications = "no-clipboard-copy"; - background-opacity = 0.9; + background-opacity = 0.7; bold-is-bright = "true"; confirm-close-surface = "false"; cursor-style-blink = "false"; @@ -45,7 +42,7 @@ let resize-overlay-duration = "0s"; shell-integration-features = "cursor,sudo,no-title"; term = "xterm-256color"; - theme = slug; + theme = "nightfox"; window-decoration = "none"; window-padding-balance = true; window-padding-x = 8; @@ -60,23 +57,13 @@ let command = getExe package; }; - - settingsFile = - pkgs.writeText "config" - <| concatStringsSep "\n" - <| mapAttrsToList (name: value: "${name} = ${toString value}") ghostty-settings; - - ghostty-wrapped = pkgs.symlinkJoin { - name = "ghostty-wrapped"; - paths = [ pkgs.ghostty ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram $out/bin/ghostty --add-flags "--config-file=${settingsFile}" - ''; - }; in { - environment.systemPackages = builtins.attrValues { - inherit ghostty-wrapped; + packages = builtins.attrValues { + inherit (pkgs) ghostty; }; + + files.".config/ghostty/config".text = + concatStringsSep "\n" + <| mapAttrsToList (name: value: "${name} = ${toString value}") ghostty-settings; } diff --git a/modules/other/users.mod.nix b/modules/other/users.mod.nix index 040ef2a..1189e55 100644 --- a/modules/other/users.mod.nix +++ b/modules/other/users.mod.nix @@ -2,7 +2,7 @@ config, lib, pkgs, - self, + sources, ... }: let @@ -10,10 +10,9 @@ let inherit (lib.options) mkOption; inherit (lib.types) listOf str package; inherit (config.meta.mainUser) username; - - nushell = pkgs.callPackage (self + "/packages/nushell") { }; in { + imports = [ (sources.hjem + "/modules/nixos") ]; options.meta = { users = mkOption { type = listOf str; @@ -52,7 +51,7 @@ in }; package = mkOption { type = package; - default = nushell; + default = pkgs.nushell; }; }; }; @@ -72,7 +71,7 @@ in "nix" "docker" ]; - shell = nushell; + shell = pkgs.nushell; }; }; }; diff --git a/modules/packages/packages.mod.nix b/modules/packages/packages.mod.nix index de5b16f..4cbf8f4 100644 --- a/modules/packages/packages.mod.nix +++ b/modules/packages/packages.mod.nix @@ -7,7 +7,71 @@ let nixfmt = pkgs.callPackage "${sources.nixfmt}/default.nix" { }; in { - environment.systemPackages = [ - nixfmt - ]; + environment.systemPackages = + with pkgs; + [ + emacs-pgtk + # better cd + zoxide + # pipe viewer + pv + # hex editor + bvi + #better ls + eza + atuin + # better cat + bat + # clipboard + # yazi + serpl + diff-so-fancy + tig + direnv + sesh + mprocs + curlie + entr + procs + sd + # mult + glow + # dua-cli + dust + kondo + # better grep + ripgrep + # IP stuff + dig + # simply the best fetch tool out there + microfetch + fzf + element + difftastic + hexyl + yazi + gnumake + asciinema + inetutils + tokei + starship + wget + cpufetch + watchman + # yt-dlp # borked check phase + tealdeer + hyperfine + imagemagick + ffmpeg-full + # catimg + timg + nmap + fd + jq + rsync + figlet + unzip + zip + ] + ++ [ nixfmt ]; } diff --git a/modules/services/forgejo/forgejo.mod.nix b/modules/services/forgejo/forgejo.mod.nix index 5e0e399..503f1cc 100644 --- a/modules/services/forgejo/forgejo.mod.nix +++ b/modules/services/forgejo/forgejo.mod.nix @@ -123,15 +123,15 @@ in Disallow: / ''; base-brand = fetchurl { - url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/codeberg/base-brand.css"; - hash = "sha256-QJ775HpINf8klO3d/8h+tEw0vk34p19dWUCWWuVwcho="; + url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/src/branch/codeberg-11/web_src/css/themes/codeberg/base-brand.css"; + hash = "sha256-rYZolA7maYEjzfx7mKJtEfyK62kfpGxvQ1eaC9qlZNw="; }; dark-variables = fetchurl { - url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/codeberg/dark-variables.css"; + url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-11/web_src/css/themes/codeberg/dark-variables.css"; hash = "sha256-nCSJUOU9/R1fldoKXTTZmP7vmRjYUk/OKkbgrJ/NrXQ="; }; theme-codeberg-dark = fetchurl { - url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/theme-codeberg-dark.css"; + url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-11/web_src/css/themes/theme-codeberg-dark.css"; hash = "sha256-KyXznH49koRGlzIDDqagN4PvFGD/zCX//wrctmtfgBs="; }; in diff --git a/modules/style/quickshell/shell/.qmlls.ini b/modules/style/quickshell/shell/.qmlls.ini deleted file mode 100644 index a780449..0000000 --- a/modules/style/quickshell/shell/.qmlls.ini +++ /dev/null @@ -1 +0,0 @@ -/run/user/1000/quickshell/vfs/4f7a8066a49ba487f5b2754750896151/.qmlls.ini \ No newline at end of file diff --git a/modules/style/quickshell/shell/.qmlls.ini b/modules/style/quickshell/shell/.qmlls.ini new file mode 120000 index 0000000..a780449 --- /dev/null +++ b/modules/style/quickshell/shell/.qmlls.ini @@ -0,0 +1 @@ +/run/user/1000/quickshell/vfs/4f7a8066a49ba487f5b2754750896151/.qmlls.ini \ No newline at end of file diff --git a/modules/system/nix/determinate.mod.nix b/modules/system/nix/determinate.mod.nix deleted file mode 100644 index 74b7c72..0000000 --- a/modules/system/nix/determinate.mod.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ - config, - lib, - pkgs, - sources, - ... -}: -let - determinate = (import sources.flake-compat { src = sources.determinate; }).outputs; - dix = - (import sources.flake-compat { src = determinate.inputs.nix; }) - .outputs.packages.${pkgs.stdenv.system}.nix; - - # Stronger than mkDefault (1000), weaker than mkForce (50) and the "default override priority" - # (100). - mkPreferable = lib.mkOverride 750; - - # Stronger than the "default override priority", as the upstream module uses that, and weaker than mkForce (50). - mkMorePreferable = lib.mkOverride 75; -in -{ - config = { - nix = { - package = dix; - }; - environment.systemPackages = [ - determinate.packages.${pkgs.stdenv.system}.default - ]; - - # NOTE(cole-h): Move the generated nix.conf to /etc/nix/nix.custom.conf, which is included from - # the Determinate Nixd-managed /etc/nix/nix.conf. - environment.etc."nix/nix.conf".target = "nix/nix.custom.conf"; - systemd = { - services.nix-daemon.serviceConfig = { - ExecStart = [ - "" - "@${ - determinate.packages.${pkgs.stdenv.system}.default - }/bin/determinate-nixd determinate-nixd --nix-bin ${config.nix.package}/bin daemon" - ]; - KillMode = mkPreferable "process"; - LimitNOFILE = mkMorePreferable 1048576; - LimitSTACK = mkPreferable "64M"; - TasksMax = mkPreferable 1048576; - }; - sockets = { - nix-daemon.socketConfig.FileDescriptorName = "nix-daemon.socket"; - determinate-nixd = { - description = "Determinate Nixd Daemon Socket"; - wantedBy = [ "sockets.target" ]; - before = [ "multi-user.target" ]; - - unitConfig = { - RequiresMountsFor = [ - "/nix/store" - "/nix/var/determinate" - ]; - }; - - socketConfig = { - Service = "nix-daemon.service"; - FileDescriptorName = "determinate-nixd.socket"; - ListenStream = "/nix/var/determinate/determinate-nixd.socket"; - DirectoryMode = "0755"; - }; - }; - }; - }; - }; -} diff --git a/modules/system/nix/nix.mod.nix b/modules/system/nix/nix.mod.nix index 4ae7264..5eb3fe2 100644 --- a/modules/system/nix/nix.mod.nix +++ b/modules/system/nix/nix.mod.nix @@ -1,17 +1,20 @@ # credits to raf { - config, sources, lib, pkgs, ... }: let - inherit (lib.attrsets) mapAttrsToList; inherit (lib.modules) mkForce; + + lix = pkgs.callPackage "${sources.lix}/package.nix" { + stdenv = pkgs.clangStdenv; + }; in { nix = { + package = lix; # Check that Nix can parse the generated nix.conf. checkConfig = true; @@ -26,10 +29,14 @@ in # registry = # lib.mapAttrs (_: v: {flake = v.outPath;}) sources # // {system.flake = sources.nichts;}; + registry.nixpkgs.to = { + type = "path"; + source = sources.nixpkgs; + }; # Add inputs to the system's legacy channels # to make legacy nix commands consistent as well - nixPath = mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry; + nixPath = [ "nixpkgs=/etc/nixos/nixpkgs" ]; # Run the Nix daemon on lowest possible priority daemonCPUSchedPolicy = "idle"; @@ -116,7 +123,7 @@ in "flakes" # flakes "nix-command" # experimental nix commands "cgroups" # allow nix to execute builds inside cgroups - "pipe-operators" + "pipe-operator" ]; # Ensures that the result of Nix expressions is fully determined by @@ -168,6 +175,9 @@ in }; }; + environment.etc = { + "nixos/nixpkgs".source = builtins.storePath sources.nixpkgs; + }; systemd.services = { # WE DONT WANT TO BUILD STUFF ON TMPFS # ITS NOT A GOOD IDEA diff --git a/modules/system/nix/nixpkgs.mod.nix b/modules/system/nix/nixpkgs.mod.nix index 0f98f70..8092b9d 100644 --- a/modules/system/nix/nixpkgs.mod.nix +++ b/modules/system/nix/nixpkgs.mod.nix @@ -1,47 +1,62 @@ -# taken from raf -{ sources, ... }: { - # Global nixpkgs configuration. - # This is ignored if nixpkgs.pkgs is set, which should be avoided. - nixpkgs = { - flake = { - source = sources.nixpkgs; - setFlakeRegistry = true; - setNixPath = true; - }; + lib, + sources, + pkgs, + ... +}: +let + inherit (lib.options) mkOption; + inherit (lib.types) str; +in +{ + imports = [ + # Going full schizo + "${sources.nixpkgs}/nixos/modules/misc/nixpkgs/read-only.nix" + ]; - # Configuration reference: - # - config = { - # Disallow broken packages to be built. - allowBroken = false; - - allowUnsupportedSystem = true; - - # Warn when config contains an unrecognized attribute. - # This might be useful for getting a better configuration. - warnUndeclaredOptions = true; - - # Allow unfree packages - allowUnfree = true; - - # Permitted insecure packages in a system. - # Default to none, add more as necessary. - # Matrix also likes using deprecated libraries, which tend to go into this list. - # permittedInsecurePackages = []; - - # Whether to set enableParallelBuilding to true by default while - # building nixpkgs packages. Changing the default causes a mass rebuild. - enableParallelBuildingByDefault = false; - - # Whether to expose old attribute names for compatibility. - # This improves backwards compatibility, - # which I could not care less about in my configuration. - allowAliases = false; - - # List of derivation warnings to display while rebuilding. - # See: - showDerivationWarnings = [ ]; - }; + options.nixpkgs.system = mkOption { + type = str; + default = pkgs.system; + readOnly = true; }; + + config.nixpkgs.pkgs = ( + import sources.nixpkgs { + hostPlatform = pkgs.stdenv.hostPlatform; + overlays = [ ]; + config = { + # Configuration reference: + # + # Disallow broken packages to be built. + allowBroken = false; + + allowUnsupportedSystem = true; + + # Warn when config contains an unrecognized attribute. + # This might be useful for getting a better configuration. + warnUndeclaredOptions = true; + + # Allow unfree packages + allowUnfree = true; + + # Permitted insecure packages in a system. + # Default to none, add more as necessary. + # Matrix also likes using deprecated libraries, which tend to go into this list. + # permittedInsecurePackages = []; + + # Whether to set enableParallelBuilding to true by default while + # building nixpkgs packages. Changing the default causes a mass rebuild. + enableParallelBuildingByDefault = false; + + # Whether to expose old attribute names for compatibility. + # This improves backwards compatibility, + # which I could not care less about in my configuration. + allowAliases = false; + + # List of derivation warnings to display while rebuilding. + # See: + showDerivationWarnings = [ ]; + }; + } + ); } diff --git a/modules/wms/niri/config.kdl b/modules/wms/niri/config.kdl index d3eb85e..962ee83 100644 --- a/modules/wms/niri/config.kdl +++ b/modules/wms/niri/config.kdl @@ -85,7 +85,7 @@ switch-events { } } overview { - zoom 0.65 + zoom 0.60 backdrop-color "#777777" } animations { diff --git a/modules/wms/niri/niri.mod.nix b/modules/wms/niri/niri.mod.nix index e9a714c..57e461b 100644 --- a/modules/wms/niri/niri.mod.nix +++ b/modules/wms/niri/niri.mod.nix @@ -2,32 +2,100 @@ config, lib, pkgs, + sources, ... }: let inherit (lib.modules) mkForce mkIf; inherit (lib.options) mkEnableOption; inherit (config.modules.system) isGraphical; + inherit (config.meta.mainUser) username; + cfg = config.modules.desktops.niri; - patched-niri = pkgs.niri.overrideAttrs (prev: { - src = pkgs.fetchFromGitHub { - inherit (prev.src) owner repo; - rev = "37458d94b288945f6cfbd3c5c233f634d59f246c"; - hash = "sha256-F5iVU/hjoSHSSe0gllxm0PcAaseEtGNanYK5Ha3k2Tg="; + niri = pkgs.callPackage (_: pkgs.rustPlatform.buildRustPackage { + pname = "niri"; + version = "unstable"; + + src = sources.niri; + postPatch = '' + patchShebangs resources/niri-session + substituteInPlace resources/niri.service \ + --replace-fail '/usr/bin' "$out/bin" + ''; + + cargoLock = { + allowBuiltinFetchGit = true; + lockFile = "${sources.niri}/Cargo.lock"; }; - cargoDeps = pkgs.rustPlatform.fetchCargoVendor { - inherit (patched-niri) src; - hash = "sha256-fT0L/OTlQ9BnKHnckKsLi+tN+oevEU+eJWrh1INqQhA="; - }; - patches = [ - (pkgs.fetchpatch { - url = "https://github.com/YaLTeR/niri/commit/ab71a6c553f9c53ea484ec6dedc5dcede708929f.diff"; - hash = "sha256-C3TJIK5/YTAcmdSP6NyOwX+1oA36u6nrMuJuVYIvAHQ="; - }) + + strictDeps = true; + doInstallCheck = false; + + nativeBuildInputs = with pkgs; [ + rustPlatform.bindgenHook + pkg-config + installShellFiles ]; - }); + + buildInputs = with pkgs; [ + cairo + dbus + libGL + libdisplay-info + libinput + seatd + libxkbcommon + libgbm + pango + wayland + dbus + pipewire + # Also includes libudev + systemd + ]; + + buildFeatures = [ + "dbus" + "dinit" + "xdp-gnome-screencast" + "systemd" + ]; + buildNoDefaultFeatures = true; + + postInstall = '' + installShellCompletion --cmd niri \ + --bash <($out/bin/niri completions bash) \ + --fish <($out/bin/niri completions fish) \ + --zsh <($out/bin/niri completions zsh) + + install -Dm644 resources/niri.desktop -t $out/share/wayland-sessions + install -Dm644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal + install -Dm755 resources/niri-session $out/bin/niri-session + install -Dm644 resources/niri{.service,-shutdown.target} -t $out/share/systemd/user + ''; + + env = { + # Force linking with libEGL and libwayland-client + # so they can be discovered by `dlopen()` + RUSTFLAGS = toString ( + map (arg: "-C link-arg=" + arg) [ + "-Wl,--push-state,--no-as-needed" + "-lEGL" + "-lwayland-client" + "-Wl,--pop-state" + ] + ); + }; + + passthru = { + providedSessions = [ "niri" ]; + }; + + meta.mainProgram = "niri"; + + }) { }; in { options.modules.desktops.niri.enable = mkEnableOption "Niri, a scolling tiling wayland compositor"; @@ -35,13 +103,13 @@ in config = mkIf (cfg.enable || isGraphical) { programs.niri = { enable = true; - package = patched-niri; + package = niri; }; # The niri module auto enables the gnome keyring, # which is something I direly want to avoid. services.gnome.gnome-keyring.enable = mkForce false; - environment.etc."niri/config.kdl".source = ./config.kdl; + hjem.users.${username}.files.".config/niri/config.kdl".source = ./config.kdl; environment.systemPackages = builtins.attrValues { inherit (pkgs) diff --git a/npins/sources.json b/npins/sources.json index 006c756..7e9393a 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -1,49 +1,31 @@ { "pins": { - "determinate": { + "flake-compat": { "type": "Git", "repository": { - "type": "GitHub", - "owner": "determinatesystems", - "repo": "determinate" + "type": "Forgejo", + "server": "https://git.lix.systems/", + "owner": "lix-project", + "repo": "flake-compat" }, "branch": "main", "submodules": false, - "revision": "5e73b5071ece6da51aa50c55e3438335e2ef9d9c", - "url": "https://github.com/determinatesystems/determinate/archive/5e73b5071ece6da51aa50c55e3438335e2ef9d9c.tar.gz", - "hash": "sha256-UFzMWhD4rN/9C5Rnf6VHB63gHLFgaPxh0meZlRQrbnU=" + "revision": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1", + "url": "https://git.lix.systems/lix-project/flake-compat/archive/549f2762aebeff29a2e5ece7a7dc0f955281a1d1.tar.gz", + "hash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=" }, - "dix": { - "type": "GitRelease", + "hjem": { + "type": "Git", "repository": { "type": "GitHub", - "owner": "determinatesystems", - "repo": "nix-src" + "owner": "feel-co", + "repo": "hjem" }, - "pre_releases": false, - "version_upper_bound": null, - "release_prefix": null, + "branch": "main", "submodules": false, - "version": "v3.8.3", - "revision": "aa49e142fc30f0598f954abdc0b83c2f290f12d1", - "url": "https://api.github.com/repos/determinatesystems/nix-src/tarball/v3.8.3", - "hash": "sha256-Z+nd/hOF4mpn1OqjvtrJZAoXwiXJ36wtoubd1kAWhmE=" - }, - "flake-compat": { - "type": "GitRelease", - "repository": { - "type": "GitHub", - "owner": "edolstra", - "repo": "flake-compat" - }, - "pre_releases": false, - "version_upper_bound": null, - "release_prefix": null, - "submodules": false, - "version": "v1.1.0", - "revision": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "url": "https://api.github.com/repos/edolstra/flake-compat/tarball/v1.1.0", - "hash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=" + "revision": "3093a74542b30f8155954d585d0ae2401e3adbe5", + "url": "https://github.com/feel-co/hjem/archive/3093a74542b30f8155954d585d0ae2401e3adbe5.tar.gz", + "hash": "sha256-LzojKFWAAreWyH56aupj/MLwuPPnnyzplw/xdbavC9c=" }, "impermanence": { "type": "Git", @@ -71,6 +53,34 @@ "url": "https://github.com/nix-community/lanzaboote/archive/5a776450d904b7ccd377c2a759703152b2553e98.tar.gz", "hash": "sha256-9Cc0YqL9ZUpaybJsrRJfXex91QlPmQNqpTLgw/KvJGA=" }, + "lix": { + "type": "Git", + "repository": { + "type": "Forgejo", + "server": "https://git.lix.systems/", + "owner": "lix-project", + "repo": "lix" + }, + "branch": "main", + "submodules": false, + "revision": "9d8ab804355d95d38a61ad5053d415ca1882d554", + "url": "https://git.lix.systems/lix-project/lix/archive/9d8ab804355d95d38a61ad5053d415ca1882d554.tar.gz", + "hash": "sha256-CFoDQz2mnfKWtAb6Y01xu+bfM+Q/6dHGkxKq6W+dzN8=" + }, + "lix-module": { + "type": "Git", + "repository": { + "type": "Forgejo", + "server": "https://git.lix.systems/", + "owner": "lix-project", + "repo": "nixos-module" + }, + "branch": "main", + "submodules": false, + "revision": "4d4c2b8f0a801c91ce5b717c77fe3a17efa1402f", + "url": "https://git.lix.systems/lix-project/nixos-module/archive/4d4c2b8f0a801c91ce5b717c77fe3a17efa1402f.tar.gz", + "hash": "sha256-gbpuESxl/An4GTh7QEbQRYJozVIxWkwVGbWK0/0GoRc=" + }, "nh": { "type": "Git", "repository": { @@ -84,6 +94,35 @@ "url": "https://github.com/nix-community/nh/archive/a90e3124111d9c3eb64e97a5334db09a8e2a4bae.tar.gz", "hash": "sha256-KKaUEg1/ntHVsG61CkKFr2mfdsoK9Nj5FM/W1PBhe5o=" }, + "nil": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "oxalica", + "repo": "nil" + }, + "branch": "main", + "submodules": false, + "revision": "524ae2d67dd84d99a10f409ed6cd8e4e7b3cae3f", + "url": "https://github.com/oxalica/nil/archive/524ae2d67dd84d99a10f409ed6cd8e4e7b3cae3f.tar.gz", + "hash": "sha256-Uy2qzd+fMoBcp4NPSO7DavEC1pGMegmAqoEMvmXbIQU=" + }, + "niri": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "yalter", + "repo": "niri" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v25.05.1", + "revision": "61e306c1c6b13ae99bf7f51532a6aa86cd50d690", + "url": "https://api.github.com/repos/yalter/niri/tarball/refs/tags/v25.05.1", + "hash": "sha256-z4viQZLgC2bIJ3VrzQnR+q2F3gAOEQpU1H5xHtX/2fs=" + }, "nixfmt": { "type": "GitRelease", "repository": { diff --git a/packages/default.nix b/packages/default.nix index c1ab3bb..bacd417 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -5,16 +5,12 @@ }: let inherit (pkgs) lib; - helix = pkgs.callPackage ./helix { }; kakoune = pkgs.callPackage ./kakoune.nix { }; fish = pkgs.callPackage ./fish { inherit lib; }; - nushell = pkgs.callPackage ./nushell { }; in { inherit kakoune fish - helix - nushell ; } diff --git a/packages/helix/colorscheme.nix b/packages/helix/colorscheme.nix deleted file mode 100644 index 4aa1f86..0000000 --- a/packages/helix/colorscheme.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - inherits = "gruvbox_dark_hard"; - "ui.background" = { }; -} diff --git a/packages/helix/default.nix b/packages/helix/default.nix deleted file mode 100644 index 2409a1c..0000000 --- a/packages/helix/default.nix +++ /dev/null @@ -1,220 +0,0 @@ -{ - sources, - basedpyright, - bash-language-server, - callPackage, - clang-tools, - clippy, - cmake-format, - cmake-language-server, - deadnix, - deno, - dprint, - fetchzip, - formats, - gdb, - golangci-lint-langserver, - gopls, - helix, - kdePackages, - kdlfmt, - lazygit, - lib, - lldb_19, - makeWrapper, - nixd, - ruff, - rust-analyzer, - rustPlatform, - rustfmt, - shellcheck, - shfmt, - simple-completion-language-server, - superhtml, - symlinkJoin, - taplo, - tinymist, - typescript-language-server, - vscode-langservers-extracted, - zls, - ... -}: -let - inherit (lib.meta) getExe; - - custom-helix = helix.overrideAttrs ( - finalAttrs: previousAttrs: { - version = "25.07.2"; - src = fetchzip { - url = "https://github.com/bloxx12/helix/releases/download/${finalAttrs.version}/helix-${finalAttrs.version}-source.tar.xz"; - hash = "sha256-ZNsQwFfPXe6oewajx1tl68W60kVo7q2SuvTgy/o1HKk="; - stripRoot = false; - }; - - doInstallCheck = false; - - cargoDeps = rustPlatform.fetchCargoVendor { - inherit (custom-helix) src; - hash = "sha256-3poZSvIrkx8lguxxDeNfngW6+4hH8TV/LHcZx5W5aXg="; - }; - } - ); - - toml = formats.toml { }; - - helix-languages = callPackage ./languages.nix { inherit lib sources; }; - colorscheme = toml.generate "colorscheme.toml" (import ./colorscheme.nix); - - helix-config = { - theme = "theme_transparent"; - editor = { - cursorline = false; - color-modes = true; - true-color = true; - indent-guides.render = true; - lsp = { - enable = true; - auto-signature-help = true; - display-inlay-hints = false; - display-messages = true; - snippets = true; - }; - file-picker = { - hidden = true; - }; - line-number = "relative"; - auto-format = true; - completion-timeout = 5; - mouse = true; - bufferline = "multiple"; - soft-wrap.enable = true; - word-completion = { - enable = true; - trigger-length = 2; - }; - 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 lazygit}" - ":buffer-close!" - ":redraw" - ]; - i = ":toggle lsp.display-inlay-hints"; - }; - 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" - ]; - ";" = "flip_selections"; - "A-;" = "collapse_selection"; - - # Kakoune-like config - H = "extend_char_left"; - J = "extend_line_down"; - K = "extend_line_up"; - L = "extend_char_right"; - }; - select = { - A-x = "extend_to_line_bounds"; - X = [ - "extend_line_up" - "extend_to_line_bounds" - ]; - g = { - e = "goto_file_end"; - }; - }; - }; - }; - wrapped-helix = symlinkJoin { - name = "helix-wrapped"; - paths = [ - custom-helix - - # Bash - bash-language-server - # C/C++ - clang-tools - clippy - golangci-lint-langserver - gopls - lldb_19 - # Markdown - taplo - - nixd - rust-analyzer - rustfmt - # Shell - shellcheck - - kdlfmt - - superhtml - # toml - taplo - # typst - tinymist - # typst lsp - vscode-langservers-extracted - - kdlfmt - - # zig language server - zls - ]; - nativeBuildInputs = [ makeWrapper ]; - postBuild = '' - mkdir -p $out/config/helix/themes - cp "${toml.generate "config.toml" helix-config}" $out/config/helix/config.toml - cp "${helix-languages}" $out/config/helix/languages.toml - cp "${colorscheme}" $out/config/helix/themes/theme_transparent.toml - wrapProgram $out/bin/hx --set \ - XDG_CONFIG_HOME $out/config - ''; - }; -in -wrapped-helix diff --git a/packages/helix/languages.nix b/packages/helix/languages.nix deleted file mode 100644 index 00b457f..0000000 --- a/packages/helix/languages.nix +++ /dev/null @@ -1,344 +0,0 @@ -{ - sources, - basedpyright, - bash-language-server, - callPackage, - clang-tools, - cmake-format, - cmake-language-server, - deadnix, - deno, - dprint, - fetchFromGitHub, - formats, - gdb, - kdePackages, - lib, - nil, - ruff, - rustPlatform, - shfmt, - typescript-language-server, - vscode-langservers-extracted, - zls, - ... -}: -let - inherit (lib.meta) getExe getExe'; - - toml = formats.toml { }; - - nixfmt = callPackage "${sources.nixfmt}/default.nix" { }; - - # a newer nil version, for pipes support. - new-nil = nil.overrideAttrs (_: { - version = "unstable-18-07-2025"; - - src = fetchFromGitHub { - owner = "oxalica"; - repo = "nil"; - rev = "524ae2d67dd84d99a10f409ed6cd8e4e7b3cae3f"; - hash = "sha256-Uy2qzd+fMoBcp4NPSO7DavEC1pGMegmAqoEMvmXbIQU="; - }; - - doInstallCheck = false; - - cargoDeps = rustPlatform.fetchCargoVendor { - inherit (new-nil) src; - hash = "sha256-Sljr3ff8hl/qm/0wqc1GXsEr1wWn7NAXmdrd5wHzUX8="; - }; - }); - - new-deadnix = deadnix.overrideAttrs ( - finalAttrs: previousAttrs: { - version = "unstable-15-07-2025"; - src = fetchFromGitHub { - owner = "astro"; - repo = "deadnix"; - rev = "d75457b95d7cfa82fcd60970939f76fccfce19e5"; - hash = "sha256-O/z2neAXL8JNkGosvxC+DyZnnJ8zYP9XHApxHVmlzfY="; - }; - - doInstallCheck = false; - - cargoDeps = rustPlatform.fetchCargoVendor { - inherit (new-deadnix) src; - hash = "sha256-O8yhqyPflOvQXAA19k1XpbrHysgV5VNWLBX0l5Q5GkM="; - }; - } - ); - helix-languages = { - language = - let - mark = lang: { - command = getExe deno; - args = [ - "fmt" - "-" - "--ext" - lang - ]; - }; - in - [ - { - name = "bash"; - auto-format = true; - formatter = { - command = getExe 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 cmake-format; - args = [ "-" ]; - }; - } - { - name = "javascript"; - auto-format = true; - language-servers = [ - "dprint" - "typescript-language-server" - ]; - } - { - name = "json"; - formatter = mark "json"; - } - { - name = "markdown"; - auto-format = true; - formatter = mark "md"; - language-servers = [ "taplo" ]; - } - { - name = "nix"; - language-servers = [ "nil" ]; - } - { - name = "qml"; - language-servers = [ "qmlls" ]; - } - { - name = "python"; - auto-format = true; - language-servers = [ - "basedpyright" - "ruff" - ]; - } - { - name = "typescript"; - auto-format = true; - language-servers = [ - "dprint" - "typescript-language-server" - ]; - } - { - name = "rust"; - } - { - name = "c"; - auto-format = true; - language-servers = [ "clangd" ]; - } - { - name = "zig"; - auto-format = true; - } - { - name = "c"; - debugger = { - name = "gdb"; - command = getExe 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 bash-language-server; - args = [ "start" ]; - }; - - rust-analyzer = { - config.rust-analyzer = { - checkOnSave.command = "clippy"; - procMacro.enable = true; - cargo = { - loadOutDirsFromCheck = true; - features = "all"; - }; - assist = { - preferSelf = true; - }; - check = { - command = "clippy"; - extraArgs = [ - "--" - "-W" - "clippy::pedantic" - "-W" - "clippy::nursery" - "-W" - "clippy::perf" - ]; - }; - lens = { - references = true; - methodReferences = true; - }; - completion.autoimport.enable = true; - experimental.procAttrMacros = true; - interpret.tests = true; - }; - }; - - clangd = { - command = "${clang-tools}/bin/clangd"; - clangd.fallbackFlags = [ "-std=c++2b" ]; - }; - - cmake-language-server = { - command = getExe cmake-language-server; - }; - - deno-lsp = { - command = getExe deno; - args = [ "lsp" ]; - environment.NO_COLOR = "1"; - config.deno = { - enable = true; - lint = true; - unstable = true; - suggest = { - completeFunctionCalls = false; - imports = { - hosts."https://deno.land" = true; - }; - }; - inlayHints = { - enumMemberValues.enabled = true; - functionLikeReturnTypes.enabled = true; - parameterNames.enabled = "all"; - parameterTypes.enabled = true; - propertyDeclarationTypes.enabled = true; - variableTypes.enabled = true; - }; - }; - }; - dprint = { - command = getExe dprint; - args = [ "lsp" ]; - }; - - nil = { - command = getExe new-nil; - config.nil = { - formatting.command = [ "${getExe nixfmt}" ]; - diagnostics = { - bindingEndHintMinLines = 3; - }; - nix.flake = { - autoArchive = true; - # autoEvalInputs = true; - nixpkgsInputName = "nixpkgs"; - }; - }; - }; - deadnix = { - command = getExe new-deadnix; - }; - - typescript-language-server = { - command = getExe typescript-language-server; - args = [ "--stdio" ]; - config = { - typescript-language-server.source = { - addMissingImports.ts = true; - fixAll.ts = true; - organizeImports.ts = true; - removeUnusedImports.ts = true; - sortImports.ts = true; - }; - }; - }; - ruff = { - command = getExe ruff; - args = [ "server" ]; - }; - - qmlls = { - command = getExe' kdePackages.qtdeclarative "qmlls"; - args = [ "-E" ]; - }; - basedpyright.command = "${basedpyright}/bin/basedpyright-langserver"; - - vscode-css-language-server = { - command = "${vscode-langservers-extracted}/bin/vscode-css-language-server"; - args = [ "--stdio" ]; - config = { - provideFormatter = true; - css.validate.enable = true; - scss.validate.enable = true; - }; - }; - zls = { - command = getExe zls; - config = { - enable_build_on_save = true; - build_on_save_args = [ - "check" - "-fincremental" - "--watch" - ]; - enable_autofix = false; - warn_style = true; - highlight_global_var_declarations = true; - }; - }; - }; - }; -in -toml.generate "languages.toml" helix-languages diff --git a/packages/nushell/config.nu b/packages/nushell/config.nu deleted file mode 100644 index 65a7547..0000000 --- a/packages/nushell/config.nu +++ /dev/null @@ -1,332 +0,0 @@ -#! /usr/bin/env nu - -$env.config = { - bracketed_paste: true - buffer_editor: "hx" - datetime_format: {} - edit_mode: vi - error_style: fancy - float_precision: 2 - footer_mode: 25 - render_right_prompt_on_last_line: false - show_banner: false - use_ansi_coloring: true - use_kitty_protocol: true - - shell_integration: { - osc2: false - osc7: true - osc8: true - osc9_9: false - osc133: true - osc633: true - reset_application_mode: true - } -} - -$env.config.ls = { - clickable_links: true - use_ls_colors: true -} - -$env.config.rm.always_trash = true - -$env.config.table = { - header_on_separator: true - footer_inheritance: true - index_mode: always - mode: compact - missing_value_symbol: kek - padding: {left: 1 right: 1} - show_empty: false - trim: { - methodology: wrapping - truncating_suffix: "..." - wrapping_try_keep_words: true - } -} - -$env.config.explore = { - command_bar_text: {fg: "#C4C9C6"} - highlight: {fg: black bg: yellow} - status: { - error: {fg: white bg: red} - warn: {} - info: {} - } - status_bar_background: {fg: "#1D1F21" bg: "#C4C9C6"} - table: { - split_line: {fg: "#404040"} - selected_cell: {bg: light_blue} - selected_row: {} - selected_column: {} - } -} - -$env.config.history = { - file_format: sqlite - isolation: false - max_size: 100_000 - sync_on_enter: true -} - -$env.config.cursor_shape = { - vi_insert: line - vi_normal: block -} - -$env.config.hooks = { - command_not_found: {|| } - - pre_execution: [ - { - let prompt = commandline | str trim - - if ($prompt | is-empty) { - return - } - - print $"(ansi title)($prompt) — nu(char bel)" - } - ] - - env_change: { - PWD: [ - {|| - if not ($env.PWD | path join .envrc | path exists) { - return - } - if (which direnv | is-empty) { - return - } - - direnv export json | from json | default {} | load-env - $env.PATH = $env.PATH | split row (char env_sep) - } - ] - } -} - -$env.config.menus = [ - { - marker: $"(ansi yellow)╋ " - name: help_menu - only_buffer_difference: true - style: { - description_text: yellow - selected_text: red_reverse - text: yellow - } - type: { - col_padding: 2 - col_width: 20 - columns: 4 - description_rows: 10 - layout: description - selection_rows: 4 - } - } -] - -$env.config.keybindings = [ - { - name: copy_commandline - modifier: alt - keycode: char_c - mode: [vi_normal vi_insert] - event: { - send: executehostcommand - cmd: 'commandline | nu-highlight | $"```ansi\n($in)\n```" | wl-copy $in' - } - } - { - name: escape - modifier: none - keycode: escape - mode: [vi_normal vi_insert] - event: {send: esc} - } - { - name: cancel_command - modifier: control - keycode: char_c - mode: [vi_normal vi_insert] - event: {send: ctrlc} - } - { - name: quit_shell - modifier: control - keycode: char_d - mode: [vi_normal vi_insert] - event: {send: ctrld} - } - { - name: clear_screen - modifier: control - keycode: char_l - mode: [vi_normal vi_insert] - event: {send: clearscreen} - } - { - name: open_command_editor - modifier: control - keycode: char_o - mode: [vi_normal vi_insert] - event: {send: openeditor} - } - { - name: abbr - modifier: control - keycode: space - mode: [vi_normal vi_insert] - event: [ - {send: menu name: abbr_menu} - {edit: insertchar value: " "} - ] - } - { - name: move_down - modifier: none - keycode: down - mode: [vi_normal vi_insert] - event: { - until: [ - {send: menudown} - {send: down} - ] - } - } - { - name: move_left - modifier: none - keycode: left - mode: [vi_normal vi_insert] - event: { - until: [ - {send: menuleft} - {send: left} - ] - } - } - { - name: move_right_or_take_history_hint - modifier: none - keycode: right - mode: [vi_normal vi_insert] - event: { - until: [ - {send: historyhintcomplete} - {send: menuright} - {send: right} - ] - } - } - { - name: move_one_word_left - modifier: control - keycode: left - mode: [vi_normal vi_insert] - event: {edit: movewordleft} - } - { - name: move_one_word_right_or_take_history_hint - modifier: control - keycode: right - mode: [vi_normal vi_insert] - event: { - until: [ - {send: historyhintwordcomplete} - {edit: movewordright} - ] - } - } - { - name: move_to_line_start - modifier: control - keycode: char_a - mode: [vi_normal vi_insert] - event: {edit: movetolinestart} - } - { - name: move_to_line_end_or_take_history_hint - modifier: control - keycode: char_e - mode: [vi_normal vi_insert] - event: { - until: [ - {send: historyhintcomplete} - {edit: movetolineend} - ] - } - } - { - name: delete_one_character_backward - modifier: none - keycode: backspace - mode: vi_insert - event: {edit: backspace} - } - { - name: delete_one_word_backward - modifier: control - keycode: backspace - mode: vi_insert - event: {edit: backspaceword} - } - { - name: newline_or_run_command - modifier: none - keycode: enter - mode: vi_insert - event: {send: enter} - } - { - name: take_history_hint - modifier: control - keycode: char_f - mode: [vi_normal vi_insert] - event: { - until: [ - {send: historyhintcomplete} - ] - } - } -] - -let env_vars_file = '/tmp/nushell-env-vars' -if not ($env_vars_file | path exists) { - open /etc/profile - | lines - | select 11 - | str trim - | split column ' ' del path - | get path.0 - | open $in - | str trim - | lines - | parse 'export {name}="{value}"' - | transpose --header-row --as-record - | tee { load-env $in } - | to nuon - | save --force $env_vars_file -} else { - open $env_vars_file - | from nuon - | load-env $in -} - -def switch [] { - nh os switch --file ($env.NH_FLAKE | path join default.nix) (open /etc/hostname | str trim) -} - -# fix sudo by prepending /run/wrappers/bin to the PATH. -$env.PATH = ($env.PATH | split row (char esep) | prepend '/run/wrappers/bin') - -$env.CARAPACE_BRIDGES = 'inshellisense,fish,carapace,clap,bash' -$env.CARAPACE_MATCH = 1 - -# Set environment variables according to the path of the clone -$env.TOPIARY_CONFIG_FILE = ($env.HOME | path join .config | path join topiary languages.ncl) -$env.TOPIARY_LANGUAGE_DIR = ($env.HOME | path join .config | path join topiary languages) -# The prompt indicators are environmental variables that represent -# the state of the prompt. diff --git a/packages/nushell/default.nix b/packages/nushell/default.nix deleted file mode 100644 index d01a589..0000000 --- a/packages/nushell/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ pkgs, ... }: -let - inherit (pkgs) lib; - inherit (lib.meta) getExe; - - nu-config = - pkgs.writeText "nu-init" - # nu - '' - #!/usr/bin/env nu - source ${./config.nu} - source ${./prompt.nu} - - let autoload_dir = $nu.user-autoload-dirs.0 - mkdir $autoload_dir - - let zoxide_path = $autoload_dir | path join zoxide.nu - if not ($zoxide_path | path exists) { - ${getExe pkgs.zoxide} init nushell --cmd cd | save -f $zoxide_path - } - # Atuin is too slow, sadly. - # let atuin_path = $autoload_dir | path join atuin.nu - # if not ($atuin_path | path exists) { - # ${getExe pkgs.atuin} init nu | save -f $atuin_path - # } - let carapace_path = $autoload_dir | path join carapace.nu - if not ($carapace_path | path exists) { - ${getExe pkgs.carapace} _carapace nushell | save -f $carapace_path - } - ''; - packages = import ./packages.nix pkgs; -in -(pkgs.symlinkJoin { - name = "nushell"; - paths = [ pkgs.nushell ] ++ packages; - nativeBuildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram $out/bin/nu --add-flags "\ - --config ${nu-config}" - ''; -}).overrideAttrs - (_: { - passthru = { - shellPath = "/bin/nu"; - }; - meta.mainProgram = "nu"; - }) diff --git a/packages/nushell/packages.nix b/packages/nushell/packages.nix deleted file mode 100644 index cea8418..0000000 --- a/packages/nushell/packages.nix +++ /dev/null @@ -1,65 +0,0 @@ -pkgs: -builtins.attrValues { - inherit (pkgs) - # better cd - zoxide - # pipe viewer - pv - # hex editor - bvi - #better ls - eza - atuin - # better cat - bat - # clipboard - # yazi - serpl - diff-so-fancy - tig - direnv - sesh - mprocs - curlie - entr - procs - sd - # mult - glow - # dua-cli - dust - kondo - # better grep - ripgrep - # IP stuff - dig - # simply the best fetch tool out there - microfetch - fzf - element - difftastic - hexyl - yazi - gnumake - asciinema - inetutils - tokei - starship - wget - cpufetch - watchman - tealdeer - hyperfine - imagemagick - ffmpeg-full - timg - nmap - fd - jq - rsync - figlet - unzip - zip - ouch - ; -}