2023-02-25 04:39:30 +01:00
|
|
|
{
|
2023-02-26 02:46:35 +01:00
|
|
|
description = "pbsds' system/home flake";
|
2023-02-25 04:39:30 +01:00
|
|
|
|
2023-03-09 19:37:59 +01:00
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
|
|
|
inputs.unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2023-02-26 02:46:35 +01:00
|
|
|
inputs.nur.url = "github:nix-community/NUR";
|
2023-02-26 06:11:55 +01:00
|
|
|
inputs.home-manager.url = "github:nix-community/home-manager"; #/release-22.11";
|
2023-02-25 04:39:30 +01:00
|
|
|
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
2023-02-26 02:46:35 +01:00
|
|
|
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware";
|
2023-02-25 04:39:30 +01:00
|
|
|
|
2023-02-26 02:46:35 +01:00
|
|
|
#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
|
2023-02-25 04:39:30 +01:00
|
|
|
|
2023-03-09 21:13:18 +01:00
|
|
|
inputs.pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git";
|
|
|
|
inputs.pbsds-papers.flake = false;
|
|
|
|
|
2023-02-26 02:46:35 +01:00
|
|
|
# temp
|
|
|
|
inputs.pr-polaris14.url = "github:pbsds/nixpkgs/polaris-14";
|
|
|
|
|
2023-03-04 00:09:57 +01:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
unstable,
|
|
|
|
nixos-hardware,
|
|
|
|
nur,
|
|
|
|
home-manager,
|
|
|
|
...
|
2023-03-01 03:20:31 +01:00
|
|
|
} @ inputs:
|
2023-02-25 04:39:30 +01:00
|
|
|
let
|
2023-03-09 07:03:15 +01:00
|
|
|
nixlib = nixpkgs.lib;
|
2023-02-25 04:39:30 +01:00
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
#"riscv64-linux"
|
|
|
|
];
|
|
|
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
|
2023-03-09 07:03:15 +01:00
|
|
|
overlays = nixlib.mapAttrsToList (name: val: val) self.overlays;
|
|
|
|
|
2023-03-09 09:28:11 +01:00
|
|
|
# TODO: move unstable and nur here?
|
2023-02-26 02:46:35 +01:00
|
|
|
tmpConfig = {
|
2023-02-25 04:39:30 +01:00
|
|
|
disabledModules = [ "services/misc/polaris.nix" ];
|
2023-02-26 02:46:35 +01:00
|
|
|
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" { };
|
2023-02-25 04:39:30 +01:00
|
|
|
})];
|
|
|
|
};
|
2023-02-26 02:46:35 +01:00
|
|
|
mkConfig = hostname: system: modules: nixpkgs.lib.nixosSystem {
|
2023-02-25 04:39:30 +01:00
|
|
|
inherit system;
|
2023-02-26 02:46:35 +01:00
|
|
|
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?
|
|
|
|
})
|
|
|
|
];
|
2023-02-25 04:39:30 +01:00
|
|
|
# This makes commandline tools like 'nix run nixpkgs#hello'
|
2023-02-26 02:46:35 +01:00
|
|
|
# and 'nix-shell -p hello' use the same channel as system was built with
|
2023-02-25 04:39:30 +01:00
|
|
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
|
|
|
nix.registry.unstable.flake = inputs.unstable;
|
|
|
|
nix.nixPath = [
|
|
|
|
"nixpkgs=${inputs.nixpkgs}"
|
2023-02-26 02:46:35 +01:00
|
|
|
"unstable=${inputs.unstable}" # TODO: needed?
|
2023-02-25 04:39:30 +01:00
|
|
|
];
|
|
|
|
})];
|
|
|
|
};
|
|
|
|
in {
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-03-03 21:42:29 +01:00
|
|
|
inherit inputs;
|
2023-03-09 07:03:15 +01:00
|
|
|
|
|
|
|
overlays.remote-exec = (final: prev: {
|
|
|
|
remote-exec = prev.python3Packages.callPackage ./pkgs/remote-exec.nix {};
|
|
|
|
});
|
|
|
|
|
|
|
|
packages = forAllSystems(system:
|
|
|
|
let pkgs = import nixpkgs { inherit system overlays; };
|
|
|
|
in { inherit (pkgs) remote-exec; }
|
|
|
|
);
|
|
|
|
|
2023-02-26 02:46:35 +01:00
|
|
|
nixosConfigurations.noximilien = mkConfig "noximilien" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel ]);
|
2023-03-01 02:05:51 +01:00
|
|
|
nixosConfigurations.bolle = mkConfig "bolle" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel ]);
|
2023-03-09 07:27:50 +01:00
|
|
|
nixosConfigurations.nord = mkConfig "nord" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-gpu-amd ]);
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-02-25 04:39:30 +01:00
|
|
|
homeConfigurations = forAllSystems (system: {
|
|
|
|
pbsds = home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
modules = [ ./users/pbsds/home ];
|
|
|
|
};
|
2023-03-09 09:31:53 +01:00
|
|
|
pbsds-gnome = home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
modules = [ ./users/pbsds/home/gnome.nix ];
|
|
|
|
};
|
2023-02-25 04:39:30 +01:00
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
|
|
|
devShells = forAllSystems (system: { # TODO: apply my overlays?
|
2023-03-11 00:30:24 +01:00
|
|
|
#default = nixpkgs.legacyPackages.${system}.mkShell {
|
|
|
|
# packages = with nixpkgs.legacyPackages.${system}; [
|
|
|
|
# ];
|
|
|
|
#};
|
2023-03-09 19:37:59 +01:00
|
|
|
nomos-rebuild = nixpkgs.legacyPackages.${system}.mkShell {
|
|
|
|
packages = with nixpkgs.legacyPackages.${system}; [
|
|
|
|
(writeScriptBin "nixos-rebuild" ''
|
|
|
|
exec ${nixos-rebuild}/bin/nixos-rebuild "$@" |& ${nix-output-monitor}/bin/nom
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
};
|
2023-03-09 07:03:15 +01:00
|
|
|
non-nixos = nixpkgs.legacyPackages.${system}.mkShell {
|
|
|
|
packages = with nixpkgs.legacyPackages.${system}; [
|
2023-03-11 15:59:56 +01:00
|
|
|
(writeScriptBin "nixos-rebuild" ''
|
|
|
|
exec ${nixos-rebuild}/bin/nixos-rebuild "$@" |& ${nix-output-monitor}/bin/nom
|
|
|
|
'')
|
2023-03-09 07:03:15 +01:00
|
|
|
nix-output-monitor
|
|
|
|
home-manager
|
|
|
|
];
|
|
|
|
};
|
|
|
|
remote = nixpkgs.legacyPackages.${system}.mkShell {
|
|
|
|
packages = with nixpkgs.legacyPackages.${system}; [
|
|
|
|
self.packages.${system}.remote-exec
|
|
|
|
yq
|
|
|
|
];
|
|
|
|
};
|
2023-02-26 21:28:44 +01:00
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-02-25 04:39:30 +01:00
|
|
|
};
|
|
|
|
}
|