From 19a01e278e232f965b26dc31157da44c5165ffea Mon Sep 17 00:00:00 2001 From: James Walker Date: Thu, 27 Jul 2023 15:51:15 -0400 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20config=20refactor=20cleanu?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.nix | 23 ++++++++++++----------- hosts/aristotle/configuration.nix | 2 -- hosts/plato/configuration.nix | 5 +---- hosts/socrates/configuration.nix | 2 -- nix/checks.nix | 5 ++--- nix/darwin.nix | 2 +- nix/nixos.nix | 3 ++- nix/shells.nix | 11 ++++------- 8 files changed, 22 insertions(+), 31 deletions(-) diff --git a/flake.nix b/flake.nix index fb6346d..97f595b 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # My stuff dotfiles = { url = "github:walkah/dotfiles"; @@ -55,16 +54,18 @@ outputs = { self, nixpkgs, flake-utils, deploy-rs, pre-commit-hooks, workon, ... }@inputs: flake-utils.lib.eachDefaultSystem - (system: { - pkgs = import nixpkgs { - inherit system; - overlays = [ self.overlays.default ]; - config.allowUnfree = true; - }; - checks = import ./nix/checks.nix { inherit self system pre-commit-hooks; }; - devShells = import ./nix/shells.nix { inherit self system; }; - formatter = self.pkgs.nixpkgs-fmt; - }) + (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlays.default ]; + }; + in + { + checks = import ./nix/checks.nix { inherit self pkgs system pre-commit-hooks; }; + devShells = import ./nix/shells.nix { inherit self pkgs system; }; + formatter = pkgs.nixpkgs-fmt; + }) // { hosts = import ./nix/hosts.nix; overlays.default = nixpkgs.lib.composeManyExtensions [ diff --git a/hosts/aristotle/configuration.nix b/hosts/aristotle/configuration.nix index c24c274..409bbe9 100644 --- a/hosts/aristotle/configuration.nix +++ b/hosts/aristotle/configuration.nix @@ -11,8 +11,6 @@ ../../modules/sops ]; - nixpkgs.overlays = [ (import ../../overlays) ]; - # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) boot.loader.grub.enable = false; # Enables the generation of /boot/extlinux/extlinux.conf diff --git a/hosts/plato/configuration.nix b/hosts/plato/configuration.nix index c9dbb16..08c1bda 100644 --- a/hosts/plato/configuration.nix +++ b/hosts/plato/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: { +{ pkgs, ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -23,9 +23,6 @@ boot.tmp.cleanOnBoot = true; boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - nixpkgs.config.allowUnfree = true; - nixpkgs.overlays = [ (import ../../overlays) ]; - nix.extraOptions = '' experimental-features = nix-command flakes ''; diff --git a/hosts/socrates/configuration.nix b/hosts/socrates/configuration.nix index cac903f..29cbbe7 100644 --- a/hosts/socrates/configuration.nix +++ b/hosts/socrates/configuration.nix @@ -18,8 +18,6 @@ ../../modules/sops ]; - nixpkgs.overlays = [ (import ../../overlays) ]; - boot.tmp.cleanOnBoot = true; # Set your time zone. diff --git a/nix/checks.nix b/nix/checks.nix index 8cc714d..9bafeed 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -1,5 +1,4 @@ -{ self, system, pre-commit-hooks, ... }: -with self.pkgs.${system}; +{ self, pkgs, system, pre-commit-hooks, ... }: { pre-commit-check = pre-commit-hooks.lib.${system}.run { src = ./.; @@ -9,4 +8,4 @@ with self.pkgs.${system}; statix.enable = true; }; }; -} // (deploy-rs.lib.deployChecks self.deploy) +} // (pkgs.deploy-rs.lib.deployChecks self.deploy) diff --git a/nix/darwin.nix b/nix/darwin.nix index 9bb5747..845a792 100644 --- a/nix/darwin.nix +++ b/nix/darwin.nix @@ -10,7 +10,7 @@ let home-manager.darwinModules.home-manager (_: { networking.hostName = hostName; - nixpkgs.pkgs = self.pkgs.${hostSystem}; + nixpkgs.overlays = [ self.overlays.default ]; }) ] ++ modules; specialArgs = { inherit dotfiles home-manager; }; diff --git a/nix/nixos.nix b/nix/nixos.nix index d04d60c..304d480 100644 --- a/nix/nixos.nix +++ b/nix/nixos.nix @@ -10,7 +10,8 @@ let home-manager.nixosModules.home-manager (_: { networking.hostName = hostName; - nixpkgs.pkgs = self.pkgs.${hostSystem}; + nixpkgs.overlays = [ self.overlays.default ]; + nixpkgs.config.allowUnfree = true; }) ] ++ modules; specialArgs = { inherit dotfiles nixos-hardware sops-nix; }; diff --git a/nix/shells.nix b/nix/shells.nix index 207513f..554a74f 100644 --- a/nix/shells.nix +++ b/nix/shells.nix @@ -1,16 +1,13 @@ -{ system, self, ... }: - -with self.pkgs.${system}; - +{ system, pkgs, self, ... }: let - darwin-local = writeScriptBin "darwin-local" '' - #!${stdenv.shell} + darwin-local = pkgs.writeScriptBin "darwin-local" '' + #!${pkgs.stdenv.shell} nix build .#darwinConfigurations.$(hostname -s).system ./result/sw/bin/darwin-rebuild switch --flake . ''; in { - default = mkShell { + default = pkgs.mkShell { name = "athens"; buildInputs = with pkgs; [ darwin-local