diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-12-27 01:19:08 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-12-27 01:19:08 -0600 |
| commit | 61d433c8e7cc17d5b921329fca9baf7c3d528ade (patch) | |
| tree | 1766c3dd3a9ff0dd06618adfa285d10951ceea2a /flake.nix | |
| parent | 9d4a860360958a01490013b07c59083e9013cff4 (diff) | |
flake: rework flake inputs, overlays and platforms
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 72 |
1 files changed, 47 insertions, 25 deletions
@@ -1,7 +1,7 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; - nixpkgsUnstable.url = "github:nixos/nixpkgs"; + unstable.url = "github:nixos/nixpkgs"; home-manager = { url = "github:nix-community/home-manager/release-22.11"; @@ -14,47 +14,69 @@ }; outputs = - { self, nixpkgs, nixpkgsUnstable, home-manager - , nur, impermanence, hm-isolation, ... }: - with nixpkgs.lib; let + { self, nixpkgs, unstable, home-manager, nur, impermanence, hm-isolation, ... }: let + system = "x86_64-linux"; + + pkgs = pkgsNoLocal.extend self.overlays.default; + pkgsNoLocal = importPkgs nixpkgs; + + importPkgs = flake: import flake { + inherit system; + + config.android_sdk.accept_license = true; + overlays = [ nur.overlay ]; + }; + util = import ./util; - inherit (util nixpkgs.lib) importAll; + inherit (util pkgs.lib) importAll; - pkgSet = pkgs: import ./pkgs pkgs; - in { - packages."x86_64-linux" = pkgSet nixpkgs.legacyPackages."x86_64-linux"; + local = import ./pkgs; + in with pkgs.lib; { + packages.${system} = local pkgs pkgsNoLocal; - overlay = self: super: { - local = pkgSet super; - unstable = import nixpkgsUnstable { inherit (super) config system; }; + overlays.default = final: prev: { + local = local final prev; + unstable = (importPkgs unstable).extend self.overlays.default; }; nixosConfigurations = let - hostConfig = host: (makeOverridable nixosSystem) { - system = "x86_64-linux"; - modules = [ (import ./sys { inherit self impermanence; }) host ]; + hostConfig = host: (makeOverridable nixpkgs.lib.nixosSystem) { + inherit pkgs system; + + modules = [ + ./sys + host + nixpkgs.nixosModules.notDetected + impermanence.nixosModule + ]; }; in mapAttrs (_: hostConfig) (importAll { root = ./sys/platform; }); homeConfigurations = let - configuration = import ./home { - inherit self nixpkgs nixpkgsUnstable nur hm-isolation; + registry = { ... }: { + config.nix.registry = { + "nixpkgs".flake = nixpkgs; + "unstable".flake = unstable; + "nur".flake = nur; + }; }; - username = "ale"; - home = platform: home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { system = "x86_64-linux"; }; - modules = [ configuration platform ]; + 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}"; + platformHome = name: platform: let value = home platform; + in { + inherit value; + name = "${value.config.home.username}@${name}"; }; in mapAttrs' platformHome (importAll { root = ./home/platform; }); }; |
