diff options
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 109 |
1 files changed, 65 insertions, 44 deletions
@@ -1,10 +1,10 @@ { inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05"; - nixpkgsUnstable.url = "github:nixos/nixpkgs"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + unstable.url = "github:nixos/nixpkgs"; home-manager = { - url = "github:nix-community/home-manager/release-22.05"; + url = "github:nix-community/home-manager/release-22.11"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -14,58 +14,79 @@ }; outputs = - { self, nixpkgs, nixpkgsUnstable, home-manager - , nur, impermanence, hm-isolation, ... }: - with nixpkgs.lib; let - util = import ./util; - inherit (util nixpkgs.lib) importAll; + { self, nixpkgs, unstable, home-manager, nur, impermanence, hm-isolation, ... }: + let + system = "x86_64-linux"; + + pkgs = pkgsNoLocal.extend self.overlays.default; + pkgsNoLocal = importPkgs nixpkgs; - pkgSet = pkgs: import ./pkgs pkgs; - in { - packages."x86_64-linux" = pkgSet nixpkgs.legacyPackages."x86_64-linux"; + importPkgs = flake: import flake { + inherit system; - overlay = self: super: { - local = pkgSet super; - unstable = import nixpkgsUnstable { inherit (super) config system; }; + config = import ./pkgs/config nixpkgs.lib; + overlays = [ nur.overlay ]; }; - nixosConfigurations = let - hostConfig = host: (makeOverridable nixosSystem) { - system = "x86_64-linux"; - modules = [ (import ./sys { inherit self impermanence; }) host ]; - }; - in mapAttrs (_: hostConfig) (importAll { root = ./sys/platform; }); + util = import ./util; + inherit (util pkgs.lib) importAll; - homeConfigurations = let - configuration = import ./home { - inherit self nixpkgs nixpkgsUnstable nur hm-isolation; - }; + local = import ./pkgs; + in + with pkgs.lib; { + formatter.${system} = pkgs.nixpkgs-fmt; + packages.${system} = local pkgs pkgsNoLocal; - username = "ale"; + overlays.default = final: prev: { + local = local final prev; + unstable = (importPkgs unstable).extend self.overlays.default; + }; - home = platform: home-manager.lib.homeManagerConfiguration { - system = "x86_64-linux"; + nixosConfigurations = + let + hostConfig = host: (makeOverridable nixpkgs.lib.nixosSystem) { + inherit pkgs system; - inherit configuration; - extraModules = [ platform ]; + modules = [ + ./sys + host + nixpkgs.nixosModules.notDetected + impermanence.nixosModule + ]; + }; + in + mapAttrs (_: hostConfig) (importAll { root = ./sys/platform; }); - inherit username; - homeDirectory = "/home/${username}"; + homeConfigurations = + let + registry = { ... }: { + config.nix.registry = { + "nixpkgs".flake = nixpkgs; + "unstable".flake = unstable; + "nur".flake = nur; + }; + }; - # Update the state version as needed. - # See the changelog here: - # https://nix-community.github.io/home-manager/release-notes.html#sec-release-21.05 - stateVersion = "21.11"; + home = platform: home-manager.lib.homeManagerConfiguration { + inherit pkgs; - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - extraSpecialArgs = {}; - }; + modules = [ + ./home + platform + registry + hm-isolation.homeManagerModule + ]; + }; - platformHome = name: platform: { - name = "${username}@${name}"; - value = home platform; - }; - in mapAttrs' platformHome (importAll { root = ./home/platform; }); + platformHome = name: platform: + let + value = home platform; + in + { + inherit value; + name = "${value.config.home.username}@${name}"; + }; + in + mapAttrs' platformHome (importAll { root = ./home/platform; }); }; } |
