Update flake config and inputs

This commit is contained in:
Gabriel Arazas 2021-12-18 17:41:45 +08:00
parent e956886da8
commit 3a431615c4
2 changed files with 49 additions and 44 deletions

30
flake.lock generated
View File

@ -22,11 +22,11 @@
}, },
"devshell": { "devshell": {
"locked": { "locked": {
"lastModified": 1639577277, "lastModified": 1639692811,
"narHash": "sha256-oSLOHHpEZHXiMiMgEHpa8BZrCr9zq2jghkgeNz5QBFo=", "narHash": "sha256-wOOBH0fVsfNqw/5ZWRoKspyesoXBgiwEOUBH4c7JKEo=",
"owner": "numtide", "owner": "numtide",
"repo": "devshell", "repo": "devshell",
"rev": "651955eb153566d68ecb2953718b9c57ad77c8a6", "rev": "d3a1f5bec3632b33346865b1c165bf2420bb2f52",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -88,11 +88,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1639644962, "lastModified": 1639774225,
"narHash": "sha256-KapSYcM2r0PyQCAKg5J6rrXkXmw4cItR3jEckH/pAfo=", "narHash": "sha256-pdXvYneQVzB14fD+Q283s17tXRyQMs2JMx4mZ4JeSYg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "42ba7b630437ab04b9d97b0745194cd913481051", "rev": "8b44e81978a2bef60c83ecc0199ab2523310214a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -111,11 +111,11 @@
}, },
"locked": { "locked": {
"dir": "contrib", "dir": "contrib",
"lastModified": 1639605401, "lastModified": 1639795113,
"narHash": "sha256-FtoFqT52SDX5S28shnn9xyXBw4i+vnjmUNnl0ghItkk=", "narHash": "sha256-pVBNbtpamfSOM3eBZWn/Xx9V9FwRaYw7WZ+yOUyz2UA=",
"owner": "neovim", "owner": "neovim",
"repo": "neovim", "repo": "neovim",
"rev": "326e74571be43823ded9fa805a3173bdabda6bec", "rev": "818ae74eaf6f4538ca61ee4ba703543b0caaff10",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -132,11 +132,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1639642693, "lastModified": 1639815237,
"narHash": "sha256-ogdDa5MJAiK6f48BLaZ/qE9mgwwD72BZf/+bf5gdVvQ=", "narHash": "sha256-sSJdAQgF1F59BmlyRkXPlfZr2eic/AXcIAX+23p8V4M=",
"owner": "nix-community", "owner": "nix-community",
"repo": "neovim-nightly-overlay", "repo": "neovim-nightly-overlay",
"rev": "7933df62bb350d2f4a258f9e110decc08baaf627", "rev": "368cdc561097d7d6ff67ada5feff818bef86a4d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -163,11 +163,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1639566195, "lastModified": 1639713555,
"narHash": "sha256-ZnTBGSV6bTwopdDibmsBaAkedmTZC/rOgwQzOGcOD+s=", "narHash": "sha256-w1TacWjnqhC19n+rheyOif3JxwvWMbyxfgqYCY0FLdQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3c52ea8c9216a0d5b7a7b4d74a9d2e858b06df5c", "rev": "45a3f9d7725c7e21b252c223676cc56fb2ed5d6d",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -3,6 +3,9 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# We're using this library for other functions, mainly testing.
flake-utils.url = "github:numtide/flake-utils";
# Managing home configurations. # Managing home configurations.
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
@ -11,6 +14,9 @@
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs"; agenix.inputs.nixpkgs.follows = "nixpkgs";
# Easy access to development environments.
devshell.url = "github:numtide/devshell";
# Overlays. # Overlays.
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
}; };
@ -25,21 +31,12 @@
inputs.neovim-nightly-overlay.overlay inputs.neovim-nightly-overlay.overlay
]; ];
# All the target systems for my packages. forAllSystems = f:
systems = [ nixpkgs.lib.genAttrs inputs.flake-utils.lib.defaultSystems
"x86_64-linux" (system: f system);
"i686-linux"
"aarch64-linux"
"armv6l-linux"
"armv7l-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
libExtended = nixpkgs.lib.extend (final: prev: libExtended = nixpkgs.lib.extend (final: prev:
(import ./lib { (import ./lib { lib = final; }) // {
lib = final;
}) // {
flakeUtils = (import ./lib/flake-utils.nix { flakeUtils = (import ./lib/flake-utils.nix {
inherit inputs; inherit inputs;
lib = final; lib = final;
@ -48,12 +45,16 @@
# The default configuration for our NixOS systems. # The default configuration for our NixOS systems.
hostDefaultConfig = { hostDefaultConfig = {
# Registering several registries. # I want to capture the usual flakes to its exact version so we're
# making them available to our system. This will also prevent the
# annoying downloads since it always get the latest revision.
nix.registry = {
# I'm narcissistic so I want my config to be one of the flakes in the registry. # I'm narcissistic so I want my config to be one of the flakes in the registry.
nix.registry.config.flake = self; config.flake = self;
# This will also prevent the annoying downloads since it always get the latest revision. nixpkgs.flake = nixpkgs;
nix.registry.nixpkgs.flake = nixpkgs; home-manager.flake = home-manager;
};
# Stallman-senpai will be disappointed. # Stallman-senpai will be disappointed.
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@ -61,6 +62,9 @@
# Extend nixpkgs with our own package set. # Extend nixpkgs with our own package set.
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
# Please clean your temporary crap.
boot.cleanTmpDir = true;
# We live in a Unicode world and dominantly English in technical fields so we'll # We live in a Unicode world and dominantly English in technical fields so we'll
# have to go with it. # have to go with it.
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
@ -68,8 +72,8 @@
# Sane config for the package manager. # Sane config for the package manager.
# TODO: Remove this after nix-command and flakes has been considered stable. # TODO: Remove this after nix-command and flakes has been considered stable.
# #
# Since we're using flakes to make this possible, we need it. # Since we're using flakes to make this possible, we need it. Plus, the
# Plus, the UX of Nix CLI is becoming closer to Guix's which is a nice bonus. # UX of Nix CLI is becoming closer to Guix's which is a nice bonus.
nix.extraOptions = '' nix.extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
@ -79,7 +83,8 @@
userDefaultConfig = { userDefaultConfig = {
system = "x86_64-linux"; system = "x86_64-linux";
# To be able to use the most of our config as possible, we want both to use the same overlays. # To be able to use the most of our config as possible, we want both to
# use the same overlays.
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
# Stallman-senpai will be disappointed. :( # Stallman-senpai will be disappointed. :(
@ -89,14 +94,15 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
}; };
in { in {
# Exposes only my library with the custom functions to make it easier to include in other flakes. # Exposes only my library with the custom functions to make it easier to
# include in other flakes.
lib = import ./lib { lib = import ./lib {
inherit inputs; inherit inputs;
lib = nixpkgs.lib; lib = nixpkgs.lib;
}; };
# A list of NixOS configurations from the `./hosts` folder. # A list of NixOS configurations from the `./hosts` folder. It also has
# It also has some sensible default configurations. # some sensible default configurations.
nixosConfigurations = libExtended.mapAttrsRecursive nixosConfigurations = libExtended.mapAttrsRecursive
(host: path: libExtended.flakeUtils.mkHost path hostDefaultConfig) (host: path: libExtended.flakeUtils.mkHost path hostDefaultConfig)
(libExtended.filesToAttr ./hosts); (libExtended.filesToAttr ./hosts);
@ -116,16 +122,15 @@
homeManagerModules = libExtended.mapAttrsRecursive (_: path: import path) homeManagerModules = libExtended.mapAttrsRecursive (_: path: import path)
(libExtended.filesToAttr ./modules/home-manager); (libExtended.filesToAttr ./modules/home-manager);
# My custom packages, available in here as well. # My custom packages, available in here as well. Though, I mainly support
# Though, I mainly support "x86_64-linux". # "x86_64-linux". I just want to try out supporting other systems.
# I just want to try out supporting other systems.
packages = forAllSystems packages = forAllSystems
(system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; }); (system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; });
# 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 devShells = forAllSystems (system:
(system: import ./shells { pkgs = import nixpkgs { inherit system; }; }); import ./shells { pkgs = import nixpkgs { inherit system; }; });
}; };
} }