diff --git a/flake.lock b/flake.lock index 1bdbf8d..356fe13 100644 --- a/flake.lock +++ b/flake.lock @@ -239,11 +239,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -257,11 +257,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -290,7 +290,25 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_6" + "systems": "systems_4" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "inputs": { + "systems": "systems_7" }, "locked": { "lastModified": 1705309234, @@ -306,9 +324,9 @@ "type": "github" } }, - "flake-utils_5": { + "flake-utils_6": { "inputs": { - "systems": "systems_7" + "systems": "systems_8" }, "locked": { "lastModified": 1710146030, @@ -324,9 +342,9 @@ "type": "github" } }, - "flake-utils_6": { + "flake-utils_7": { "inputs": { - "systems": "systems_8" + "systems": "systems_9" }, "locked": { "lastModified": 1705309234, @@ -342,6 +360,21 @@ "type": "github" } }, + "flakey-profile": { + "locked": { + "lastModified": 1712898590, + "narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=", + "owner": "lf-", + "repo": "flakey-profile", + "rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d", + "type": "github" + }, + "original": { + "owner": "lf-", + "repo": "flakey-profile", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -514,6 +547,41 @@ "url": "https://raw.githubusercontent.com/ziglang/zig/0fb2015fd3422fc1df364995f9782dfe7255eccd/doc/langref.html.in" } }, + "lix": { + "flake": false, + "locked": { + "lastModified": 1746827285, + "narHash": "sha256-hsFe4Tsqqg4l+FfQWphDtjC79WzNCZbEFhHI8j2KJzw=", + "rev": "47aad376c87e2e65967f17099277428e4b3f8e5a", + "type": "tarball", + "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/47aad376c87e2e65967f17099277428e4b3f8e5a.tar.gz?rev=47aad376c87e2e65967f17099277428e4b3f8e5a" + }, + "original": { + "type": "tarball", + "url": "https://git.lix.systems/lix-project/lix/archive/2.93.0.tar.gz" + } + }, + "lix-module": { + "inputs": { + "flake-utils": "flake-utils", + "flakey-profile": "flakey-profile", + "lix": "lix", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1746838955, + "narHash": "sha256-11R4K3iAx4tLXjUs+hQ5K90JwDABD/XHhsM9nkeS5N8=", + "rev": "cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc", + "type": "tarball", + "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz" + } + }, "mnw": { "locked": { "lastModified": 1747499976, @@ -531,7 +599,7 @@ }, "moonlight": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ] @@ -618,7 +686,7 @@ }, "nix-options-search": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "gitignore": "gitignore", "nixpkgs": "nixpkgs" }, @@ -706,21 +774,6 @@ "type": "github" } }, - "nixpkgs-stable_2": { - "locked": { - "lastModified": 1720535198, - "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-23.11", - "type": "indirect" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1747744144, @@ -797,13 +850,13 @@ "nvf": { "inputs": { "flake-parts": "flake-parts", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "mnw": "mnw", "nil": "nil", "nixpkgs": [ "nixpkgs" ], - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1747525582, @@ -836,13 +889,13 @@ "apple-fonts": "apple-fonts", "darwin": "darwin", "home-manager": "home-manager", + "lix-module": "lix-module", "moonlight": "moonlight", "nh": "nh", "nix-index-database": "nix-index-database", "nix-options-search": "nix-options-search", "nixos-cosmic": "nixos-cosmic", "nixpkgs": "nixpkgs_2", - "nixpkgs-stable": "nixpkgs-stable_2", "nvf": "nvf", "rust-overlay": "rust-overlay_3", "stylix": "stylix", @@ -1013,7 +1066,7 @@ "nixpkgs" ], "nur": "nur", - "systems": "systems_5", + "systems": "systems_6", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", "tinted-schemes": "tinted-schemes", @@ -1154,6 +1207,21 @@ "type": "github" } }, + "systems_9": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tinted-foot": { "flake": false, "locked": { @@ -1260,7 +1328,7 @@ "zig": { "inputs": { "flake-compat": "flake-compat_3", - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "nixpkgs": "nixpkgs_3" }, "locked": { @@ -1280,7 +1348,7 @@ "zig-overlay": { "inputs": { "flake-compat": "flake-compat_4", - "flake-utils": "flake-utils_6", + "flake-utils": "flake-utils_7", "nixpkgs": [ "zls", "nixpkgs" @@ -1302,7 +1370,7 @@ }, "zls": { "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_6", "gitignore": "gitignore_3", "langref": "langref", "nixpkgs": "nixpkgs_4", diff --git a/flake.nix b/flake.nix index 8877e2f..7e5975a 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,11 @@ description = "multi device configuration flake"; inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; - nixpkgs-stable.url = "nixpkgs/nixos-23.11"; + + lix-module = { + url = "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager.url = "github:nix-community/home-manager/master"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; @@ -43,6 +47,7 @@ { self, nixpkgs, + lix-module, nixos-cosmic, darwin, ... @@ -92,6 +97,7 @@ inherit overlays nixpkgs + lix-module inputs mkNeovim ; diff --git a/lib/mkSystem.nix b/lib/mkSystem.nix index 40387ac..ab0ef67 100644 --- a/lib/mkSystem.nix +++ b/lib/mkSystem.nix @@ -2,32 +2,24 @@ # particular architecture. { nixpkgs, + lix-module, overlays, inputs, mkNeovim, -}: name: { +}: +name: +{ user, # ./users/{name} host, # ./users/{name}/{host} system, # arch-os - extraModules ? [], -}: let + extraModules ? [ ], +}: +let darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system; - getInputModule = a: b: - inputs.${ - a - }.${ - if darwin - then "darwinModules" - else "nixosModules" - }.${ - b - }; + getInputModule = a: b: inputs.${a}.${if darwin then "darwinModules" else "nixosModules"}.${b}; # NixOS vs nix-darwin functions - systemFunc = - if darwin - then inputs.darwin.lib.darwinSystem - else nixpkgs.lib.nixosSystem; + systemFunc = if darwin then inputs.darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; userDir = ../users + "/${user}"; userConfig = import (userDir + "/user.nix"); @@ -38,10 +30,7 @@ hostHomePath = hostDir + "/home.nix"; userHomePath = userDir + "/home.nix"; - pathOrNull = a: - if builtins.pathExists a - then a - else null; + pathOrNull = a: if builtins.pathExists a then a else null; # Arguments passed to all module files args = { @@ -68,18 +57,14 @@ term, # preferred $TERM editor, # preferred $EDITOR browser ? null, # preferred $BROWSER - } @ user: - user + }@user: + user ) - userConfig; + userConfig; }; systemSettings = rec { inherit darwin; - homeDir = "/${ - if darwin - then "Users" - else "home" - }/${userConfig.username}"; + homeDir = "/${if darwin then "Users" else "home"}/${userConfig.username}"; }; mainHomeImports = builtins.filter (f: f != null) [ @@ -92,60 +77,59 @@ } ]; in - systemFunc { - inherit system; +systemFunc { + inherit system; - modules = - builtins.filter (f: f != null) [ - # Apply our overlays. Overlays are keyed by system type so we have - # to go through and apply our system type. We do this first so - # the overlays are available globally. - {nixpkgs.overlays = overlays;} + modules = + builtins.filter (f: f != null) [ + # Apply our overlays. Overlays are keyed by system type so we have + # to go through and apply our system type. We do this first so + # the overlays are available globally. + { nixpkgs.overlays = overlays; } - # Modules shared between nix-darwin and NixOS - ../modules/shared - # Modules for the specific OS - ( - if darwin - then ../modules/macos - else ../modules/nixos - ) + # Use lix (alternative nix implementation) + # https://lix.systems/add-to-config/#flake-based-configurations + lix-module.nixosModules.default + # (getInputModule "lix-module" "default") - # The user-wide configuration.nix - (pathOrNull userConfigPath) - # The host-wide configuration.nix - (pathOrNull hostConfigPath) + # Modules shared between nix-darwin and NixOS + ../modules/shared + # Modules for the specific OS + (if darwin then ../modules/macos else ../modules/nixos) - # Set up nix-index and enable comma for easy one-shot command use - # https://github.com/nix-community/comma - (getInputModule "nix-index-database" "nix-index") - {programs.nix-index-database.comma.enable = true;} + # The user-wide configuration.nix + (pathOrNull userConfigPath) + # The host-wide configuration.nix + (pathOrNull hostConfigPath) - # Themes for all programs - (getInputModule "stylix" "stylix") + # Set up nix-index and enable comma for easy one-shot command use + # https://github.com/nix-community/comma + (getInputModule "nix-index-database" "nix-index") + { programs.nix-index-database.comma.enable = true; } - # Home manager - (getInputModule "home-manager" "home-manager") - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "hm-backup"; - # Arguments passed to all module files - extraSpecialArgs = - args - // { - inherit mainHomeImports; - }; - # can't find how to make this an array without the param - users.${userConfig.username} = ../modules/home; + # Themes for all programs + (getInputModule "stylix" "stylix") + + # Home manager + (getInputModule "home-manager" "home-manager") + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "hm-backup"; + # Arguments passed to all module files + extraSpecialArgs = args // { + inherit mainHomeImports; }; - users.users.${userConfig.username}.home = systemSettings.homeDir; - } + # can't find how to make this an array without the param + users.${userConfig.username} = ../modules/home; + }; + users.users.${userConfig.username}.home = systemSettings.homeDir; + } - # Arguments passed to all module files - {config._module.args = args;} - ] - # Add extra modules specified from config - ++ extraModules; - } + # Arguments passed to all module files + { config._module.args = args; } + ] + # Add extra modules specified from config + ++ extraModules; +} diff --git a/users/natalie/vim/default.nix b/users/natalie/vim/default.nix index 4634262..7568a91 100644 --- a/users/natalie/vim/default.nix +++ b/users/natalie/vim/default.nix @@ -4,6 +4,6 @@ ./languages.nix ./latex.nix ./lean.nix - ./ui.nix + ./visuals.nix ]; } diff --git a/users/natalie/vim/languages.nix b/users/natalie/vim/languages.nix index b15b78d..f35d571 100644 --- a/users/natalie/vim/languages.nix +++ b/users/natalie/vim/languages.nix @@ -4,24 +4,16 @@ host, pkgs, ... -}: let - darwin = - if host.darwin - then "darwin" - else "nixos"; - flakePath = "/${ - if host.darwin - then "Users" - else "home" - }/${user.username}/.dotfiles"; +}: +let + darwin = if host.darwin then "darwin" else "nixos"; + flakePath = "/${if host.darwin then "Users" else "home"}/${user.username}/.dotfiles"; # BIG HACK DO NOT DO PLS - hostname = - if host.darwin - then "Natalies-MacBook-Air" - else "nixos"; -in { + hostname = if host.darwin then "Natalies-MacBook-Air" else "nixos"; +in +{ vim = { extraPackages = with pkgs; [ python312Packages.pylatexenc @@ -94,18 +86,30 @@ in { enable = true; setupOpts = { formatters_by_ft = { - fish = ["fish_indent"]; - tex = ["latexindent"]; + fish = [ "fish_indent" ]; + tex = [ "latexindent" ]; }; }; }; - diagnostics.nvim-lint = { + diagnostics = { enable = true; - linters_by_ft = { - nix = ["statix"]; - tex = ["chktex"]; - haskell = ["hlint"]; + config = { + virtual_text = { + format = pkgs.lib.generators.mkLuaInline '' + function(diagnostic) + return string.format("%s (%s)", diagnostic.message, diagnostic.source) + end + ''; + }; + }; + nvim-lint = { + enable = true; + linters_by_ft = { + nix = [ "statix" ]; + tex = [ "chktex" ]; + haskell = [ "hlint" ]; + }; }; }; treesitter = { diff --git a/users/natalie/vim/ui.nix b/users/natalie/vim/visuals.nix similarity index 64% rename from users/natalie/vim/ui.nix rename to users/natalie/vim/visuals.nix index 531a3cd..a4f0ac6 100644 --- a/users/natalie/vim/ui.nix +++ b/users/natalie/vim/visuals.nix @@ -1,5 +1,10 @@ {pkgs, ...}: { vim = { + visuals = { + indent-blankline = { + enable = true; + }; + }; ui = { borders = { enable = true; @@ -7,7 +12,7 @@ }; # Better help docs - lazy.plugins."helpview-nvim" = { + lazy.plugins."helpview.nvim" = { enabled = true; package = pkgs.vimPlugins.helpview-nvim; lazy = false;