Update flake boilerplate

This commit is contained in:
♥ Minnie ♥ 2024-08-05 08:48:06 +08:00
parent bede9baa04
commit 815bc493ad
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
6 changed files with 18 additions and 35 deletions

View file

@ -581,11 +581,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1722630782, "lastModified": 1722421184,
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=", "narHash": "sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da", "rev": "9f918d616c5321ad374ae6cb5ea89c9e04bf3e58",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -34,27 +34,25 @@
outputs = { self, nixpkgs, home-manager, ... }@inputs: outputs = { self, nixpkgs, home-manager, ... }@inputs:
let let
inherit (self) outputs; inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [ # Supported systems for your flake packages, shell, etc.
systems = [
"aarch64-linux" "aarch64-linux"
"i686-linux" "i686-linux"
"x86_64-linux" "x86_64-linux"
"aarch64-darwin" "aarch64-darwin"
"x86_64-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 in
{ {
# Your custom packages # Your custom packages
# Acessible through 'nix build', 'nix shell', etc # Acessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
let pkgs = nixpkgs.legacyPackages.${system}; # Formatter for your nix files, available through 'nix fmt'
in import ./pkgs { inherit pkgs; } # Other options beside 'alejandra' include 'nixpkgs-fmt'
); formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
# 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; }
);
# Your custom packages and modifications, exported as overlays # Your custom packages and modifications, exported as overlays
overlays = import ./overlays { inherit inputs; }; overlays = import ./overlays { inherit inputs; };
@ -90,6 +88,8 @@
}; };
}; };
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { homeConfigurations = {
"sajenim@fuchsia" = home-manager.lib.homeManagerConfiguration { "sajenim@fuchsia" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;

View file

@ -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;
})

View file

@ -1,8 +1,9 @@
# This file defines overlays # This file defines overlays
{ inputs, ... }: { inputs, ... }:
{ {
# This one brings our custom packages from the 'pkgs' directory # 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 # This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really. # You can change versions, add patches, set compilation flags, anything really.

View file

@ -1,7 +1,7 @@
# Custom packages, that can be defined similarly to ones from nixpkgs # 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 { }; xmobar = pkgs.callPackage ./xmobar-config { };
xmonad = pkgs.callPackage ./xmonad-config { }; xmonad = pkgs.callPackage ./xmonad-config { };
amdgpu-clocks = pkgs.callPackage ./amdgpu-clocks { }; amdgpu-clocks = pkgs.callPackage ./amdgpu-clocks { };

View file

@ -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 ];
};
}