diff --git a/flake.lock b/flake.lock index f9973027..05f17d44 100644 --- a/flake.lock +++ b/flake.lock @@ -22,11 +22,11 @@ }, "devshell": { "locked": { - "lastModified": 1639577277, - "narHash": "sha256-oSLOHHpEZHXiMiMgEHpa8BZrCr9zq2jghkgeNz5QBFo=", + "lastModified": 1639692811, + "narHash": "sha256-wOOBH0fVsfNqw/5ZWRoKspyesoXBgiwEOUBH4c7JKEo=", "owner": "numtide", "repo": "devshell", - "rev": "651955eb153566d68ecb2953718b9c57ad77c8a6", + "rev": "d3a1f5bec3632b33346865b1c165bf2420bb2f52", "type": "github" }, "original": { @@ -88,11 +88,11 @@ ] }, "locked": { - "lastModified": 1639644962, - "narHash": "sha256-KapSYcM2r0PyQCAKg5J6rrXkXmw4cItR3jEckH/pAfo=", + "lastModified": 1639774225, + "narHash": "sha256-pdXvYneQVzB14fD+Q283s17tXRyQMs2JMx4mZ4JeSYg=", "owner": "nix-community", "repo": "home-manager", - "rev": "42ba7b630437ab04b9d97b0745194cd913481051", + "rev": "8b44e81978a2bef60c83ecc0199ab2523310214a", "type": "github" }, "original": { @@ -111,11 +111,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1639605401, - "narHash": "sha256-FtoFqT52SDX5S28shnn9xyXBw4i+vnjmUNnl0ghItkk=", + "lastModified": 1639795113, + "narHash": "sha256-pVBNbtpamfSOM3eBZWn/Xx9V9FwRaYw7WZ+yOUyz2UA=", "owner": "neovim", "repo": "neovim", - "rev": "326e74571be43823ded9fa805a3173bdabda6bec", + "rev": "818ae74eaf6f4538ca61ee4ba703543b0caaff10", "type": "github" }, "original": { @@ -132,11 +132,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1639642693, - "narHash": "sha256-ogdDa5MJAiK6f48BLaZ/qE9mgwwD72BZf/+bf5gdVvQ=", + "lastModified": 1639815237, + "narHash": "sha256-sSJdAQgF1F59BmlyRkXPlfZr2eic/AXcIAX+23p8V4M=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "7933df62bb350d2f4a258f9e110decc08baaf627", + "rev": "368cdc561097d7d6ff67ada5feff818bef86a4d4", "type": "github" }, "original": { @@ -163,11 +163,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1639566195, - "narHash": "sha256-ZnTBGSV6bTwopdDibmsBaAkedmTZC/rOgwQzOGcOD+s=", + "lastModified": 1639713555, + "narHash": "sha256-w1TacWjnqhC19n+rheyOif3JxwvWMbyxfgqYCY0FLdQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3c52ea8c9216a0d5b7a7b4d74a9d2e858b06df5c", + "rev": "45a3f9d7725c7e21b252c223676cc56fb2ed5d6d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 5b75d7d0..e56e6897 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,9 @@ inputs = { 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. home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; @@ -11,6 +14,9 @@ agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "nixpkgs"; + # Easy access to development environments. + devshell.url = "github:numtide/devshell"; + # Overlays. neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; }; @@ -25,21 +31,12 @@ inputs.neovim-nightly-overlay.overlay ]; - # All the target systems for my packages. - systems = [ - "x86_64-linux" - "i686-linux" - "aarch64-linux" - "armv6l-linux" - "armv7l-linux" - ]; - - forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); + forAllSystems = f: + nixpkgs.lib.genAttrs inputs.flake-utils.lib.defaultSystems + (system: f system); libExtended = nixpkgs.lib.extend (final: prev: - (import ./lib { - lib = final; - }) // { + (import ./lib { lib = final; }) // { flakeUtils = (import ./lib/flake-utils.nix { inherit inputs; lib = final; @@ -48,12 +45,16 @@ # The default configuration for our NixOS systems. hostDefaultConfig = { - # Registering several registries. - # I'm narcissistic so I want my config to be one of the flakes in the registry. - nix.registry.config.flake = self; + # 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. + config.flake = self; - # This will also prevent the annoying downloads since it always get the latest revision. - nix.registry.nixpkgs.flake = nixpkgs; + nixpkgs.flake = nixpkgs; + home-manager.flake = home-manager; + }; # Stallman-senpai will be disappointed. nixpkgs.config.allowUnfree = true; @@ -61,6 +62,9 @@ # Extend nixpkgs with our own package set. 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 # have to go with it. i18n.defaultLocale = "en_US.UTF-8"; @@ -68,8 +72,8 @@ # Sane config for the package manager. # TODO: Remove this after nix-command and flakes has been considered stable. # - # Since we're using flakes to make this possible, we need it. - # Plus, the UX of Nix CLI is becoming closer to Guix's which is a nice bonus. + # Since we're using flakes to make this possible, we need it. Plus, the + # UX of Nix CLI is becoming closer to Guix's which is a nice bonus. nix.extraOptions = '' experimental-features = nix-command flakes ''; @@ -79,7 +83,8 @@ userDefaultConfig = { 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; # Stallman-senpai will be disappointed. :( @@ -89,14 +94,15 @@ programs.home-manager.enable = true; }; 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 { inherit inputs; lib = nixpkgs.lib; }; - # A list of NixOS configurations from the `./hosts` folder. - # It also has some sensible default configurations. + # A list of NixOS configurations from the `./hosts` folder. It also has + # some sensible default configurations. nixosConfigurations = libExtended.mapAttrsRecursive (host: path: libExtended.flakeUtils.mkHost path hostDefaultConfig) (libExtended.filesToAttr ./hosts); @@ -116,16 +122,15 @@ homeManagerModules = libExtended.mapAttrsRecursive (_: path: import path) (libExtended.filesToAttr ./modules/home-manager); - # My custom packages, available in here as well. - # Though, I mainly support "x86_64-linux". - # I just want to try out supporting other systems. + # My custom packages, available in here as well. Though, I mainly support + # "x86_64-linux". I just want to try out supporting other systems. packages = forAllSystems (system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; }); # My several development shells for usual type of projects. This is much # more preferable than installing all of the packages at the system # configuration (or even home environment). - devShells = forAllSystems - (system: import ./shells { pkgs = import nixpkgs { inherit system; }; }); + devShells = forAllSystems (system: + import ./shells { pkgs = import nixpkgs { inherit system; }; }); }; }