about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-08-09 13:06:55 +0300
committerAzat Bahawi <azat@bahawi.net>2024-08-09 13:06:55 +0300
commitc76e81a086aa66394b37d3bf36592328da09a298 (patch)
tree5438638de13f8873a8601ef46a7f0dd5bd6299e1 /modules
parent2024-08-05 (diff)
2024-08-09
Diffstat (limited to 'modules')
-rw-r--r--modules/common/nix.nix147
-rw-r--r--modules/firefox/default.nix6
2 files changed, 77 insertions, 76 deletions
diff --git a/modules/common/nix.nix b/modules/common/nix.nix
index 01b3f01..efd06bd 100644
--- a/modules/common/nix.nix
+++ b/modules/common/nix.nix
@@ -22,93 +22,98 @@ in
     default = [ ];
   };
 
-  config =
-    let
+  config = {
+    _module.args = {
       pkgsLocal = packages.useNixpkgs "${config.my.home}/src/nixpkgs"; # Impure!
-    in
-    {
-      _module.args = {
-        inherit pkgsLocal;
-      };
-
-      hm = {
-        # Used primarily in conjunction with the "nixfiles" script.
-        home.file.".nix-defexpr/default.nix".text =
-          let
-            hostname = strings.escapeNixIdentifier this.hostname;
-          in
-          optionalString this.isHeadful ''
-            let
-              self = builtins.getFlake "nixfiles";
-              configurations = self.nixosConfigurations;
-              local = configurations.${hostname};
-            in rec {
-              inherit self;
-              inherit (self) inputs lib;
-              inherit (lib) my;
-              this = my.configurations.${hostname};
-              inherit (local) config;
-              inherit (local.config.system.build) toplevel vm vmWithBootLoader manual;
-              pretty = expr: lib.trace (lib.generators.toPretty {} expr) {};
-            } // configurations // local._module.args
-          '';
-
-        programs.bash.shellAliases.nix = "nix --verbose --print-build-logs";
-      };
+    };
 
-      nix =
+    hm = {
+      # Used primarily in conjunction with the "nixfiles" script.
+      home.file.".nix-defexpr/default.nix".text =
         let
-          notSelfInputs = filterAttrs (n: _: n != "self") inputs;
+          hostname = strings.escapeNixIdentifier this.hostname;
         in
-        {
-          nixPath = mapAttrsToList (n: v: "${n}=${v}") notSelfInputs ++ [
-            "nixfiles=${config.my.home}/src/nixfiles"
-          ];
+        optionalString this.isHeadful ''
+          let
+            self = builtins.getFlake "nixfiles";
+            configurations = self.nixosConfigurations;
+            local = configurations.${hostname};
+          in rec {
+            inherit self;
+            inherit (self) inputs lib;
+            inherit (lib) my;
+            this = my.configurations.${hostname};
+            inherit (local) config;
+            inherit (local.config.system.build) toplevel vm vmWithBootLoader manual;
+            pretty = expr: lib.trace (lib.generators.toPretty {} expr) {};
+          } // configurations // local._module.args
+        '';
 
-          registry = mapAttrs (_: flake: { inherit flake; }) notSelfInputs // {
-            nixfiles.flake = inputs.self;
-          };
+      programs.bash.shellAliases.nix = "nix --verbose --print-build-logs";
+    };
 
-          settings = {
-            warn-dirty = false;
+    nix =
+      let
+        notSelfInputs = filterAttrs (n: _: n != "self") inputs;
+      in
+      {
+        nixPath = mapAttrsToList (n: v: "${n}=${v}") notSelfInputs ++ [
+          "nixfiles=${config.my.home}/src/nixfiles"
+        ];
 
-            keep-going = true;
+        registry = mapAttrs (_: flake: { inherit flake; }) notSelfInputs // {
+          nixfiles.flake = inputs.self;
+        };
 
-            substituters = [
-              "https://azahi.cachix.org"
-              "https://nix-community.cachix.org"
-            ];
+        settings = {
+          warn-dirty = false;
 
-            trusted-substituters = [ "https://azahi.cachix.org" ];
-            trusted-public-keys = [ "azahi.cachix.org-1:2bayb+iWYMAVw3ZdEpVg+NPOHCXncw7WMQ0ElX1GO3s=" ];
+          keep-going = true;
 
-            trusted-users = [
-              "root"
-              my.username
-            ];
-          };
-        };
+          substituters = [
+            "https://azahi.cachix.org"
+            "https://nix-community.cachix.org"
+          ];
 
-      nixpkgs = {
-        config.allowUnfreePredicate = p: elem (getName p) cfg.allowedUnfreePackages;
+          trusted-substituters = [ "https://azahi.cachix.org" ];
+          trusted-public-keys = [ "azahi.cachix.org-1:2bayb+iWYMAVw3ZdEpVg+NPOHCXncw7WMQ0ElX1GO3s=" ];
 
-        overlays = [ inputs.self.overlays.default ];
-      };
+          trusted-users = [
+            "root"
+            my.username
+          ];
 
-      environment = {
-        defaultPackages = [ ];
-        systemPackages =
-          with pkgs;
-          optionals this.isHeadful [
-            nix-tree
-            nixfiles
+          experimental-features = mkForce [
+            "auto-allocate-uids"
+            "cgroups"
+            "fetch-closure"
+            "flakes"
+            "nix-command"
+            "recursive-nix"
           ];
-        variables = {
-          NIXFILES = optionalString this.isHeadful "${config.my.home}/src/nixfiles";
-          NIX_SHELL_PRESERVE_PROMPT = "1";
         };
       };
 
-      system.stateVersion = this.stateVersion or trivial.release;
+    nixpkgs = {
+      config.allowUnfreePredicate = p: elem (getName p) cfg.allowedUnfreePackages;
+
+      overlays = [ inputs.self.overlays.default ];
     };
+
+    environment = {
+      defaultPackages = [ ];
+      systemPackages =
+        with pkgs;
+        optionals this.isHeadful [
+          nix-tree
+          nixfiles
+        ];
+      variables = {
+        NIXFILES = optionalString this.isHeadful "${config.my.home}/src/nixfiles";
+        NIX_SHELL_PRESERVE_PROMPT = "1";
+      };
+    };
+
+    system.stateVersion = this.stateVersion or trivial.release;
+  };
 }
diff --git a/modules/firefox/default.nix b/modules/firefox/default.nix
index d51bd66..7b69da4 100644
--- a/modules/firefox/default.nix
+++ b/modules/firefox/default.nix
@@ -141,11 +141,7 @@ in
               force = true;
 
               default = "DuckDuckGo";
-              order = [
-                "DuckDuckGo"
-                "Yandex"
-                "Google"
-              ];
+              order = [ "DuckDuckGo" ];
 
               engines =
                 let

Consider giving Nix/NixOS a try! <3