diff options
author | Linnnus <[email protected]> | 2023-10-01 18:56:59 +0200 |
---|---|---|
committer | Linnnus <[email protected]> | 2023-10-01 18:56:59 +0200 |
commit | 280aa48893458f0ae980c87fed5e733373ccec9d (patch) | |
tree | 0f89bf52e846124db5c3b72430a5c2b98e49c312 | |
parent | 7451c6a93b42ad1ae4a1a95664c2d8a6bdb11f72 (diff) |
Export pkgs and overlays
-rw-r--r-- | flake.nix | 17 | ||||
-rw-r--r-- | home/default.nix | 4 | ||||
-rw-r--r-- | hosts/common.nix | 6 | ||||
-rw-r--r-- | overlays/compat.nix (renamed from pkgs/overlays.nix) | 8 | ||||
-rw-r--r-- | overlays/default.nix | 22 | ||||
-rw-r--r-- | pkgs/default.nix | 14 |
6 files changed, 51 insertions, 20 deletions
@@ -25,8 +25,21 @@ let args = { flakeInputs = inputs; + flakeOutputs = self.outputs; metadata = nixpkgs.lib.importTOML ./metadata.toml; }; + + # This is a function that generates an attribute by calling a function + # you pass to it, with each system as an argument. `systems` lists all + # supported systems. + systems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; in { darwinConfigurations = { @@ -61,5 +74,9 @@ ]; }; }; + + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + + overlays = import ./overlays; }; } diff --git a/home/default.nix b/home/default.nix index 6e87b53..3687c53 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,4 +1,4 @@ -{ flakeInputs, metadata, ... }: +{ flakeInputs, flakeOutputs, metadata, ... }: { # Use the flake input pkgs so Home Manager configuration can share overlays @@ -7,7 +7,7 @@ # Pass special arguments from flake.nix further down the chain. I really hate # this split module system. - home-manager.extraSpecialArgs = { inherit flakeInputs metadata; }; + home-manager.extraSpecialArgs = { inherit flakeInputs flakeOutputs metadata; }; # OKAY FUCK THIS SHIT. THERE IS ONE USER. IT IS ME. LINUS. I WILL ADD # MULTIUSER SUPPORT IF IT EVER BECOMES A REQUIREMENT. diff --git a/hosts/common.nix b/hosts/common.nix index 5a9bc52..eefc667 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -1,6 +1,6 @@ # Shared configuraion regardless of hosts. -{ pkgs, options, flakeInputs, ... }: +{ pkgs, options, flakeInputs, flakeOutputs, ... }: { # Enable de facto stable features. @@ -10,8 +10,8 @@ # system-wide. # # See: https://nixos.wiki/wiki/Overlays#Using_nixpkgs.overlays_from_configuration.nix_as_.3Cnixpkgs-overlays.3E_in_your_NIX_PATH - nixpkgs.overlays = (import ../pkgs/overlays.nix); - nix.nixPath = options.nix.nixPath.default ++ [ "nixpkgs-overlays=${flakeInputs.self}/pkgs/overlays.nix" ]; + nixpkgs.overlays = [ flakeOutputs.overlays.additions flakeOutputs.overlays.modifications ]; + nix.nixPath = options.nix.nixPath.default ++ [ "nixpkgs-overlays=${flakeInputs.self}/overlays/compat.nix" ]; # Set ZSH as the shell. # https://nixos.wiki/wiki/Command_Shell#Changing_default_shelltrue diff --git a/pkgs/overlays.nix b/overlays/compat.nix index cbe2222..8874b52 100644 --- a/pkgs/overlays.nix +++ b/overlays/compat.nix @@ -4,4 +4,10 @@ # See: hosts/common.nix # See: https://nixos.org/manual/nixpkgs/stable/#sec-overlays-lookup -[ (self: super: (import ./default.nix) super) ] +let + overlays = import ./default.nix; +in +[ + overlays.additions + overlays.modifications +] diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..81a163a --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,22 @@ +# This module lists the different overlays. These are exported in `flake.nix`. + +{ + # This overlay adds all of our custom packages. + additions = final: _prev: import ../pkgs final; + + # This overlay does typical overlay stuff such as adding patches, bumping versions, etc. + modifications = final: prev: { + # Use patched version from Karl. + smu = prev.smu.overrideAttrs (old: { + version = "2022-08-01"; + src = final.fetchFromGitHub { + owner = "karlb"; + repo = "smu"; + rev = "bd03c5944b7146d07a88b58a2dd0d264836e3322"; + hash = "sha256-Jx7lJ9UTHAOCgPxF2p7ZoZBZ476bLXN5dI0vspusmGo="; + }; + env.NIX_CFLAGS_COMPILE = (old.env.NIX_CFLAGS_COMPILE or "") + + (final.lib.strings.optionalString (final.stdenv.cc.isGNU or false) " -Wno-maybe-uninitialized"); + }); + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index c47bb24..c4aced8 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -8,18 +8,4 @@ pkgs: still-awake = pkgs.callPackage ./still-awake { }; trash = pkgs.callPackage ./trash { }; - - # Use patched version from Karl. - smu = pkgs.smu.overrideAttrs (old: { - version = "2022-08-01"; - src = pkgs.fetchFromGitHub { - owner = "karlb"; - repo = "smu"; - rev = "bd03c5944b7146d07a88b58a2dd0d264836e3322"; - hash = "sha256-Jx7lJ9UTHAOCgPxF2p7ZoZBZ476bLXN5dI0vspusmGo="; - }; - #hardeningDisable = [ "fortify" ]; - env.NIX_CFLAGS_COMPILE = (old.env.NIX_CFLAGS_COMPILE or "") + - (pkgs.lib.strings.optionalString (pkgs.stdenv.cc.isGNU or false) " -Wno-maybe-uninitialized"); - }); } |