diff --git a/flake.nix b/flake.nix index 1496c3b..6ec46ba 100644 --- a/flake.nix +++ b/flake.nix @@ -57,80 +57,113 @@ }; outputs = - inputs: - inputs.snowfall-lib.mkFlake { - inherit inputs; - # Must always be ./. - src = ./.; + { + self, + nixpkgs, + home-manager, + systems, + ... + }@inputs: + let + inherit (self) outputs; + lib = nixpkgs.lib // home-manager.lib; + forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system}); + pkgsFor = lib.genAttrs (import systems) ( + system: + import nixpkgs { + inherit system; + config.allowUnfree = true; + } + ); + in + { + inherit lib; + + nixosModules = import ./modules/nixos; + homeManagerModules = import ./modules/home-manager; + + overlays = import ./overlays { inherit inputs outputs; }; + # hydraJobs = import ./hydra.nix { inherit inputs outputs; }; + + packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; }); + devShells = forEachSystem (pkgs: import ./shell.nix { inherit pkgs; }); + formatter = forEachSystem (pkgs: pkgs.alejandra); + + nixosConfigurations = { + # Main laptop + aspi = lib.nixosSystem { + modules = [ ./hosts/aspi ]; + specialArgs = { + inherit inputs outputs; + }; + }; + # Piano raspberry pi + pianonix = lib.nixosSystem { + modules = [ ./hosts/pianonix ]; + specialArgs = { + inherit inputs outputs; + }; + }; + }; + + # Standalone HM + homeConfigurations = { + # Main laptop + "julian@aspi" = lib.homeManagerConfiguration { + modules = [ + ./home/julian/aspi.nix + ./home/julian/nixpkgs.nix + ]; + pkgs = pkgsFor.x86_64-linux; + extraSpecialArgs = { + inherit inputs outputs; + }; + }; + # Media server (RPi) + "julian@pianonix" = lib.homeManagerConfiguration { + modules = [ + ./home/julian/pianonix.nix + ./home/julian/nixpkgs.nix + ]; + pkgs = pkgsFor.aarch64-linux; + extraSpecialArgs = { + inherit inputs outputs; + }; + }; + }; # Add overlays for the `nixpkgs` channel. - overlays = with inputs; [ - nix-matlab.overlay - nix-topology.overlays.default - ]; + # overlays = with inputs; [ + # nix-matlab.overlay + # nix-topology.overlays.default + # ]; - snowfall = { - # The root of the snowfall config - root = ./.; - # lib, package and overlay namespace - namespace = "frajul"; # defaults to "internal" + # systems.modules.nixos = with inputs; [ + # sops-nix.nixosModules.sops + # disko.nixosModules.disko + # ]; + # systems.hosts.pianonix.modules = with inputs; [ nixos-hardware.nixosModules.raspberry-pi-4 ]; - meta = { - name = "Julian's dotfiles"; - title = "Julian's dotfiles"; - }; - }; - - # The attribute set specified here will be passed directly to NixPkgs when - # instantiating the package set. - channels-config = { - # Allow unfree packages. - allowUnfree = true; - nvidia.acceptLicense = true; - - # Allow certain insecure packages - permittedInsecurePackages = [ "olm-3.2.16" ]; - }; - - systems.modules.nixos = with inputs; [ - nix-topology.nixosModules.default - sops-nix.nixosModules.sops - disko.nixosModules.disko - ]; - systems.hosts.pianonix.modules = with inputs; [ nixos-hardware.nixosModules.raspberry-pi-4 ]; - - # topology = - # with inputs; - # let - # host = self.nixosConfigurations.${builtins.head (builtins.attrNames self.nixosConfigurations)}; - # in - # import nix-topology { - # inherit (host) pkgs; # Only this package set must include nix-topology.overlays.default - # modules = [ - # (import ./topology { inherit (host) config; }) - # { inherit (self) nixosConfigurations; } - # ]; - # }; - } - // { # deploy-rs node configuration - deploy.nodes.pianonix = { - hostname = "pianonix.local"; - profiles.system = { - sshUser = "root"; - user = "root"; - path = inputs.deploy-rs.lib.aarch64-linux.activate.nixos inputs.self.nixosConfigurations.pianonix; - confirmTimeout = 90; # default: 30s; raspberrypi takes a little longer restarting services + deploy.nodes = { + pianonix = { + hostname = "pianonix.local"; + profiles.system = { + sshUser = "root"; + user = "root"; + path = inputs.deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.pianonix; + confirmTimeout = 90; # default: 30s; raspberrypi takes a little longer restarting services + }; }; - }; - deploy.nodes.builder = { - hostname = "builder.julian-mutter.de"; - profiles.system = { - sshUser = "root"; - user = "root"; - path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos inputs.self.nixosConfigurations.builder; - remoteBuild = true; + builder = { + hostname = "builder.julian-mutter.de"; + profiles.system = { + sshUser = "root"; + user = "root"; + path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.builder; + remoteBuild = true; + }; }; }; }; diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..7f08181 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,16 @@ +{ + inputs, + outputs, +}: +{ + nixpkgs-stable-unstable = final: prev: { + unstable = import inputs.nixpkgs { + system = prev.system; + config.allowUnfree = true; + }; + stable = import inputs.nixpkgs-stable { + system = prev.system; + config.allowUnfree = true; + }; + }; +}