flake.nix: update various things

- Update the attribute names with the latest stable release.
- Explicitly support only 'x86_64-linux' for now.
- Format the file with nixfmt.
- Update the project-local Nix settings.
This commit is contained in:
Gabriel Arazas 2022-03-28 08:15:40 +08:00
parent 27c71b8bd9
commit 4de5e1505b

View File

@ -2,9 +2,11 @@
description = "foo-dogsquared's NixOS config as a flake"; description = "foo-dogsquared's NixOS config as a flake";
nixConfig = { nixConfig = {
extra-experimental-features = "nix-command flake"; extra-experimental-features = "nix-command flakes";
extra-substituters ="https://nix-community.cachix.org https://foo-dogsquared.cachix.org"; extra-substituters =
extra-trusted-public-keys = "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="; "https://nix-community.cachix.org https://foo-dogsquared.cachix.org";
extra-trusted-public-keys =
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E=";
}; };
inputs = { inputs = {
@ -75,9 +77,9 @@
inputs.nur.overlay inputs.nur.overlay
]; ];
forAllSystems = f: systems = with inputs.flake-utils.lib.system; [ x86_64-linux ];
nixpkgs.lib.genAttrs inputs.flake-utils.lib.defaultSystems
(system: f system); forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
libExtended = nixpkgs.lib.extend (final: prev: libExtended = nixpkgs.lib.extend (final: prev:
(import ./lib { lib = prev; }) // { (import ./lib { lib = prev; }) // {
@ -88,16 +90,14 @@
}); });
# The default configuration for our NixOS systems. # The default configuration for our NixOS systems.
hostDefaultConfig = let hostDefaultConfig = let system = "x86_64-linux";
system = "x86_64-linux";
in { in {
inherit system; inherit system;
# Pass these things to our modules. # Pass these things to our modules.
specialArgs = { specialArgs = {
inherit system inputs self; inherit system inputs self;
lib = nixpkgs.lib.extend (final: prev: lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = prev; });
import ./lib { lib = prev; });
}; };
# The default configuration for a NixOS system STARTS HERE. # The default configuration for a NixOS system STARTS HERE.
@ -160,15 +160,13 @@
}; };
# The default config for our home-manager configurations. # The default config for our home-manager configurations.
userDefaultConfig = let userDefaultConfig = let system = "x86_64-linux";
system = "x86_64-linux";
in { in {
inherit system; inherit system;
specialArgs = { specialArgs = {
inherit system self; inherit system self;
lib = nixpkgs.lib.extend (final: prev: lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = prev; });
import ./lib { lib = prev; });
}; };
extraModules = [{ extraModules = [{
@ -206,7 +204,7 @@
(libExtended.filesToAttr ./modules/nixos); (libExtended.filesToAttr ./modules/nixos);
# I can now install home-manager users in non-NixOS systems. # I can now install home-manager users in non-NixOS systems.
# NICE? (TODO: Please test it in the future before saying these things.) # NICE!
homeManagerConfigurations = libExtended.mapAttrs homeManagerConfigurations = libExtended.mapAttrs
(_: path: libExtended.flakeUtils.mkUser path userDefaultConfig) (_: path: libExtended.flakeUtils.mkUser path userDefaultConfig)
(libExtended.filesToAttr ./users/home-manager); (libExtended.filesToAttr ./users/home-manager);
@ -222,25 +220,18 @@
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
})); }));
# The development environment for this flake.
devShell = forAllSystems (system:
import ./shell.nix {
pkgs = import nixpkgs { inherit system overlays; };
});
# My several development shells for usual type of projects. This is much # My several development shells for usual type of projects. This is much
# more preferable than installing all of the packages at the system # more preferable than installing all of the packages at the system
# configuration (or even home environment). # configuration (or even home environment).
devShells = forAllSystems (system: devShells = forAllSystems (system:
import ./shells { let pkgs = import nixpkgs { inherit system overlays; };
pkgs = import nixpkgs { inherit system overlays; }; in {
}); default = import ./shell.nix { inherit pkgs; };
} // (import ./shells { inherit pkgs; }));
# It is my go-to so it is the default template.
defaultTemplate = self.templates.basic-devshell;
# Cookiecutter templates for your mama. # Cookiecutter templates for your mama.
templates = { templates = {
default = self.templates.basic-devshell;
basic-devshell = { basic-devshell = {
path = ./templates/basic-devshell; path = ./templates/basic-devshell;
description = "Basic development shell template"; description = "Basic development shell template";