From c581b9cf26c3bb2289f418c76631e685df957de9 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Thu, 13 Jul 2023 16:10:44 +0200 Subject: [PATCH] Update deps, flake-parts, treefmt --- .envrc | 1 + flake.lock | 68 ++++++++++++++-- flake.nix | 132 ++++++++++++++++++++----------- home/config/nvim/plugins/lsp.fnl | 8 +- home/programs/nvim/default.nix | 2 +- home/programs/nvim/plugins.nix | 12 +-- 6 files changed, 163 insertions(+), 60 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.lock b/flake.lock index 7adff27..077ba57 100644 --- a/flake.lock +++ b/flake.lock @@ -195,6 +195,24 @@ "type": "github" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1688466019, + "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1667395993, @@ -318,7 +336,7 @@ "nifoc-overlay": { "inputs": { "bdfr-browser-flake": "bdfr-browser-flake", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "neovim-flake": "neovim-flake", "nixpkgs": [ "nixpkgs" @@ -377,11 +395,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1689196637, - "narHash": "sha256-ij4T7iwOrvdXZiV/iXoKhEarANvOkr24sLBhvaqZ7Qk=", + "lastModified": 1689230645, + "narHash": "sha256-5PKMCkMQIhdW6DFpNVm4DOQ81PoSPsYcTL3fqlBUWpA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "04dc69b62ec24a462585c1e705b711e2e05f3080", + "rev": "686945e0c07d68a6ca624438f1623fd3284ec15d", "type": "github" }, "original": { @@ -409,6 +427,24 @@ "type": "github" } }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1688049487, + "narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1685004253, @@ -431,11 +467,13 @@ "attic": "attic", "deploy-rs": "deploy-rs", "disko": "disko", + "flake-parts": "flake-parts", "home-manager": "home-manager_2", "nifoc-overlay": "nifoc-overlay", "nix-darwin": "nix-darwin", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" } }, "rust-overlay": { @@ -480,6 +518,26 @@ "type": "github" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1689243103, + "narHash": "sha256-IfBt2AD8qCwZs+m6BlOGEitBIkVJ0iMscMueb6QYUk4=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "f1dca68b908f3dd656b923b9fb62f7d755133662", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1667395993, diff --git a/flake.nix b/flake.nix index 19c1e50..a00cf3f 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,17 @@ # nixpkgs-master.url = "github:nixos/nixpkgs/master"; + # Tools + + flake-parts.url = "github:hercules-ci/flake-parts"; + + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # Overlays + disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; @@ -43,57 +54,90 @@ }; }; - outputs = inputs@{ self, ... }: - let - Styx = import ./system/flakes/Styx.nix { - inherit (inputs) nixpkgs home-manager nix-darwin; - inherit inputs; - }; + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + flake = + let + Styx = import ./system/flakes/Styx.nix { + inherit (inputs) nixpkgs home-manager nix-darwin; + inherit inputs; + }; - tanker = import ./system/flakes/tanker.nix { - inherit (inputs) nixpkgs disko deploy-rs home-manager agenix attic; - inherit inputs; - }; + tanker = import ./system/flakes/tanker.nix { + inherit (inputs) nixpkgs disko deploy-rs home-manager agenix attic; + inherit inputs; + }; - mediaserver = import ./system/flakes/mediaserver.nix { - inherit (inputs) nixpkgs deploy-rs home-manager agenix; - inherit inputs; - }; + mediaserver = import ./system/flakes/mediaserver.nix { + inherit (inputs) nixpkgs deploy-rs home-manager agenix; + inherit inputs; + }; - argon = import ./system/flakes/argon.nix { - inherit (inputs) nixpkgs nixos-hardware deploy-rs home-manager agenix; - inherit inputs; - }; + argon = import ./system/flakes/argon.nix { + inherit (inputs) nixpkgs nixos-hardware deploy-rs home-manager agenix; + inherit inputs; + }; - weather-sdr = import ./system/flakes/weather-sdr.nix { - inherit (inputs) nixpkgs deploy-rs home-manager agenix; - inherit inputs; - }; + weather-sdr = import ./system/flakes/weather-sdr.nix { + inherit (inputs) nixpkgs deploy-rs home-manager agenix; + inherit inputs; + }; - adsb-antenna = import ./system/flakes/adsb-antenna.nix { - inherit (inputs) nixpkgs nixos-hardware deploy-rs home-manager; - inherit inputs; - }; - in - { - darwinConfigurations = { - "Styx" = Styx.system; - }; + adsb-antenna = import ./system/flakes/adsb-antenna.nix { + inherit (inputs) nixpkgs nixos-hardware deploy-rs home-manager; + inherit inputs; + }; + in + { + darwinConfigurations = { + "Styx" = Styx.system; + }; - nixosConfigurations = { - tanker = tanker.system; - mediaserver = mediaserver.system; - argon = argon.system; - weather-sdr = weather-sdr.system; - adsb-antenna = adsb-antenna.system; - }; + nixosConfigurations = { + tanker = tanker.system; + mediaserver = mediaserver.system; + argon = argon.system; + weather-sdr = weather-sdr.system; + adsb-antenna = adsb-antenna.system; + }; - deploy.nodes = { - tanker = tanker.deployment; - mediaserver = mediaserver.deployment; - argon = argon.deployment; - weather-sdr = weather-sdr.deployment; - adsb-antenna = adsb-antenna.deployment; + deploy.nodes = { + tanker = tanker.deployment; + mediaserver = mediaserver.deployment; + argon = argon.deployment; + weather-sdr = weather-sdr.deployment; + adsb-antenna = adsb-antenna.deployment; + }; + }; + + imports = [ + inputs.treefmt-nix.flakeModule + ]; + + systems = [ + "aarch64-darwin" + "x86_64-linux" + "aarch64-linux" + ]; + + perSystem = { config, pkgs, ... }: { + treefmt = { + projectRootFile = "flake.nix"; + + programs = { + fnlfmt.enable = true; + nixpkgs-fmt.enable = true; + shfmt.enable = true; + }; + }; + + devShells.default = pkgs.mkShell { + name = "dotfiles"; + + inputsFrom = [ + config.treefmt.build.devShell + ]; + }; }; }; } diff --git a/home/config/nvim/plugins/lsp.fnl b/home/config/nvim/plugins/lsp.fnl index d46849d..7e19ca6 100644 --- a/home/config/nvim/plugins/lsp.fnl +++ b/home/config/nvim/plugins/lsp.fnl @@ -47,10 +47,10 @@ ;; Custom (lsp.elixirls.setup (->> {:cmd [:elixir-ls]} (vim.tbl_extend :force default-config))) - ;(lsp.nil_ls.setup (->> {:settings {:nil {:formatting {:command [:nixpkgs-fmt]}}}} - ; (vim.tbl_extend :force default-config))) - (lsp.nixd.setup (->> {:settings {:formatting {:command [:nixpkgs-fmt]}}} - (vim.tbl_extend :force default-config))) + (lsp.nil_ls.setup (->> {:settings {:nil {:formatting {:command [:nixpkgs-fmt]}}}} + (vim.tbl_extend :force default-config))) + ;; (lsp.nixd.setup (->> {:settings {:formatting {:command [:nixpkgs-fmt]}}} + ;; (vim.tbl_extend :force default-config))) (let [inlay-hints {:includeInlayParameterNameHints :all :includeInlayParameterNameHintsWhenArgumentMatchesName false :includeInlayFunctionParameterTypeHints true diff --git a/home/programs/nvim/default.nix b/home/programs/nvim/default.nix index a633ae6..6e4ab39 100644 --- a/home/programs/nvim/default.nix +++ b/home/programs/nvim/default.nix @@ -34,7 +34,7 @@ in nodePackages.typescript-language-server nodePackages.vscode-langservers-extracted nodePackages.yaml-language-server - nixd + # nixd taplo-lsp # Diagnostic Tools diff --git a/home/programs/nvim/plugins.nix b/home/programs/nvim/plugins.nix index 64dcc1e..74f3fd2 100644 --- a/home/programs/nvim/plugins.nix +++ b/home/programs/nvim/plugins.nix @@ -96,12 +96,12 @@ in }; dracula-nvim = buildVimPluginFrom2Nix { pname = "dracula.nvim"; - version = "2023-07-12"; + version = "2023-07-13"; src = fetchFromGitHub { owner = "Mofiqul"; repo = "dracula.nvim"; - rev = "253b7fcee27564b2adfa7e7cea80c74cfbe04787"; - sha256 = "1hgs93lcncmb7afi126vkfpmi5r0z727hg232d2d2vyhnkd77ary"; + rev = "9db13329e205aaee089e25be8113bd1faeca674e"; + sha256 = "1f79jazw5kp0ica4hdxpjry79qii8q6a0shg2rqkhpd0a8ydb8rg"; fetchSubmodules = false; }; }; @@ -429,12 +429,12 @@ in }; nvim-autopairs = buildVimPluginFrom2Nix { pname = "nvim-autopairs"; - version = "2023-06-18"; + version = "2023-07-13"; src = fetchFromGitHub { owner = "windwp"; repo = "nvim-autopairs"; - rev = "e8f7dd7a72de3e7b6626c050a802000e69d53ff0"; - sha256 = "0lk78zvmf5cyyq4nmrzybi7dbpbwx499r0la4wza9h1gp4l7xvy7"; + rev = "a16989a5453e0a0a8250deab340f429353876da4"; + sha256 = "107yfxwr2lf7zksshsp58gp1qj2p848azim4xw8kvvdksba2092z"; fetchSubmodules = false; }; };