diff --git a/flake.lock b/flake.lock index 58fe0d6..b4ff901 100644 --- a/flake.lock +++ b/flake.lock @@ -581,11 +581,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1722630782, - "narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=", + "lastModified": 1722421184, + "narHash": "sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d04953086551086b44b6f3c6b7eeb26294f207da", + "rev": "9f918d616c5321ad374ae6cb5ea89c9e04bf3e58", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 78ce785..884b758 100644 --- a/flake.nix +++ b/flake.nix @@ -34,27 +34,25 @@ outputs = { self, nixpkgs, home-manager, ... }@inputs: let inherit (self) outputs; - forAllSystems = nixpkgs.lib.genAttrs [ + # Supported systems for your flake packages, shell, etc. + systems = [ "aarch64-linux" "i686-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forAllSystems = nixpkgs.lib.genAttrs systems; in { # Your custom packages # Acessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in import ./pkgs { inherit pkgs; } - ); - # Devshell for bootstrapping - # Acessible through 'nix develop' or 'nix-shell' (legacy) - devShells = forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in import ./shell.nix { inherit pkgs; } - ); + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + # Formatter for your nix files, available through 'nix fmt' + # Other options beside 'alejandra' include 'nixpkgs-fmt' + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); # Your custom packages and modifications, exported as overlays overlays = import ./overlays { inherit inputs; }; @@ -90,6 +88,8 @@ }; }; + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { "sajenim@fuchsia" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; diff --git a/nixpkgs.nix b/nixpkgs.nix deleted file mode 100644 index 041de40..0000000 --- a/nixpkgs.nix +++ /dev/null @@ -1,8 +0,0 @@ -# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file -# This is useful to avoid using channels when using legacy nix commands -let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; -in -import (fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; - sha256 = lock.narHash; -}) diff --git a/overlays/default.nix b/overlays/default.nix index 9a03471..9466703 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,8 +1,9 @@ # This file defines overlays { inputs, ... }: + { # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs { pkgs = final; }; + additions = final: _prev: import ../pkgs final.pkgs; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. diff --git a/pkgs/default.nix b/pkgs/default.nix index 494d44a..58b5c32 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,7 +1,7 @@ # Custom packages, that can be defined similarly to ones from nixpkgs -# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' +# You can build them using 'nix build .#example' -{ pkgs ? (import ../nixpkgs.nix) { } }: { +pkgs: { xmobar = pkgs.callPackage ./xmobar-config { }; xmonad = pkgs.callPackage ./xmonad-config { }; amdgpu-clocks = pkgs.callPackage ./amdgpu-clocks { }; diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 9525915..0000000 --- a/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -# Shell for bootstrapping flake-enabled nix and home-manager -# You can enter it through 'nix develop' or (legacy) 'nix-shell' - -{ pkgs ? (import ./nixpkgs.nix) { } }: { - default = pkgs.mkShell { - # Enable experimental features without having to specify the argument - NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = with pkgs; [ nix home-manager git ]; - }; -}