From c4db6a0617bf6b58e4e5f34679ee7e424a221fd7 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 11 Apr 2025 13:29:01 -0500 Subject: [PATCH] feat: fixed horrible lsp problem --- .pre-commit-config.yaml | 2 +- flake.lock | 108 ++++++++++++++++++++++++++++-------- flake.nix | 34 +++++------- frontend/src/Auth.elm | 30 ---------- parts/config/devshells.nix | 40 +++++-------- parts/config/packages.nix | 4 ++ parts/config/pre-commit.nix | 7 +++ 7 files changed, 122 insertions(+), 103 deletions(-) delete mode 100755 frontend/src/Auth.elm create mode 100755 parts/config/packages.nix create mode 100755 parts/config/pre-commit.nix diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 98e393d..35e4747 120000 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1 +1 @@ -/nix/store/a2kn134qqb4whsh5y4bikcryhka2dgl4-pre-commit-config.json \ No newline at end of file +/nix/store/si1f73qc72k63h6kqdb5yz230p0vlnm4-pre-commit-config.json \ No newline at end of file diff --git a/flake.lock b/flake.lock index c4a31d2..ddf6a02 100755 --- a/flake.lock +++ b/flake.lock @@ -1,15 +1,31 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1736143030, - "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", "type": "github" }, "original": { @@ -17,13 +33,34 @@ "type": "indirect" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "haskell-flake": { "locked": { - "lastModified": 1736651225, - "narHash": "sha256-uLIDMc3DjZuXCKydXLDH6Inb/35qIIGa6acGytYkQCs=", + "lastModified": 1743922999, + "narHash": "sha256-Wh+Zak8sZUgair4pnZR0mLrLIhhInHS8izj7C1H10B8=", "owner": "srid", "repo": "haskell-flake", - "rev": "4b12bdd07b3aee5e4e5768b1b3db3c8b429af446", + "rev": "d102e0f8a1773b1a63a616faef670cf5e129f9e9", "type": "github" }, "original": { @@ -34,54 +71,77 @@ }, "nixpkgs": { "locked": { - "lastModified": 1736883708, - "narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=", - "owner": "NixOS", + "lastModified": 1744316434, + "narHash": "sha256-lzFCg/1C39pyY2hMB2gcuHV79ozpOz/Vu15hdjiFOfI=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "eb62e6aa39ea67e0b8018ba8ea077efe65807dc8", + "rev": "d19cf9dfc633816a437204555afeb9e722386b76", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", + "owner": "nixos", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-lib": { "locked": { - "lastModified": 1735774519, - "narHash": "sha256-CewEm1o2eVAnoqb6Ml+Qi9Gg/EfNAxbRx1lANGVyoLI=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz" + "lastModified": 1743296961, + "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz" + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" } }, - "nixpkgs-stable": { + "nixpkgs_2": { "locked": { - "lastModified": 1720535198, - "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", + "lastModified": 1730768919, + "narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", + "rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.11", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1742649964, + "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-parts": "flake-parts", "haskell-flake": "haskell-flake", "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable" + "pre-commit-hooks-nix": "pre-commit-hooks-nix" } } }, diff --git a/flake.nix b/flake.nix index ffbda7b..63da19c 100755 --- a/flake.nix +++ b/flake.nix @@ -1,30 +1,22 @@ { - description = "Elm Environment"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11"; haskell-flake.url = "github:srid/haskell-flake"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix"; }; - outputs = inputs @ { - flake-parts, - self, - ... - }: let - system = "x86_64-linux"; - in - flake-parts.lib.mkFlake {inherit inputs;} { + outputs = + inputs@{ + self, + nixpkgs, + flake-parts, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } { imports = [ - ./parts inputs.haskell-flake.flakeModule + inputs.pre-commit-hooks-nix.flakeModule + ./parts ]; - systems = [system]; - perSystem = {pkgs, ...}: { - _module.args.pkgs = import inputs.nixpkgs { - inherit system; - }; - _module.args.pkgs-stable = import inputs.nixpkgs-stable { - inherit system; - }; - }; + systems = nixpkgs.lib.systems.flakeExposed; }; } diff --git a/frontend/src/Auth.elm b/frontend/src/Auth.elm deleted file mode 100755 index 5794240..0000000 --- a/frontend/src/Auth.elm +++ /dev/null @@ -1,30 +0,0 @@ -module Auth exposing (User, onPageLoad, viewLoadingPage) - -import Auth.Action -import Dict -import Route exposing (Route) -import Route.Path -import Shared -import View exposing (View) - - -type alias User = - {} - - -{-| Called before an auth-only page is loaded. --} -onPageLoad : Shared.Model -> Route () -> Auth.Action.Action User -onPageLoad shared route = - Auth.Action.pushRoute - { path = Route.Path.NotFound_ - , query = Dict.empty - , hash = Nothing - } - - -{-| Renders whenever `Auth.Action.showLoadingPage` is returned from `onPageLoad`. --} -viewLoadingPage : Shared.Model -> Route () -> View Never -viewLoadingPage shared route = - View.fromString "Loading..." diff --git a/parts/config/devshells.nix b/parts/config/devshells.nix index 7eef6f8..de43e61 100755 --- a/parts/config/devshells.nix +++ b/parts/config/devshells.nix @@ -1,40 +1,32 @@ +{ pkgs, config, ... }: { - pkgs, - config, - pkgs-stable, - ... -}: { haskellProjects.default = { devShell = { enable = true; tools = hp: { - inherit - (hp) - cabal-fmt - haskell-language-server - ; + inherit (hp) cabal-fmt haskell-language-server; - inherit - (pkgs) - alejandra + inherit (pkgs) + age + just + nil + nixd + sops + ssh-to-age + nixfmt-rfc-style dhall dhall-json dhall-lsp-server helix-gpt - just libz ngrep - nil - sops - ssh-to-age stripe-cli vscode-langservers-extracted zlib ; - inherit - (pkgs-stable.elmPackages) + inherit (pkgs.elmPackages) elm elm-format elm-land @@ -43,17 +35,11 @@ elm-test ; - inherit - (pkgs.nodePackages_latest) - dotenv-cli - forever - nodejs - npm - typescript-language-server - ; + inherit (pkgs.haskellPackages) nixfmt; }; hlsCheck.enable = true; + mkShellArgs.shellHook = "${config.pre-commit.installationScript}"; }; }; } diff --git a/parts/config/packages.nix b/parts/config/packages.nix new file mode 100755 index 0000000..3a1752c --- /dev/null +++ b/parts/config/packages.nix @@ -0,0 +1,4 @@ +{ self, ... }: +{ + packages.default = self.packages.example; +} diff --git a/parts/config/pre-commit.nix b/parts/config/pre-commit.nix new file mode 100755 index 0000000..2e3f2dd --- /dev/null +++ b/parts/config/pre-commit.nix @@ -0,0 +1,7 @@ +{ + pre-commit.settings.hooks = { + nixfmt-rfc-style.enable = true; + commitizen.enable = true; + statix.enable = true; + }; +}