about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-23 18:27:57 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-23 18:27:57 +0200
commit42d0d64e66bd14727f80d482a7d1e9abcfb52f88 (patch)
tree9c14440723a77ca7e28718c297088a818d69cd01
parentrefactor(nixpkgs): Configure nixpkgs via the module system (diff)
downloadnixos-config-42d0d64e66bd14727f80d482a7d1e9abcfb52f88.tar.gz
nixos-config-42d0d64e66bd14727f80d482a7d1e9abcfb52f88.zip
refactor(flake): Update to new pkgs set
-rw-r--r--flake/default.nix174
-rw-r--r--flake/treefmt.nix73
2 files changed, 112 insertions, 135 deletions
diff --git a/flake/default.nix b/flake/default.nix
index f3bf346b..b54b5470 100644
--- a/flake/default.nix
+++ b/flake/default.nix
@@ -2,6 +2,7 @@
   # core
   self,
   pkgs,
+  myPkgs,
   system,
   sysLib,
   nixpkgs_as_input,
@@ -27,137 +28,40 @@
   yambar_memory,
   yambar_cpu,
 }: let
-  home_manager_config = import ../hm {
+  treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
+
+  nixosConfigurations = import ./nixosConfigurations {
     inherit
-      pkgs
-      sysLib
-      nixpkgs_open_prs
-      # extra information
-      
+      self
+      myPkgs
       system
-      # bins
+      nixpkgs_as_input
+      nixpkgs_open_prs
+      # my things
       
-      yambar_cpu
-      yambar_memory
-      river_init_lesser
       shell_library
-      # external deps
-      
-      user_js
+      sysLib
+      templates
       # modules
       
-      impermanence
+      home-manager
       nixVim
-      nix-index-database
-      ;
-  };
-  defaultModules = [
-    "${nixpkgs_open_prs.nixpkgs-tfc}/nixos/modules/config/xdg/portals/termfilechooser.nix"
-
-    agenix.nixosModules.default
-
-    disko.nixosModules.default
-
-    home-manager.nixosModules.home-manager
-    home_manager_config
-
-    impermanence.nixosModules.impermanence
-
-    lanzaboote.nixosModules.lanzaboote
-
-    serverphone.nixosModules.default
-  ];
-  defaultSpecialArgs = {
-    inherit
-      templates
-      sysLib
+      nixos-generators
+      impermanence
+      agenix
+      ragenix
       serverphone
-      system
-      # nix registry
-      
-      nixpkgs_as_input
-      self
-      # extra package sources
+      disko
+      lanzaboote
+      nix-index-database
+      # bins
       
-      nixpkgs_open_prs
-      ;
-  };
-  treefmtEval = treefmt-nix.lib.evalModule pkgs (
-    {pkgs, ...}: {
-      # Used to find the project root
-      projectRootFile = "flake.nix";
-
-      programs = {
-        alejandra.enable = true;
-        rustfmt.enable = true;
-        clang-format.enable = true;
-        mdformat.enable = true;
-        shfmt = {
-          enable = true;
-          indent_size = 4;
-        };
-        shellcheck.enable = true;
-        prettier = {
-          settings = {
-            arrowParens = "always";
-            bracketSameLine = false;
-            bracketSpacing = true;
-            editorconfig = true;
-            embeddedLanguageFormatting = "auto";
-            endOfLine = "lf";
-            # experimentalTernaries = false;
-            htmlWhitespaceSensitivity = "css";
-            insertPragma = false;
-            jsxSingleQuote = true;
-            printWidth = 80;
-            proseWrap = "always";
-            quoteProps = "consistent";
-            requirePragma = false;
-            semi = true;
-            singleAttributePerLine = true;
-            singleQuote = true;
-            trailingComma = "all";
-            useTabs = false;
-            vueIndentScriptAndStyle = false;
-
-            tabWidth = 4;
-            overrides = {
-              files = ["*.js"];
-              options.tabwidth = 2;
-            };
-          };
-        };
-        stylua.enable = true;
-        ruff = {
-          enable = true;
-          format = true;
-        };
-        taplo.enable = true;
-      };
-
-      settings = {
-        global.excludes = ["CHANGELOG.md"];
-        formatter = {
-          clang-format = {
-            options = ["--style" "GNU"];
-          };
-          shfmt = {
-            includes = ["*.bash"];
-          };
-        };
-      };
-    }
-  );
-
-  nixosConfigurations = import ./nixosConfigurations {
-    inherit
-      system
-      pkgs
-      nixpkgs_as_input
-      # configs
+      river_init_lesser
+      yambar_cpu
+      yambar_memory
+      # external
       
-      defaultModules
-      defaultSpecialArgs
+      user_js
       ;
   };
 in {
@@ -170,14 +74,13 @@ in {
     formatting = treefmtEval.config.build.check self;
   };
 
-  legacyPackages."${system}" = pkgs;
+  # legacyPackages."${system}" = pkgs;
 
   packages."${system}" = import ./packages {
     inherit
       nixos-generators
-      defaultSpecialArgs
-      defaultModules
       pkgs
+      myPkgs
       sysLib
       system
       nixVim
@@ -186,37 +89,38 @@ in {
       ;
     inherit (pkgs) lib;
   };
+
   formatter."${system}" = treefmtEval.config.build.wrapper;
 
   apps."${system}" = import ./apps {inherit self system;};
 
   devShells."${system}" = {
     default = pkgs.mkShell {
-      packages = with pkgs; [
+      packages = [
         # secure boot
-        sbctl
+        pkgs.sbctl
 
         # other
-        cocogitto
-        git-bug
+        pkgs.cocogitto
+        pkgs.git-bug
 
         # secrets
         ragenix.packages."${system}".default
 
         # shell
-        shfmt # TODO: Integrate this into nvim <2023-10-31>
+        pkgs.shfmt # TODO: Integrate this into nvim <2023-10-31>
 
         # rust
-        rustfmt
-        cargo
+        pkgs.rustfmt
+        pkgs.cargo
 
         # nix
-        alejandra
+        pkgs.alejandra
 
         # update
-        generate_firefox_extensions # needed for the firefox extension update script
-        lf-make-map # needed to generate the lf cd mappings
-        update-vim-plugins
+        myPkgs.generate_moz_extension # needed for the firefox extension update script
+        myPkgs.lf-make-map # needed to generate the lf cd mappings
+        myPkgs.update-vim-plugins
       ];
     };
   };
diff --git a/flake/treefmt.nix b/flake/treefmt.nix
new file mode 100644
index 00000000..1cbab409
--- /dev/null
+++ b/flake/treefmt.nix
@@ -0,0 +1,73 @@
+{
+  treefmt-nix,
+  pkgs,
+}:
+treefmt-nix.lib.evalModule pkgs (
+  {pkgs, ...}: {
+    # Used to find the project root
+    projectRootFile = "flake.nix";
+
+    programs = {
+      alejandra.enable = true;
+      rustfmt.enable = true;
+      clang-format.enable = true;
+      mdformat.enable = true;
+      shfmt = {
+        enable = true;
+        indent_size = 4;
+      };
+      shellcheck.enable = true;
+      prettier = {
+        settings = {
+          arrowParens = "always";
+          bracketSameLine = false;
+          bracketSpacing = true;
+          editorconfig = true;
+          embeddedLanguageFormatting = "auto";
+          endOfLine = "lf";
+          # experimentalTernaries = false;
+          htmlWhitespaceSensitivity = "css";
+          insertPragma = false;
+          jsxSingleQuote = true;
+          printWidth = 80;
+          proseWrap = "always";
+          quoteProps = "consistent";
+          requirePragma = false;
+          semi = true;
+          singleAttributePerLine = true;
+          singleQuote = true;
+          trailingComma = "all";
+          useTabs = false;
+          vueIndentScriptAndStyle = false;
+
+          tabWidth = 4;
+          overrides = {
+            files = ["*.js"];
+            options.tabwidth = 2;
+          };
+        };
+      };
+      stylua.enable = true;
+      ruff = {
+        enable = true;
+        format = true;
+      };
+      taplo.enable = true;
+    };
+
+    settings = {
+      global.excludes = [
+        "CHANGELOG.md"
+        "NEWS.md"
+      ];
+      formatter = {
+        clang-format = {
+          options = ["--style" "GNU"];
+        };
+        shfmt = {
+          includes = ["*.bash"];
+        };
+      };
+    };
+  }
+)