config/flake.nix

71 lines
3.0 KiB
Nix

{
description = "pbsds' system/home flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11-small";
inputs.unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
inputs.nur.url = "github:nix-community/NUR";
inputs.home-manager.url = "github:nix-community/home-manager"; #/release-22.11";
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware";
#TODO:
#sops-nix.url = "github:Mic92/sops-nix";
#sops-nix.inputs.nixpkgs.follows = "nixpkgs";
#matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix
# temp
inputs.pr-polaris14.url = "github:pbsds/nixpkgs/polaris-14";
outputs = { self, nixpkgs, unstable, nixos-hardware, nur, home-manager, ... }@inputs:
let
systems = [
"x86_64-linux"
"aarch64-linux"
#"riscv64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
tmpConfig = {
disabledModules = [ "services/misc/polaris.nix" ];
imports = [ "${inputs.pr-polaris14}/nixos/modules/services/misc/polaris.nix" ];
nixpkgs.overlays = [(final: prev: { # TODO: nixpkgs.config.packageOverrides ?
polaris = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris" { };
polaris-web = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris/web.nix" { };
})];
};
mkConfig = hostname: system: modules: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; };
modules = modules ++ [ ./base.nix "${self}/hosts/${hostname}" tmpConfig ({
networking.hostName = hostname;
networking.domain = "pbsds.net";
networking.search = [ "pbsds.net" ];
nixpkgs.overlays = [ # TODO: consider nixpkgs.config.packageOverrides
#(final: prev: self.packages.${system})
(final: prev: {
unstable = unstable.legacyPackages.${final.system};
#unstable = import unstable { inherit system; };
nur = import nur { inherit (prev) pkgs; nurpkgs = prev.pkgs; };
#nur = import nur { inherit (prev) pkgs; nurpkgs = import nixpkgs { inherit final.system: }; }; # TODO: nurpkgs?
})
];
# This makes commandline tools like 'nix run nixpkgs#hello'
# and 'nix-shell -p hello' use the same channel as system was built with
nix.registry.nixpkgs.flake = inputs.nixpkgs;
nix.registry.unstable.flake = inputs.unstable;
nix.nixPath = [
"nixpkgs=${inputs.nixpkgs}"
"unstable=${inputs.unstable}" # TODO: needed?
];
})];
};
in {
nixosConfigurations.noximilien = mkConfig "noximilien" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel ]);
homeConfigurations = forAllSystems (system: {
pbsds = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [ ./users/pbsds/home ];
};
});
};
}